[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/14] qapi: mcgen() shouldn't indent # lines
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 05/14] qapi: mcgen() shouldn't indent # lines |
Date: |
Tue, 3 Jul 2018 23:06:04 +0200 |
From: Marc-André Lureau <address@hidden>
Skip preprocessor lines when adding indentation, since that would
likely result in invalid code.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
scripts/qapi/common.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index feae646e09..1b56065a80 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -1941,8 +1941,8 @@ def cgen(code, **kwds):
if indent_level:
indent = genindent(indent_level)
# re.subn() lacks flags support before Python 2.7, use re.compile()
- raw = re.subn(re.compile(r'^.', re.MULTILINE),
- indent + r'\g<0>', raw)
+ raw = re.subn(re.compile(r'^(?!(#|$))', re.MULTILINE),
+ indent, raw)
raw = raw[0]
return re.sub(re.escape(eatspace) + r' *', '', raw)
--
2.17.1
- [Qemu-devel] [PULL 00/14] QAPI patches for 2018-07-03, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 11/14] qapi-types: add #if conditions to types & visitors, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 03/14] qapi: leave the ifcond attribute undefined until check(), Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 09/14] qapi/commands: add #if conditions to commands, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 04/14] qapi: add 'ifcond' to visitor methods, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 13/14] qapi: add conditions to VNC type/commands/events on the schema, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 06/14] qapi: add #if/#endif helpers, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 10/14] qapi/events: add #if conditions to events, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 14/14] qapi: add conditions to SPICE type/commands/events on the schema, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 05/14] qapi: mcgen() shouldn't indent # lines,
Markus Armbruster <=
- [Qemu-devel] [PULL 01/14] qapi: add 'if' to top-level expressions, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 07/14] qapi-introspect: modify to_qlit() to append ', ' on level > 0, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 12/14] qapi: add 'If:' section to generated documentation, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 02/14] qapi: pass 'if' condition into QAPISchemaEntity objects, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PULL 08/14] qapi-introspect: add preprocessor conditions to generated QLit, Markus Armbruster, 2018/07/03
- Re: [Qemu-devel] [PULL 00/14] QAPI patches for 2018-07-03, Peter Maydell, 2018/07/05