qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 08/50] qapi: mcgen() shouldn't indent # lines


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH v3 08/50] qapi: mcgen() shouldn't indent # lines
Date: Mon, 11 Sep 2017 13:05:41 +0200

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index f2b5a7e131..2a8e60e975 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1862,7 +1862,7 @@ 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),
+        raw = re.subn(re.compile(r'^[^#\n].', re.MULTILINE),
                       indent + r'\g<0>', raw)
         raw = raw[0]
     return re.sub(re.escape(eatspace) + r' *', '', raw)
-- 
2.14.1.146.gd35faa819




reply via email to

[Prev in Thread] Current Thread [Next in Thread]