mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 01:15:37 +00:00
qapi: mcgen() shouldn't indent # lines
Skip preprocessor lines when adding indentation, since that would likely result in invalid code. Backports commit 485d948ce86f5a096dc848ec31b70cd66452d40d from qemu
This commit is contained in:
parent
2ba3229cbb
commit
8a2db0aabd
|
@ -1953,8 +1953,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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue