* [Bug preprocessor/22168] #if #A == #B should have a diagnostic
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
@ 2005-06-24 9:06 ` schwab at suse dot de
2005-06-24 14:56 ` neil at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: schwab at suse dot de @ 2005-06-24 9:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2005-06-24 09:06 -------
GCC should already reject the use of the # operator, which is only allowed in
the replacement list of a macro and then only when followed by a macro
parameter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
2005-06-24 9:06 ` [Bug preprocessor/22168] " schwab at suse dot de
@ 2005-06-24 14:56 ` neil at gcc dot gnu dot org
2005-06-24 15:19 ` geoffk at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: neil at gcc dot gnu dot org @ 2005-06-24 14:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From neil at gcc dot gnu dot org 2005-06-24 14:56 -------
Documented behaviour.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
2005-06-24 9:06 ` [Bug preprocessor/22168] " schwab at suse dot de
2005-06-24 14:56 ` neil at gcc dot gnu dot org
@ 2005-06-24 15:19 ` geoffk at gcc dot gnu dot org
2005-06-24 15:26 ` schwab at suse dot de
` (8 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2005-06-24 15:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From geoffk at gcc dot gnu dot org 2005-06-24 15:19 -------
Still a bug, even if a documented one; the syntax does not allow it. '#if #A' is neither an if-group (because
'#A' is not syntactically a constant-expression in the preprocessor) nor a sequence of group-parts,
because 'if' is not a non-directive; see 6.10 paragraph 1. Since this a syntax violation, a diagnostic is
required.
Where is it documented?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-06-24 15:19 ` geoffk at gcc dot gnu dot org
@ 2005-06-24 15:26 ` schwab at suse dot de
2005-06-24 15:42 ` [Bug preprocessor/22168] New: " Andrew Pinski
` (7 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: schwab at suse dot de @ 2005-06-24 15:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2005-06-24 15:26 -------
*Note (cpp)Assertions::.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-06-24 15:26 ` schwab at suse dot de
@ 2005-06-24 15:42 ` Andrew Pinski
2005-06-24 15:42 ` [Bug preprocessor/22168] " pinskia at physics dot uc dot edu
` (6 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Andrew Pinski @ 2005-06-24 15:42 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
On Jun 23, 2005, at 10:04 PM, geoffk at gcc dot gnu dot org wrote:
> GCC quietly accepts the following:
>
> #define A a
> #define B a
> #if #A == #B
> #endif
In fact if we look at the output for the following code:
#define A b
#define B c
#if #A == #B
void g(void);
#endif
We find that "void g(void);" is always outputted so in fact
it does not do what David wanted it to do.
Thanks,
Andrew Pinski
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-06-24 15:42 ` [Bug preprocessor/22168] New: " Andrew Pinski
@ 2005-06-24 15:42 ` pinskia at physics dot uc dot edu
2005-06-24 18:02 ` [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode geoffk at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: pinskia at physics dot uc dot edu @ 2005-06-24 15:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at physics dot uc dot edu 2005-06-24 15:42 -------
Subject: Re: New: #if #A == #B should have a diagnostic
On Jun 23, 2005, at 10:04 PM, geoffk at gcc dot gnu dot org wrote:
> GCC quietly accepts the following:
>
> #define A a
> #define B a
> #if #A == #B
> #endif
In fact if we look at the output for the following code:
#define A b
#define B c
#if #A == #B
void g(void);
#endif
We find that "void g(void);" is always outputted so in fact
it does not do what David wanted it to do.
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-06-24 15:42 ` [Bug preprocessor/22168] " pinskia at physics dot uc dot edu
@ 2005-06-24 18:02 ` geoffk at gcc dot gnu dot org
2005-06-24 22:24 ` neil at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2005-06-24 18:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From geoffk at gcc dot gnu dot org 2005-06-24 18:02 -------
Yup, it's documented. However, it's still silently accepted even with -pedantic, and the language doesn't
permit that.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|#if #A == #B should have a |#if #A == #B should have a
|diagnostic |diagnostic in ISO C mode
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-06-24 18:02 ` [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode geoffk at gcc dot gnu dot org
@ 2005-06-24 22:24 ` neil at gcc dot gnu dot org
2005-06-24 22:26 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: neil at gcc dot gnu dot org @ 2005-06-24 22:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From neil at gcc dot gnu dot org 2005-06-24 22:24 -------
(In reply to comment #6)
> Yup, it's documented. However, it's still silently accepted even with
-pedantic, and the language doesn't
> permit that.
My copy of the standard only requires a constant expression - can you point out
where you read its requiring an integer constant expression?
The standard explicitly permits extensions to constant expressions. Since this
extension is explicitly documented as for use in #if expressions, it should be
obvious that we intend #foo as a constant expression. No diagnostic is
therefore required.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-06-24 22:24 ` neil at gcc dot gnu dot org
@ 2005-06-24 22:26 ` pinskia at gcc dot gnu dot org
2005-06-24 22:41 ` schwab at suse dot de
` (2 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-24 22:26 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-06-24 22:26:42
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-06-24 22:26 ` pinskia at gcc dot gnu dot org
@ 2005-06-24 22:41 ` schwab at suse dot de
2005-06-24 23:09 ` joseph at codesourcery dot com
2005-06-25 22:11 ` jsm28 at gcc dot gnu dot org
11 siblings, 0 replies; 20+ messages in thread
From: schwab at suse dot de @ 2005-06-24 22:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2005-06-24 22:41 -------
The standard does not allow to extend the syntax. Since this violates the
syntax of the language a diagnostic is required.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (9 preceding siblings ...)
2005-06-24 22:41 ` schwab at suse dot de
@ 2005-06-24 23:09 ` joseph at codesourcery dot com
2005-06-25 22:11 ` jsm28 at gcc dot gnu dot org
11 siblings, 0 replies; 20+ messages in thread
From: joseph at codesourcery dot com @ 2005-06-24 23:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joseph at codesourcery dot com 2005-06-24 23:09 -------
Subject: Re: #if #A == #B should have a diagnostic
in ISO C mode
On Fri, 24 Jun 2005, neil at gcc dot gnu dot org wrote:
> My copy of the standard only requires a constant expression - can you point out
> where you read its requiring an integer constant expression?
6.10.1#1, "shall be an integer constant expression"; 6.8.1 in C90.
> The standard explicitly permits extensions to constant expressions. Since this
But not to integer constant expressions (at least according to the view
expressed in the DR#312 discussion in the draft Lillehammer minutes,
although DR#032 implies a different view).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug preprocessor/22168] #if #A == #B should have a diagnostic in ISO C mode
2005-06-24 2:04 [Bug preprocessor/22168] New: #if #A == #B should have a diagnostic geoffk at gcc dot gnu dot org
` (10 preceding siblings ...)
2005-06-24 23:09 ` joseph at codesourcery dot com
@ 2005-06-25 22:11 ` jsm28 at gcc dot gnu dot org
11 siblings, 0 replies; 20+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-06-25 22:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-06-25 22:11 -------
Diagnostic needed for -pedantic (and in general I don't like extensions not
being diagnosed with -pedantic even where diagnostics aren't strictly required).
[comment#10 did not appear on gcc-bugs - apparently substantive messages should
not be sent to gcc-bugzilla with signatures or other attachments.]
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |16620, 16989
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168
^ permalink raw reply [flat|nested] 20+ messages in thread