summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-12 01:37:19 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-12 01:37:19 +0300
commit4e5eab4fd9a5d743b956ac3dfc48bd4a6309acd3 (patch)
tree11ec337ba234609f1a966e3b00e836b066fe7a70
parent9dabaf6c1722a3ca1e0d42ae495cdeacc1718090 (diff)
downloaddeheader-4e5eab4fd9a5d743b956ac3dfc48bd4a6309acd3.tar.gz
deheader-4e5eab4fd9a5d743b956ac3dfc48bd4a6309acd3.tar.bz2
deheader-4e5eab4fd9a5d743b956ac3dfc48bd4a6309acd3.tar.xz
deheader-4e5eab4fd9a5d743b956ac3dfc48bd4a6309acd3.zip
Add flag into each preprocessor block what allow or not parse includes in this block.
For now this flag works like without it. Outside of blocks include parsed, inside is not.
-rwxr-xr-xdeheader11
1 files changed, 9 insertions, 2 deletions
diff --git a/deheader b/deheader
index 6166c57..a3140bd 100755
--- a/deheader
+++ b/deheader
@@ -1276,12 +1276,19 @@ class InclusionMap:
requires = []
seen = []
conditions = []
+ allow_parse_includes = True
for line in open(sourcefile):
c = match_preproc(["ifndef", "ifdef", "if"], line)
if c is not False:
- conditions.append(c)
+ allow_parse_includes = False
+ conditions.append((c, allow_parse_includes))
elif match_preproc("endif", line) is not False:
conditions.pop()
+ if len(conditions) == 0:
+ allow_parse_includes = True
+ else:
+ sz = len(conditions)
+ allow_parse_includes = conditions[sz - 1][1]
else:
f = match_preproc("include", line)
if f is not False:
@@ -1292,7 +1299,7 @@ class InclusionMap:
if verbosity >= PROGRESS_DEBUG:
print("deheader: ignoring %s (exclusion match with %s)." % (name, ignore.pattern))
continue
- if not conditions or conditions == ["S_SPLINT_S"]:
+ if allow_parse_includes == True:
includes.append(line)
elif verbose > 1:
print("deheader: ignoring %s (conditional inclusion)" % name)