This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/43530] New: Add a warning for defines that clobber local variable names
- From: "joseph dot h dot garvin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Mar 2010 02:59:47 -0000
- Subject: [Bug c/43530] New: Add a warning for defines that clobber local variable names
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Or alternatively, a warning for unportable variable names (maybe easier to
implement because of the preprocessor/compiler division). When on Solaris for
example, the system headers #define 'sun' to an integer value, which creates
hard to diagnose errors if you've accidentally named a local variable 'sun'
(which happens a lot in sockets code, e.g. shorthand for Sockaddr_UN.
There could be a legitimate use for a define that clobbers a local variable
name, but I imagine it's unusual. Often macros that create local variables
handle specifying the type themselves as well, or take arguments (the warning
could be specific to no-argument defines), or are at least uppercase. There
couldn't be that many false positives for 'lowercase defines that clobber names
in local variable declarations' ;p
--
Summary: Add a warning for defines that clobber local variable
names
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: joseph dot h dot garvin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43530