From a2e4e04571955e0a7b2144167fb4e0c59e4ccf09 Mon Sep 17 00:00:00 2001 From: manu Date: Sat, 16 Feb 2008 16:29:12 +0000 Subject: [PATCH] 2008-02-16 Manuel Lopez-Ibanez PR c/28368 * doc/invoke.texi (-std): Clarify description of -std= and -ansi. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132367 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/doc/invoke.texi | 48 +++++++++++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d04f3a6..6fc4d4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-02-16 Manuel Lopez-Ibanez + + PR c/28368 + * doc/invoke.texi (-std): Clarify description of -std= and -ansi. + 2008-02-16 Ralf Corsepius * config/m68k/t-rtems (M68K_MLIB_CPU): Add 5208, 5307, 5407, 5475 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2809812..8c91dfd 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1335,12 +1335,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. @@ -1354,19 +1373,21 @@ 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. @item c++0x The working draft of the upcoming ISO C++0x standard. This option @@ -1376,21 +1397,10 @@ enabled by this flag may be removed from future versions of GCC if it is not part of the C++0x standard. @item gnu++0x -The same as @option{-std=c++0x} plus GNU extensions. As with -@option{-std=c++0x}, this option enables experimental features that may -be removed in future versions of GCC. +GNU dialect of @option{-std=c++0x}. This option enables +experimental features that may be removed in future versions of GCC. @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 -- 2.7.4