* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
@ 2007-03-07 14:48 ` lloyd at randombit dot net
2007-03-07 17:57 ` manu at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: lloyd at randombit dot net @ 2007-03-07 14:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from lloyd at randombit dot net 2007-03-07 14:47 -------
This is also true for C++ unless -pedantic is specified (which is confusing
since I thought -pedantic-errors was the default for C++, but apparently this
changed at some point). Using '-Wall -Wextra -ansi -std=c++98' gives no
warning.
I'm not sure if it's really a bug, since the GCC docs make it pretty clear that
-ansi et. al. are basically useless in terms of getting it to warn you about
using extensions, but it is certainly unexpected.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
2007-03-07 14:48 ` [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension lloyd at randombit dot net
@ 2007-03-07 17:57 ` manu at gcc dot gnu dot org
2007-03-07 18:04 ` joseph at codesourcery dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-03-07 17:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from manu at gcc dot gnu dot org 2007-03-07 17:57 -------
The documentation says that you should use -pedantic to warn about GCC
extensions[*], so I am not sure whether this is valid. But honestly, from the
description of "-std=", I would understand that GNU extensions are disabled
when using -std=c89 or that pedantic does not warn for them when using
-std=gnu89, but neither of those are true.
[*] http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html#C-Extensions
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
2007-03-07 14:48 ` [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension lloyd at randombit dot net
2007-03-07 17:57 ` manu at gcc dot gnu dot org
@ 2007-03-07 18:04 ` joseph at codesourcery dot com
2007-03-07 18:11 ` manu at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: joseph at codesourcery dot com @ 2007-03-07 18:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from joseph at codesourcery dot com 2007-03-07 18:04 -------
Subject: Re: -std=c89 doesn't warn about gcc's "?:" extension
On Wed, 7 Mar 2007, manu at gcc dot gnu dot org wrote:
> The documentation says that you should use -pedantic to warn about GCC
> extensions[*], so I am not sure whether this is valid. But honestly, from the
> description of "-std=", I would understand that GNU extensions are disabled
> when using -std=c89 or that pedantic does not warn for them when using
> -std=gnu89, but neither of those are true.
The key concept is that of base standard, as described in this passage
from invoke.texi:
Where the standard specified with @option{-std} represents a GNU
extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
corresponding @dfn{base standard}, the version of ISO C on which the GNU
extended dialect is based. Warnings from @option{-pedantic} are given
where they are required by the base standard. (It would not make sense
for such warnings to be given only for features not in the specified GNU
C dialect, since by definition the GNU dialects of C include all
features the compiler supports with the given option, and there would be
nothing to warn about.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-03-07 18:04 ` joseph at codesourcery dot com
@ 2007-03-07 18:11 ` manu at gcc dot gnu dot org
2007-03-07 21:06 ` joseph at codesourcery dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-03-07 18:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from manu at gcc dot gnu dot org 2007-03-07 18:11 -------
(In reply to comment #3)
> Subject: Re: -std=c89 doesn't warn about gcc's "?:" extension
>
> Where the standard specified with @option{-std} represents a GNU
> extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
> corresponding @dfn{base standard}, the version of ISO C on which the GNU
> extended dialect is based. Warnings from @option{-pedantic} are given
> where they are required by the base standard. (It would not make sense
> for such warnings to be given only for features not in the specified GNU
> C dialect, since by definition the GNU dialects of C include all
> features the compiler supports with the given option, and there would be
> nothing to warn about.)
>
Sorry, I still don't understand what is the difference between -std=c89 and
-std=gnu89.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-03-07 18:11 ` manu at gcc dot gnu dot org
@ 2007-03-07 21:06 ` joseph at codesourcery dot com
2007-03-08 15:52 ` manu at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: joseph at codesourcery dot com @ 2007-03-07 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from joseph at codesourcery dot com 2007-03-07 21:06 -------
Subject: Re: -std=c89 doesn't warn about gcc's "?:" extension
On Wed, 7 Mar 2007, manu at gcc dot gnu dot org wrote:
> Sorry, I still don't understand what is the difference between -std=c89 and
> -std=gnu89.
-std=c89 accepts C89 programs that conflict with the GNU C89 language.
For example, ones using "inline" or "asm" as an identifier, or using any
non-reserved identifier predefined as a macro in GNU C (such as "linux" or
"i386") or using trigraphs.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-03-07 21:06 ` joseph at codesourcery dot com
@ 2007-03-08 15:52 ` manu at gcc dot gnu dot org
2008-01-18 12:46 ` manu at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-03-08 15:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from manu at gcc dot gnu dot org 2007-03-08 15:52 -------
(In reply to comment #5)
> Subject: Re: -std=c89 doesn't warn about gcc's "?:" extension
>
> On Wed, 7 Mar 2007, manu at gcc dot gnu dot org wrote:
>
> > Sorry, I still don't understand what is the difference between -std=c89 and
> > -std=gnu89.
>
> -std=c89 accepts C89 programs that conflict with the GNU C89 language.
> For example, ones using "inline" or "asm" as an identifier, or using any
> non-reserved identifier predefined as a macro in GNU C (such as "linux" or
> "i386") or using trigraphs.
>
That clarifies all perfectly. I think it is not as clear in the manual but
perhaps I am a bit slow. Maybe in -std= it should say:
gnu89
- Default, ISO C90 plus GNU extensions (including some C99
fea‐
- tures).
+ Default, subset of ISO C90 that doesn't conflict
+ with GNU extensions (including some C99 features
+ that conflict with C90)
In any case, this bug seems invalid to me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-03-08 15:52 ` manu at gcc dot gnu dot org
@ 2008-01-18 12:46 ` manu at gcc dot gnu dot org
2008-02-16 16:30 ` manu at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-18 12:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from manu at gcc dot gnu dot org 2008-01-18 12:09 -------
(In reply to comment #1)
> This is also true for C++ unless -pedantic is specified (which is confusing
> since I thought -pedantic-errors was the default for C++, but apparently this
> changed at some point). Using '-Wall -Wextra -ansi -std=c++98' gives no
> warning.
>
Jack, why would you use "-ansi -std=c++98" in the same command-line? From
reading the current manual (for example,
http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/), what do you think that
combination achieves?
I am trying to improve this part of the manual. See my current patch at
http://gcc.gnu.org/ml/gcc-patches/2008-01/txt00033.txt
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-01-18 12:46 ` manu at gcc dot gnu dot org
@ 2008-02-16 16:30 ` manu at gcc dot gnu dot org
2008-02-16 18:16 ` manu at gcc dot gnu dot org
2008-02-16 18:21 ` manu at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-16 16:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from manu at gcc dot gnu dot org 2008-02-16 16:29 -------
Subject: Bug 28368
Author: manu
Date: Sat Feb 16 16:29:12 2008
New Revision: 132367
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132367
Log:
2008-02-16 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/28368
* doc/invoke.texi (-std): Clarify description of -std= and -ansi.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-02-16 16:30 ` manu at gcc dot gnu dot org
@ 2008-02-16 18:16 ` manu at gcc dot gnu dot org
2008-02-16 18:21 ` manu at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-16 18:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from manu at gcc dot gnu dot org 2008-02-16 18:16 -------
Subject: Bug 28368
Author: manu
Date: Sat Feb 16 18:15:20 2008
New Revision: 132368
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132368
Log:
2008-02-16 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/28368
* doc/invoke.texi (-std): Clarify description of -std= and -ansi.
Modified:
branches/gcc-4_2-branch/gcc/ChangeLog
branches/gcc-4_2-branch/gcc/doc/invoke.texi
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/28368] -std=c89 doesn't warn about gcc's "?:" extension
2006-07-13 6:28 [Bug c/28368] New: gcc-bugzilla at gcc dot gnu dot org
` (8 preceding siblings ...)
2008-02-16 18:16 ` manu at gcc dot gnu dot org
@ 2008-02-16 18:21 ` manu at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-16 18:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from manu at gcc dot gnu dot org 2008-02-16 18:20 -------
The new description in GCC 4.3 and GCC 4.2.4 should clarify this from now on.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.2.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368
^ permalink raw reply [flat|nested] 11+ messages in thread