This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80528] New: reimplement gnulib's "useless-if-before-free" script as a compiler warning
- From: "egall at gwmail dot gwu.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 26 Apr 2017 13:07:42 +0000
- Subject: [Bug c/80528] New: reimplement gnulib's "useless-if-before-free" script as a compiler warning
- Auto-submitted: auto-generated
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