From: Markus Armbruster <arm...@redhat.com> guardname() fails to return a valid C identifier for arguments containing anything but [A-Za-z0-9_.-']. Fix that. Don't bother protecting ticklish identifiers; header guards are all-caps, and no ticklish identifiers are.
Signed-off-by: Markus Armbruster <arm...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> Message-Id: <20180211093607.27351-22-arm...@redhat.com> Reviewed-by: Michael Roth <mdr...@linux.vnet.ibm.com> Signed-off-by: Eric Blake <ebl...@redhat.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 547656c8b29..069ec3715d7 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1867,7 +1867,7 @@ def mcgen(code, **kwds): def guardname(filename): - return c_name(filename, protect=False).upper() + return re.sub(r'[^A-Za-z0-9_]', '_', filename).upper() def guardstart(name): -- 2.14.3