Teach wmlscope to selectively ignore multiple macro definitions.
This commit is contained in:
parent
0d0877e90e
commit
0d43b36615
3 changed files with 24 additions and 1 deletions
|
@ -61,3 +61,7 @@
|
|||
#enddef
|
||||
# wmlscope: stop ignoring
|
||||
#endif
|
||||
|
||||
# wmlscope: prune NEW_GOLD_CARRYOVER
|
||||
# wmlscope: prune NEW_GOLD_CARRYOVER_NOTE_20
|
||||
# wmlscope: prune NEW_GOLD_CARRYOVER_NOTE_40
|
||||
|
|
|
@ -266,7 +266,7 @@ class CrossRef:
|
|||
try:
|
||||
pattern = re.compile(os.sep + pattern + "$")
|
||||
except sre_constants.error:
|
||||
print >>sys.stderr, "macroscope: confused by %s" % pattern
|
||||
print >>sys.stderr, "wmlscope: confused by %s" % pattern
|
||||
return None
|
||||
key = None
|
||||
for trial in self.fileref:
|
||||
|
@ -337,6 +337,17 @@ class CrossRef:
|
|||
if namespace not in self.properties:
|
||||
self.properties[namespace] = {}
|
||||
self.properties[namespace][prop] = value
|
||||
m = re.search("# *wmlscope: prune (.*)", line)
|
||||
if m:
|
||||
name = m.group(1)
|
||||
if warnlevel >= 2:
|
||||
print '"%s", line %d: pruning definitions of %s' \
|
||||
% (filename, n+1, name )
|
||||
if name not in self.xref:
|
||||
print >>sys.stderr, "wmlscope: can't prune undefined macro %s" % name
|
||||
else:
|
||||
self.xref[name] = self.xref[name][:1]
|
||||
continue
|
||||
if "# wmlscope: start ignoring" in line:
|
||||
if warnlevel > 1:
|
||||
print '"%s", line %d: starting ignoring' \
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
# a name generated from the attack name. This behavior can be suppressed
|
||||
# by adding a magic comment containing the string "no-icon" to the name= line.
|
||||
#
|
||||
# The collowing magic comment:
|
||||
#
|
||||
# # prune FOOBAR
|
||||
#
|
||||
# will cause wmlscope to forget about all but one of the definitions of FOOBAR
|
||||
# it has seen. This will be useful mainly for symbols that have different
|
||||
# definitions enabled by an #ifdef.
|
||||
#
|
||||
# The checking done by this tool has a couple of flaws:
|
||||
#
|
||||
# (1) It doesn't actually evaluate file inclusions. Instead, any
|
||||
|
|
Loading…
Add table
Reference in a new issue