]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/28368 (-std=c89 doesn't warn about gcc's "?:" extension)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Sat, 16 Feb 2008 18:15:20 +0000 (18:15 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Sat, 16 Feb 2008 18:15:20 +0000 (18:15 +0000)
2008-02-16  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

PR c/28368
* doc/invoke.texi (-std): Clarify description of -std= and -ansi.

From-SVN: r132368

gcc/ChangeLog
gcc/doc/invoke.texi

index c38bf28698e4828273a8b8c2f6385b2e0d0394c1..f8b33e18f1a2b8da5dc046da1e4ec2ebeb9c8135 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-16  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       PR c/28368
+       * doc/invoke.texi (-std): Clarify description of -std= and -ansi.
+
 2008-02-14  Alan Modra  <amodra@bigpond.net.au>
 
        PR target/34393
index 63473d63ee6234c0ee02098c93409b00c43b0fd0..5514943da30fb8e5a0e73797ec14fb58028c2c94 100644 (file)
@@ -1172,12 +1172,31 @@ Determine the language standard. @xref{Standards,,Language Standards
 Supported by GCC}, for details of these standard versions.  This option
 is currently only supported when compiling C or C++. 
 
+The compiler can accept several base standards, such as @samp{c89} or
+@samp{c++98}, and GNU dialects of those standards, such as
+@samp{gnu89} or @samp{gnu++98}.  By specifing a base standard, the
+compiler will accept all programs following that standard and those
+using GNU extensions that do not contradict it.  For example,
+@samp{-std=c89} turns off certain features of GCC that are
+incompatible with ISO C90, such as the @code{asm} and @code{typeof}
+keywords, but not other GNU extensions that do not have a meaning in
+ISO C90, such as omitting the middle term of a @code{?:}
+expression. On the other hand, by specifing a GNU dialect of a
+standard, all features the compiler support are enabled, even when
+those features change the meaning of the base standard and some
+strict-conforming programs may be rejected.  The particular standard
+is used by @option{-pedantic} to identify which features are GNU
+extensions given that version of the standard. For example
+@samp{-std=gnu89 -pedantic} would warn about C++ style @samp{//}
+comments, while @samp{-std=gnu99 -pedantic} would not.
+
 A value for this option must be provided; possible values are
 
 @table @samp
 @item c89
 @itemx iso9899:1990
-ISO C90 (same as @option{-ansi}).
+Support all ISO C90 programs (certain GNU extensions that conflict
+with ISO C90 are disabled). Same as @option{-ansi} for C code.
 
 @item iso9899:199409
 ISO C90 as modified in amendment 1.
@@ -1191,31 +1210,23 @@ ISO C99.  Note that this standard is not yet fully supported; see
 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
 
 @item gnu89
-Default, ISO C90 plus GNU extensions (including some C99 features).
+GNU dialect of ISO C90 (including some C99 features). This
+is the default for C code.
 
 @item gnu99
 @itemx gnu9x
-ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
+GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC,
 this will become the default.  The name @samp{gnu9x} is deprecated.
 
 @item c++98
-The 1998 ISO C++ standard plus amendments.
+The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
+C++ code.
 
 @item gnu++98
-The same as @option{-std=c++98} plus GNU extensions.  This is the
-default for C++ code.
+GNU dialect of @option{-std=c++98}.  This is the default for
+C++ code.
 @end table
 
-Even when this option is not specified, you can still use some of the
-features of newer standards in so far as they do not conflict with
-previous C standards.  For example, you may use @code{__restrict__} even
-when @option{-std=c99} is not specified.
-
-The @option{-std} options specifying some version of ISO C have the same
-effects as @option{-ansi}, except that features that were not in ISO C90
-but are in the specified version (for example, @samp{//} comments and
-the @code{inline} keyword in ISO C99) are not disabled.
-
 @item -fgnu89-inline
 @opindex fgnu89-inline
 The option @option{-fgnu89-inline} tells GCC to use the traditional