Skip to content

Commit 8120322

Browse files
author
Sandra Loosemore
committed
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.
1 parent 82294e9 commit 8120322

File tree

2 files changed

+6
-43
lines changed

2 files changed

+6
-43
lines changed

gcc/doc/extend.texi

+6-10
Original file line numberDiff line numberDiff line change
@@ -13049,17 +13049,13 @@ is taken as the minimum size, ignoring how many instructions GCC thinks it is.
1304913049
@cindex keywords, alternate
1305013050

1305113051
@option{-ansi} and the various @option{-std} options disable certain
13052-
keywords. This causes trouble when you want to use GNU C extensions, or
13053-
a general-purpose header file that should be usable by all programs,
13054-
including ISO C programs. The keywords @code{asm}, @code{typeof} and
13052+
keywords that are GNU C extensions.
13053+
Specifically, the keywords @code{asm}, @code{typeof} and
1305513054
@code{inline} are not available in programs compiled with
13056-
@option{-ansi} or @option{-std} (although @code{inline} can be used in a
13057-
program compiled with @option{-std=c99} or a later standard). The
13058-
ISO C99 keyword
13059-
@code{restrict} is only available when @option{-std=gnu99} (which will
13060-
eventually be the default) or @option{-std=c99} (or the equivalent
13061-
@option{-std=iso9899:1999}), or an option for a later standard
13062-
version, is used.
13055+
@option{-ansi} or a @option{-std=} option specifying an ISO standard that
13056+
doesn't define the keyword. This causes trouble when you want to use
13057+
these extensions in a header file that can be included in programs that may
13058+
be compiled with with such options.
1306313059

1306413060
The way to solve these problems is to put @samp{__} at the beginning and
1306513061
end of each problematical keyword. For example, use @code{__asm__}

gcc/doc/invoke.texi

-33
Original file line numberDiff line numberDiff line change
@@ -2386,39 +2386,6 @@ accepts:
23862386
In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
23872387
equivalent to @option{-std=c++98}.
23882388

2389-
This turns off certain features of GCC that are incompatible with ISO
2390-
C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2391-
such as the @code{asm} and @code{typeof} keywords, and
2392-
predefined macros such as @code{unix} and @code{vax} that identify the
2393-
type of system you are using. It also enables the undesirable and
2394-
rarely used ISO trigraph feature. For the C compiler,
2395-
it disables recognition of C++ style @samp{//} comments as well as
2396-
the @code{inline} keyword.
2397-
2398-
The alternate keywords @code{__asm__}, @code{__extension__},
2399-
@code{__inline__} and @code{__typeof__} continue to work despite
2400-
@option{-ansi}. You would not want to use them in an ISO C program, of
2401-
course, but it is useful to put them in header files that might be included
2402-
in compilations done with @option{-ansi}. Alternate predefined macros
2403-
such as @code{__unix__} and @code{__vax__} are also available, with or
2404-
without @option{-ansi}.
2405-
2406-
The @option{-ansi} option does not cause non-ISO programs to be
2407-
rejected gratuitously. For that, @option{-Wpedantic} is required in
2408-
addition to @option{-ansi}. @xref{Warning Options}.
2409-
2410-
The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2411-
option is used. Some header files may notice this macro and refrain
2412-
from declaring certain functions or defining certain macros that the
2413-
ISO standard doesn't call for; this is to avoid interfering with any
2414-
programs that might use these names for other things.
2415-
2416-
Functions that are normally built in but do not have semantics
2417-
defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2418-
functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2419-
built-in functions provided by GCC}, for details of the functions
2420-
affected.
2421-
24222389
@opindex std
24232390
@item -std=
24242391
Determine the language standard. @xref{Standards,,Language Standards

0 commit comments

Comments
 (0)