updated check-implicit-pointer-functions script
In tracking down an xfig crash, I noticed that my
check-implicit-pointer-functions script failed to catch the case where
an implicitly declared function's return-value gets cast to a pointer.
Of course, that's the problem that caused xfig to crash... The script
below has been updated to fix that issue.
Caveat: even with the updated script, you won't see the xfig problem
with the normal Debian build-log, because the package doesn't turn on
-Wall. I'm not sure what should be done about that. However, it
might be useful to rerun the script on the other build logs to see if
it catches anything new.
# Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
# David Mosberger <firstname.lastname@example.org>
# Scan standard input for GCC warning messages that are likely to
# source of real 64-bit problems. In particular, see whether there
# are any implicitly declared functions whose return values are later
# interpreted as pointers. Those are almost guaranteed to cause
implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration "
+ "of function `([^']*)'")
pointer_pattern = re.compile(
"([^:]*):(\d+): warning: "
+ "|passing arg \d+ of `[^']*'"
+ "|passing arg \d+ of pointer to function"
+ ") makes pointer from integer without a cast"
+ "cast to pointer from integer of different size)")
last_implicit_filename = ""
last_implicit_linenum = -1
last_implicit_func = ""
line = sys.stdin.readline()
if line == '':
m = implicit_pattern.match(line)
last_implicit_filename = m.group(1)
last_implicit_linenum = int(m.group(2))
last_implicit_func = m.group(3)
m = pointer_pattern.match(line)
pointer_filename = m.group(1)
pointer_linenum = int(m.group(2))
if (last_implicit_filename == pointer_filename
and last_implicit_linenum == pointer_linenum):
print "Function `%s' implicitly converted to pointer at " \
"%s:%d" % (last_implicit_func, last_implicit_filename,