[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 09/51] qapi: mcgen() shouldn't indent # lines
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v4 09/51] qapi: mcgen() shouldn't indent # lines |
Date: |
Thu, 11 Jan 2018 22:32:08 +0100 |
Skip preprocessor lines when adding indentation, since that would
likely result in invalid code.
Signed-off-by: Marc-André Lureau <address@hidden>
---
scripts/qapi.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index ffb4fb58e0..3d33ed7d76 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1876,8 +1876,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.16.0.rc1.1.gef27df75a1
- [Qemu-devel] [PATCH v4 00/51] Hi,, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 01/51] qlit: use QType instead of int, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 02/51] qlit: add qobject_from_qlit(), Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 03/51] qapi: generate a literal qobject for introspection, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 04/51] qapi2texi: minor python code simplification, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 05/51] qapi: add 'if' to top-level expressions, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 06/51] qapi: pass 'if' condition into QAPISchemaEntity objects, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 07/51] qapi: leave the ifcond attribute undefined until check(), Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 08/51] qapi: add 'ifcond' to visitor methods, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 09/51] qapi: mcgen() shouldn't indent # lines,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v4 10/51] qapi: add #if/#endif helpers, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 11/51] qapi-introspect: modify to_qlit() to append ', ' on level > 0, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 12/51] qapi-introspect: add preprocessor conditions to generated QLit, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 13/51] qapi-commands: add #if conditions to commands, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 14/51] qapi-event: add #if conditions to events, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 15/51] qapi-types: refactor variants handling, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 16/51] qapi-types: add #if conditions to types & visitors, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 17/51] qapi: do not define enumeration value explicitely, Marc-André Lureau, 2018/01/11
- [Qemu-devel] [PATCH v4 18/51] qapi: rename QAPISchemaEnumType.values to .members, Marc-André Lureau, 2018/01/11