aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2022-07-07 08:56:01 +0800
committerKonstantin Kostiuk <kkostiuk@redhat.com>2022-07-13 12:19:18 +0300
commitfd89c8ab091bf7faeea04bef51d4296a53a35279 (patch)
treea1871b809c1a7ffb2a3b62fbb5fb789aa89c15f2 /scripts
parent1d02ef4b61d083d3a5d298165a01385ee4cf9121 (diff)
downloadqemu-fd89c8ab091bf7faeea04bef51d4296a53a35279.zip
qemu-fd89c8ab091bf7faeea04bef51d4296a53a35279.tar.gz
qemu-fd89c8ab091bf7faeea04bef51d4296a53a35279.tar.bz2
qapi: Avoid generating C identifier 'linux'
'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> Message-Id: <20220707005602.696557-2-pizhenwei@bytedance.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/common.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 4892735..737b059 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'])
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)