public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/4902: no macro redef warnings
@ 2001-11-15 8:16 Zack Weinberg
0 siblings, 0 replies; 7+ messages in thread
From: Zack Weinberg @ 2001-11-15 8:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR preprocessor/4902; it has been noted by GNATS.
From: Zack Weinberg <zack@codesourcery.com>
To: Neil Booth <neil@daikokuya.demon.co.uk>
Cc: "Golubev I. N." <gin@mo.msk.ru>, gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/4902: no macro redef warnings
Date: Tue, 20 Nov 2001 00:08:53 -0800
On Tue, Nov 20, 2001 at 07:51:43AM +0000, Neil Booth wrote:
> > 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.
>
> What do you think, Zack?
This warning was on by default in 2.95, and I agree with the reporter
that non-trivial redefinitions do tend to represent bugs.
warn_of_redefinition is your code, so I must presume you meant to
change it - why?
zw
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: preprocessor/4902: no macro redef warnings
@ 2001-11-19 9:56 neil
0 siblings, 0 replies; 7+ messages in thread
From: neil @ 2001-11-19 9:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR preprocessor/4902; it has been noted by GNATS.
From: neil@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
gin@mo.msk.ru, nobody@gcc.gnu.org
Cc:
Subject: Re: preprocessor/4902: no macro redef warnings
Date: 23 Nov 2001 08:45:32 -0000
Synopsis: no macro redef warnings
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Fri Nov 23 00:45:31 2001
State-Changed-Why:
Fixed for 3.1; I'll get something in for 3.0.3 too, soon.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4902&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: preprocessor/4902: no macro redef warnings
@ 2001-11-19 9:48 neil
0 siblings, 0 replies; 7+ messages in thread
From: neil @ 2001-11-19 9:48 UTC (permalink / raw)
To: gcc-bugs, gcc-gnats, gcc-prs, gin, nobody
Synopsis: no macro redef warnings
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Fri Nov 23 00:45:31 2001
State-Changed-Why:
Fixed for 3.1; I'll get something in for 3.0.3 too, soon.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4902&database=gcc
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: preprocessor/4902: no macro redef warnings
@ 2001-11-19 9:46 Neil Booth
0 siblings, 0 replies; 7+ messages in thread
From: Neil Booth @ 2001-11-19 9:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR preprocessor/4902; it has been noted by GNATS.
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: gcc-patches@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/4902: no macro redef warnings
Date: Fri, 23 Nov 2001 07:52:50 +0000
This fixes the complaint of PR 4902 where we would only warn of
non-trivial macro redefinitions if -pedantic. Now we always warn,
which is what we used to do. It's not clear why this changed.
I'll put a similar thing in the branch soon.
Neil.
* cppmacro.c (warn_of_redefinition): Warn regardless of -pedantic.
* gcc.dg/cpp/mi6.c, gcc.dg/cpp/redef2.c: Update.
Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.85
diff -u -p -r1.85 cppmacro.c
--- cppmacro.c 2001/11/19 21:04:48 1.85
+++ cppmacro.c 2001/11/23 07:44:42
@@ -1124,9 +1124,6 @@ warn_of_redefinition (pfile, node, macro
if (node->flags & NODE_WARN)
return 1;
- if (! CPP_PEDANTIC (pfile))
- return 0;
-
/* Redefinition of a macro is allowed if and only if the old and new
definitions are the same. (6.10.3 paragraph 2). */
macro1 = node->value.macro;
Index: testsuite/gcc.dg/cpp/redef2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/redef2.c,v
retrieving revision 1.4
diff -u -p -r1.4 redef2.c
--- redef2.c 2001/09/30 10:03:11 1.4
+++ redef2.c 2001/11/23 07:44:42
@@ -1,7 +1,7 @@
/* Test for redefining macros with significant differences. */
/* { dg-do preprocess }
- { dg-options "-ansi -pedantic -Wall -fno-show-column" } */
+ { dg-options "-ansi -Wall -fno-show-column" } */
#define mac(a, b) (a) + (b)
#define mac(a, b) (a) * (b)
@@ -28,6 +28,4 @@
{ dg-warning "previous" "prev def mac" { target *-*-* } 8 }
{ dg-warning "previous" "prev def ro" { target *-*-* } 11 }
{ dg-warning "previous" "prev def va" { target *-*-* } 14 }
-
- { dg-warning "named var" "named variadic" { target *-*-* } 14 }
- { dg-warning "anonymous var" "anon variadic" { target *-*-* } 15 } */
+*/
Index: testsuite/gcc.dg/cpp/mi6.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/mi6.c,v
retrieving revision 1.2
diff -u -p -r1.2 mi6.c
--- mi6.c 2001/10/01 10:04:36 1.2
+++ mi6.c 2001/11/23 07:44:42
@@ -29,10 +29,15 @@
/* Define the macro guard, and redefine the macros to something that
forces compilation of the conditional blocks. */
#define guard
+#undef EMPTYL
#define EMPTYL 1 ||
+#undef EMPTYR
#define EMPTYR || 1
+#undef NOT
#define NOT
+#undef DEFINED
#define DEFINED 0
+#undef NOT_DEFINED
#define NOT_DEFINED 1
#define VAR five
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: preprocessor/4902: no macro redef warnings
@ 2001-11-16 23:46 Neil Booth
0 siblings, 0 replies; 7+ messages in thread
From: Neil Booth @ 2001-11-16 23:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR preprocessor/4902; it has been noted by GNATS.
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Zack Weinberg <zack@codesourcery.com>
Cc: "Golubev I. N." <gin@mo.msk.ru>, gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/4902: no macro redef warnings
Date: Wed, 21 Nov 2001 18:06:34 +0000
Zack Weinberg wrote:-
> This warning was on by default in 2.95, and I agree with the reporter
> that non-trivial redefinitions do tend to represent bugs.
> warn_of_redefinition is your code, so I must presume you meant to
> change it - why?
I don't remember; I don't think I did change it. I suspect the
semantics were already there.
In fact, I seem to remember us discussing this last year, and you
having some reason for wanting it -pedantic. Or was that something
else?
Anyway, we seem to be agreed. I'll make it unconditional.
Neil.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: preprocessor/4902: no macro redef warnings
@ 2001-11-15 7:46 Neil Booth
0 siblings, 0 replies; 7+ messages in thread
From: Neil Booth @ 2001-11-15 7:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR preprocessor/4902; it has been noted by GNATS.
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: "Golubev I. N." <gin@mo.msk.ru>
Cc: gcc-gnats@gcc.gnu.org, Zack Weinberg <zack@codesourcery.com>
Subject: Re: preprocessor/4902: no macro redef warnings
Date: Tue, 20 Nov 2001 07:51:43 +0000
> 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.
What do you think, Zack?
Neil.
^ permalink raw reply [flat|nested] 7+ messages in thread
* preprocessor/4902: no macro redef warnings
@ 2001-11-13 15:26 Golubev I. N.
0 siblings, 0 replies; 7+ messages in thread
From: Golubev I. N. @ 2001-11-13 15:26 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-11-23 8:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-15 8:16 preprocessor/4902: no macro redef warnings Zack Weinberg
-- strict thread matches above, loose matches on Subject: below --
2001-11-19 9:56 neil
2001-11-19 9:48 neil
2001-11-19 9:46 Neil Booth
2001-11-16 23:46 Neil Booth
2001-11-15 7:46 Neil Booth
2001-11-13 15:26 Golubev I. N.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).