This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/43530] New: Add a warning for defines that clobber local variable names


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]