https://gcc.gnu.org/g:81203220af87714fd0f3170a2043ab5d95353eef
commit r15-8046-g81203220af87714fd0f3170a2043ab5d95353eef Author: Sandra Loosemore <sloosem...@baylibre.com> Date: Wed Mar 12 23:36:17 2025 +0000 Doc: Remove redundant info from documentation of -ansi. The -ansi option has essentially been superseded by the more general -std= option, and all the additional information about its effects is already covered elsewhere in the manual. I also cleaned up some confusing text about alternate keywords that I noticed while confirming this. gcc/ChangeLog * doc/extend.texi (Alternate Keywords): Clean up text and remove discussion of "restrict", which is not a GNU extension at all. * doc/invoke.texi (C Dialect Options): Remove detailed discussion. Diff: --- gcc/doc/extend.texi | 16 ++++++---------- gcc/doc/invoke.texi | 33 --------------------------------- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index bae3fba6b2b6..79cc7dfcff9c 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -13049,17 +13049,13 @@ is taken as the minimum size, ignoring how many instructions GCC thinks it is. @cindex keywords, alternate @option{-ansi} and the various @option{-std} options disable certain -keywords. This causes trouble when you want to use GNU C extensions, or -a general-purpose header file that should be usable by all programs, -including ISO C programs. The keywords @code{asm}, @code{typeof} and +keywords that are GNU C extensions. +Specifically, the keywords @code{asm}, @code{typeof} and @code{inline} are not available in programs compiled with -@option{-ansi} or @option{-std} (although @code{inline} can be used in a -program compiled with @option{-std=c99} or a later standard). The -ISO C99 keyword -@code{restrict} is only available when @option{-std=gnu99} (which will -eventually be the default) or @option{-std=c99} (or the equivalent -@option{-std=iso9899:1999}), or an option for a later standard -version, is used. +@option{-ansi} or a @option{-std=} option specifying an ISO standard that +doesn't define the keyword. This causes trouble when you want to use +these extensions in a header file that can be included in programs that may +be compiled with with such options. The way to solve these problems is to put @samp{__} at the beginning and end of each problematical keyword. For example, use @code{__asm__} diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4fbb4cda101e..768b98dba74c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2386,39 +2386,6 @@ accepts: In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is equivalent to @option{-std=c++98}. -This turns off certain features of GCC that are incompatible with ISO -C90 (when compiling C code), or of standard C++ (when compiling C++ code), -such as the @code{asm} and @code{typeof} keywords, and -predefined macros such as @code{unix} and @code{vax} that identify the -type of system you are using. It also enables the undesirable and -rarely used ISO trigraph feature. For the C compiler, -it disables recognition of C++ style @samp{//} comments as well as -the @code{inline} keyword. - -The alternate keywords @code{__asm__}, @code{__extension__}, -@code{__inline__} and @code{__typeof__} continue to work despite -@option{-ansi}. You would not want to use them in an ISO C program, of -course, but it is useful to put them in header files that might be included -in compilations done with @option{-ansi}. Alternate predefined macros -such as @code{__unix__} and @code{__vax__} are also available, with or -without @option{-ansi}. - -The @option{-ansi} option does not cause non-ISO programs to be -rejected gratuitously. For that, @option{-Wpedantic} is required in -addition to @option{-ansi}. @xref{Warning Options}. - -The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} -option is used. Some header files may notice this macro and refrain -from declaring certain functions or defining certain macros that the -ISO standard doesn't call for; this is to avoid interfering with any -programs that might use these names for other things. - -Functions that are normally built in but do not have semantics -defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in -functions when @option{-ansi} is used. @xref{Other Builtins,,Other -built-in functions provided by GCC}, for details of the functions -affected. - @opindex std @item -std= Determine the language standard. @xref{Standards,,Language Standards