[Bug c/80528] New: reimplement gnulib's "useless-if-before-free" script as a compiler warning
egall at gwmail dot gwu.edu
gcc-bugzilla@gcc.gnu.org
Wed Apr 26 13:07:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80528
Bug ID: 80528
Summary: reimplement gnulib's "useless-if-before-free" script
as a compiler warning
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: egall at gwmail dot gwu.edu
Target Milestone: ---
Split off from Bug 80519
Gnulib has a script called "useless-if-before-free" that detects code like:
if (p) free(p);
and warns about it, since the "if" test is usually unneeded nowadays. It'd be
nice if GCC did this warning instead, so users wouldn't have to import a
separate script from gnulib just to check for this sort of thing.
Source for script:
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=build-aux/useless-if-before-free;h=4e3f3a2658b105e8949f14ef85d733192c29be2c;hb=HEAD
More information about the Gcc-bugs
mailing list