All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: zhenwei pi <pizhenwei@bytedance.com>
Cc: michael.roth@amd.com,  kkostiuk@redhat.com,
	marcandre.lureau@redhat.com,  qemu-devel@nongnu.org
Subject: Re: [PATCH v4 1/2] qapi: Avoid generating C identifier 'linux'
Date: Thu, 07 Jul 2022 08:26:08 +0200	[thread overview]
Message-ID: <87edyxiglb.fsf@pond.sub.org> (raw)
In-Reply-To: <20220707005602.696557-2-pizhenwei@bytedance.com> (zhenwei pi's message of "Thu, 7 Jul 2022 08:56:01 +0800")

zhenwei pi <pizhenwei@bytedance.com> writes:

> 'linux' is not usable as identifier, because C compilers targeting
> Linux predefine it as a macro expanding to 1.  Add it to
> @polluted_words. 'unix' is already there.
>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  scripts/qapi/common.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
> index 489273574a..737b059e62 100644
> --- a/scripts/qapi/common.py
> +++ b/scripts/qapi/common.py
> @@ -114,7 +114,7 @@ def c_name(name: str, protect: bool = True) -> str:
>                       'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
>                       'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'])
>      # namespace pollution:
> -    polluted_words = set(['unix', 'errno', 'mips', 'sparc', 'i386'])
> +    polluted_words = set(['unix', 'errno', 'mips', 'sparc', 'i386', 'linux'])

If this list gets any longer, we better keep it in alphabetical order.

>      name = re.sub(r'[^A-Za-z0-9_]', '_', name)
>      if protect and (name in (c89_words | c99_words | c11_words | gcc_words
>                               | cpp_words | polluted_words)

Reviewed-by: Markus Armbruster <armbru@redhat.com>



  reply	other threads:[~2022-07-07  6:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  0:56 [PATCH v4 0/2] qga: add command 'guest-get-cpustats' zhenwei pi
2022-07-07  0:56 ` [PATCH v4 1/2] qapi: Avoid generating C identifier 'linux' zhenwei pi
2022-07-07  6:26   ` Markus Armbruster [this message]
2022-07-07  6:28     ` zhenwei pi
2022-07-07  0:56 ` [PATCH v4 2/2] qga: add command 'guest-get-cpustats' zhenwei pi
2022-07-07  8:00   ` Konstantin Kostiuk
2022-07-12  9:30 ` [PATCH v4 0/2] " Konstantin Kostiuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edyxiglb.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pizhenwei@bytedance.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.