This is the mail archive of the gcc-prs@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]

preprocessor/4902: no macro redef warnings

[Get raw message]

>Number:         4902
>Category:       preprocessor
>Synopsis:       no macro redef warnings
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 19 10:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Golubev I. N.
>Release:        3.0.2
>Organization:
>Environment:
System: 


host: 
build: 
target: 
configured with:  
>Description:

Neil wrote in <http://gcc.gnu.org/ml/gcc-bugs/2001-11/msg00263.html>:

> you get a warning iff -pedantic

`(cpp)Undefining and Redefining Macros' does not say so.  Neither does
it explain (or refer to explanation) why that change of requiring
`-pedantic' was made (making `gcc' different from many other compilers
which warn by default).

Perhaps some people think that redefn warnings `trigger frequently on
harmless code' (as `-pedantic' description in `(cpp)Invocation' says),
but I disagree.  My experience shows that more often than not they
detect real bugs.

>How-To-Repeat:

#define a 1
#define a 2

I expect: warnings like this:

2:warning: `a' redefined
1:warning: this is the location of the previous definition

I get: no warnings.

>Fix:
	
1. Add more granularity to cpp warning options.  Allow redefn warnings
to be enabled without requesting all `-pedantic' diagnostics.

2. Whether it done or not, document in `(cpp)Undefining and Redefining
Macros' option required to get redefn warnings (or to suppress them,
if they are re-enabled by default).
>Release-Note:
>Audit-Trail:
>Unformatted:


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