wmlscope: allow reporting deprecated macro calls
This commit is contained in:
parent
4f3236d60b
commit
21bd75c12f
2 changed files with 14 additions and 0 deletions
|
@ -805,6 +805,7 @@ macro found in {}: {}".format(filename,
|
|||
# Next, decorate definitions with all references from the filelist.
|
||||
self.unresolved = []
|
||||
self.missing = []
|
||||
self.deprecated = []
|
||||
formals = []
|
||||
optional_formals = []
|
||||
state = "outside"
|
||||
|
@ -881,6 +882,8 @@ macro found in {}: {}".format(filename,
|
|||
if self.visible_from(defn, fn, n+1):
|
||||
defn.append(fn, n+1, args, optional_args)
|
||||
candidates.append(str(defn))
|
||||
if defn.deprecated:
|
||||
self.deprecated.append((name,Reference(ns,fn,n+1)))
|
||||
if len(candidates) > 1:
|
||||
print("%s: more than one definition of %s is visible here (%s)." % (Reference(ns, fn, n), name, "; ".join(candidates)))
|
||||
if len(candidates) == 0:
|
||||
|
|
|
@ -175,6 +175,7 @@ class CrossRefLister(CrossRef):
|
|||
if len(self.unresolved) == 0 and len(self.missing) == 0:
|
||||
print("# No unresolved references")
|
||||
else:
|
||||
print("# Unresolved references:")
|
||||
#print(list(self.fileref.keys()))
|
||||
for (name, reference) in self.unresolved + self.missing:
|
||||
print("%s: Unresolved reference -> %s" % (reference, name))
|
||||
|
@ -206,6 +207,15 @@ class CrossRefLister(CrossRef):
|
|||
", " if optional_args else "",
|
||||
", ".join(["{}=optional {}".format(f, actualtype(oa)) for f,oa in optional_args.items()])))
|
||||
|
||||
def deprecateddump(self):
|
||||
"Report calls to deprecated macros"
|
||||
if not self.deprecated:
|
||||
print("# No calls to deprecated macros")
|
||||
return
|
||||
print("# Calls to deprecated macros:")
|
||||
for (name, reference) in self.deprecated:
|
||||
print("%s: Deprecated macro call -> %s" % (reference, name))
|
||||
|
||||
def incorrectlysized(self):
|
||||
"Report incorrectly sized images that cannot be safely used for their intended purpose"
|
||||
for (namespace, filename) in xref.filelist.generator():
|
||||
|
@ -552,6 +562,7 @@ directories are given, all files under the current directory are checked.""")
|
|||
xref.deflist(predicate)
|
||||
if unresolved:
|
||||
xref.incorrectlysized()
|
||||
xref.deprecateddump()
|
||||
xref.unresdump()
|
||||
xref.duplicates(exportonly=True)
|
||||
except KeyboardInterrupt:
|
||||
|
|
Loading…
Add table
Reference in a new issue