Extended documentation on ObjC macros and flags
[gcc.git] / gcc / doc / cpp.texi
index a4eaf840bedd2f67d80acd100ae08413f943b7a6..e84cf5f78c2707b41f7468b99c5497f1999ed6a9 100644 (file)
@@ -9,7 +9,7 @@
 @macro copyrightnotice
 @c man begin COPYRIGHT
 Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-1997, 1998, 1999, 2000, 2001
+1997, 1998, 1999, 2000, 2001, 2002
 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -46,6 +46,13 @@ This manual contains no Invariant Sections.  The Front-Cover Texts are
 @code{\body\}
 @end macro
 
+@c Create a separate index for command line options.
+@defcodeindex op
+@syncodeindex vr op
+
+@c Used in cppopts.texi and cppenv.texi.
+@set cppmanual
+
 @ifinfo
 @dircategory Programming
 @direntry
@@ -69,6 +76,7 @@ This manual contains no Invariant Sections.  The Front-Cover Texts are
 @contents
 @page
 
+@ifnottex
 @node Top
 @top
 The C preprocessor implements the macro language used to transform C,
@@ -88,8 +96,10 @@ useful on its own.
 * Traditional Mode::
 * Implementation Details::
 * Invocation::
+* Environment Variables::
 * GNU Free Documentation License::
 * Index of Directives::
+* Option Index::
 * Concept Index::
 
 @detailmenu
@@ -121,6 +131,7 @@ Macros
 * Variadic Macros::
 * Predefined Macros::
 * Undefining and Redefining Macros::
+* Directives Within Macro Arguments::
 * Macro Pitfalls::
 
 Predefined Macros
@@ -165,12 +176,10 @@ Obsolete Features
 
 * Assertions::
 * Obsolete once-only headers::
-* Miscellaneous obsolete features::
 
 @end detailmenu
 @end menu
 
-@ifnottex
 @copyrightnotice{}
 @covertexts{}
 @end ifnottex
@@ -195,7 +204,7 @@ will be removed, and the Makefile will not work.
 
 Having said that, you can often get away with using cpp on things which
 are not C@.  Other Algol-ish programming languages are often safe
-(Pascal, Ada, etc.) So is assembly, with caution.  @option{-traditional}
+(Pascal, Ada, etc.) So is assembly, with caution.  @option{-traditional-cpp}
 mode preserves more white space, and is otherwise more permissive.  Many
 of the problems can be avoided by writing C or C++ style comments
 instead of native language comments, and keeping macros simple.
@@ -215,6 +224,16 @@ of a program which does not expect them.  To get strict ISO Standard C,
 you should use the @option{-std=c89} or @option{-std=c99} options, depending
 on which version of the standard you want.  To get all the mandatory
 diagnostics, you must also use @option{-pedantic}.  @xref{Invocation}.
+
+This manual describes the behavior of the ISO preprocessor.  To
+minimize gratuitous differences, where the ISO preprocessor's
+behavior does not conflict with traditional semantics, the
+traditional preprocessor should behave the same way.  The various
+differences that do exist are detailed in the section @ref{Traditional
+Mode}.
+
+For clarity, unless noted otherwise, references to @samp{CPP} in this
+manual refer to GNU CPP.
 @c man end
 
 @menu
@@ -229,7 +248,7 @@ diagnostics, you must also use @option{-pedantic}.  @xref{Invocation}.
 The preprocessor performs a series of textual transformations on its
 input.  These happen before all other processing.  Conceptually, they
 happen in a rigid order, and the entire file is run through each
-transformation before the next one begins.  GNU CPP actually does them
+transformation before the next one begins.  CPP actually does them
 all at once, for performance reasons.  These transformations correspond
 roughly to the first three ``phases of translation'' described in the C
 standard.
@@ -240,7 +259,7 @@ standard.
 @cindex line endings
 The input file is read into memory and broken into lines.
 
-GNU CPP expects its input to be a text file, that is, an unstructured
+CPP expects its input to be a text file, that is, an unstructured
 stream of ASCII characters, with some characters indicating the end of a
 line of text.  Extended ASCII character sets, such as ISO Latin-1 or
 Unicode encoded in UTF-8, are also acceptable.  Character sets that are
@@ -266,16 +285,17 @@ warning message.
 
 @item
 @cindex trigraphs
-If trigraphs are enabled, they are replaced by their corresponding
-single characters.
+@anchor{trigraphs}If trigraphs are enabled, they are replaced by their
+corresponding single characters.  By default GCC ignores trigraphs,
+but if you request a strictly conforming mode with the @option{-std}
+option, or you specify the @option{-trigraphs} option, then it
+converts them.
 
 These are nine three-character sequences, all starting with @samp{??},
 that are defined by ISO C to stand for single characters.  They permit
 obsolete systems that lack some of C's punctuation to use C@.  For
 example, @samp{??/} stands for @samp{\}, so @t{'??/n'} is a character
-constant for a newline.  By default, GCC ignores trigraphs, but if you
-request a strictly conforming mode with the @option{-std} option, then
-it converts them.
+constant for a newline.
 
 Trigraphs are not popular and many compilers implement them incorrectly.
 Portable code should not rely on trigraphs being either converted or
@@ -393,26 +413,8 @@ extremely confusing and should not be used in code intended to be
 readable.
 
 There is no way to prevent a backslash at the end of a line from being
-interpreted as a backslash-newline.
-
-@example
-"foo\\
-bar"
-@end example
-
-@noindent
-is equivalent to @code{"foo\bar"}, not to @code{"foo\\bar"}.  To avoid
-having to worry about this, do not use the deprecated GNU extension
-which permits multi-line strings.  Instead, use string literal
-concatenation:
-
-@example
-   "foo\\"
-   "bar"
-@end example
-
-@noindent
-Your program will be more portable this way, too.
+interpreted as a backslash-newline.  This cannot affect any correct
+program, however.
 
 @node Tokenization
 @section Tokenization
@@ -527,11 +529,10 @@ closing quote or angle bracket.  The preprocessor looks for the header
 file in different places depending on which form you use.  @xref{Include
 Operation}.
 
-In standard C, no string literal may extend past the end of a line.  GNU
-CPP accepts multi-line string constants, but not multi-line character
-constants or header file names.  This extension is deprecated and will
-be removed in GCC 3.1.  You may use continued lines instead, or string
-constant concatenation.  @xref{Differences from previous versions}.
+No string literal may extend past the end of a line.  Older versions
+of GCC accepted multi-line string constants.  You may use continued
+lines instead, or string constant concatenation.  @xref{Differences
+from previous versions}.
 
 @cindex punctuators
 @cindex digraphs
@@ -787,10 +788,10 @@ those are merely the typical uses.  Any fragment of a C program can be
 included from another file.  The include file could even contain the
 beginning of a statement that is concluded in the containing file, or
 the end of a statement that was started in the including file.  However,
-a comment or a string or character constant may not start in the
-included file and finish in the including file.  An unterminated
-comment, string constant or character constant in an included file is
-considered to end (with an error message) at the end of the file.
+an included file must consist of complete tokens.  Comments and string
+literals which have not been closed by the end of an included file are
+invalid.  For error recovery, they are considered to end at the end of
+the file.
 
 To avoid confusion, it is best if header files contain only complete
 syntactic units---function declarations or definitions, type
@@ -822,11 +823,22 @@ version of GCC in use.
 
 You can add to this list with the @option{-I@var{dir}} command line
 option.  All the directories named by @option{-I} are searched, in
-left-to-right order, @emph{before} the default directories.  You can
-also prevent GCC from searching any of the default directories with the
-@option{-nostdinc} option.  This is useful when you are compiling an
+left-to-right order, @emph{before} the default directories.  The only
+exception is when @file{dir} is already searched by default.  In
+this case, the option is ignored and the search order for system
+directories remains unchanged.
+
+Duplicate directories are removed from the quote and bracket search
+chains before the two chains are merged to make the final search chain.
+Thus, it is possible for a directory to occur twice in the final search
+chain if it was specified in both the quote and bracket chains.
+
+You can prevent GCC from searching any of the default directories with
+the @option{-nostdinc} option.  This is useful when you are compiling an
 operating system kernel or some other program that does not use the
 standard C library facilities, or the standard C library itself.
+@option{-I} options are not ignored as described above when
+@option{-nostdinc} is in effect.
 
 GCC looks for headers requested with @code{@w{#include "@var{file}"}}
 first in the directory containing the current file, then in the same
@@ -835,12 +847,6 @@ For example, if @file{/usr/include/sys/stat.h} contains
 @code{@w{#include "types.h"}}, GCC looks for @file{types.h} first in
 @file{/usr/include/sys}, then in its usual search path.
 
-If you name a search directory with @option{-I@var{dir}} that is also a
-system include directory, the @option{-I} wins; the directory will be
-searched according to the @option{-I} ordering, and it will not be
-treated as a system include directory. GCC will warn you when a system
-include directory is hidden in this way.
-
 @samp{#line} (@pxref{Line Control}) does not change GCC's idea of the
 directory containing the current file.
 
@@ -896,7 +902,7 @@ because @code{FILE_FOO_SEEN} is defined.  The preprocessor will skip
 over the entire contents of the file, and the compiler will not see it
 twice.
 
-GNU CPP optimizes even further.  It remembers when a header file has a
+CPP optimizes even further.  It remembers when a header file has a
 wrapper @samp{#ifndef}.  If a subsequent @samp{#include} specifies that
 header, and the macro in the @samp{#ifndef} is still defined, it does
 not bother to rescan the file at all.
@@ -1073,8 +1079,8 @@ found in that directory will be considered system headers.
 All directories named by @option{-isystem} are searched @emph{after} all
 directories named by @option{-I}, no matter what their order was on the
 command line.  If the same directory is named by both @option{-I} and
-@option{-isystem}, @option{-I} wins; it is as if the @option{-isystem} option
-had never been specified at all. GCC warns you when this happens.
+@option{-isystem}, the @option{-I} option is ignored.  GCC provides an
+informative message when this occurs if @option{-v} is used.
 
 @findex #pragma GCC system_header
 There is also a directive, @code{@w{#pragma GCC system_header}}, which
@@ -1115,6 +1121,7 @@ macros when you are compiling C++.
 * Variadic Macros::
 * Predefined Macros::
 * Undefining and Redefining Macros::
+* Directives Within Macro Arguments::
 * Macro Pitfalls::
 @end menu
 
@@ -1608,7 +1615,7 @@ or to paste its leading or trailing token with another token.  (But see
 below for an important special case for @samp{##}.)
 
 If your macro is complicated, you may want a more descriptive name for
-the variable argument than @code{@w{__VA_ARGS__}}.  GNU CPP permits
+the variable argument than @code{@w{__VA_ARGS__}}.  CPP permits
 this, as an extension.  You may write an argument name immediately
 before the @samp{@dots{}}; that name is used for the variable argument.
 The @code{eprintf} macro above could be written
@@ -1618,7 +1625,7 @@ The @code{eprintf} macro above could be written
 @end example
 
 @noindent
-using this extension.  You cannot use @code{__VA_ARGS__} and this
+using this extension.  You cannot use @code{@w{__VA_ARGS__}} and this
 extension in the same macro.
 
 You can have named arguments as well as variable arguments in a variadic
@@ -1668,6 +1675,15 @@ eprintf ("success!\n")
      @expansion{} fprintf(stderr, "success!\n");
 @end example
 
+@noindent
+The above explanation is ambiguous about the case where the only macro
+parameter is a variable arguments parameter, as it is meaningless to
+try to distinguish whether no argument at all is an empty argument or
+a missing argument.  In this case the C99 standard is clear that the
+comma must remain, however the existing GCC extension used to swallow
+the comma.  So CPP retains the comma when conforming to a specific C
+standard, and drops it otherwise.
+
 C99 mandates that the only place the identifier @code{@w{__VA_ARGS__}}
 can appear is in the replacement list of a variadic macro.  It may not
 be used as a macro name, macro argument name, or within a different type
@@ -1683,7 +1699,7 @@ only named variable arguments.  On the other hand, if you are concerned
 with portability to other conforming implementations of C99, you should
 use only @code{@w{__VA_ARGS__}}.
 
-Previous versions of GNU CPP implemented the comma-deletion extension
+Previous versions of CPP implemented the comma-deletion extension
 much more generally.  We have restricted it in this release to minimize
 the differences from C99.  To get the same effect with both this and
 previous versions of GCC, the token preceding the special @samp{##} must
@@ -1778,29 +1794,35 @@ the preprocessor is being run.  The string constant contains eleven
 characters and looks like @code{@w{"Feb 12 1996"}}.  If the day of the
 month is less than 10, it is padded with a space on the left.
 
+If GCC cannot determine the current date, it will emit a warning message
+(once per compilation) and @code{__DATE__} will expand to
+@code{@w{"??? ?? ????"}}.
+
 @item __TIME__
 This macro expands to a string constant that describes the time at
 which the preprocessor is being run.  The string constant contains
 eight characters and looks like @code{"23:59:01"}.
 
+If GCC cannot determine the current time, it will emit a warning message
+(once per compilation) and @code{__TIME__} will expand to
+@code{"??:??:??"}.
+
 @item __STDC__
 In normal operation, this macro expands to the constant 1, to signify
 that this compiler conforms to ISO Standard C@.  If GNU CPP is used with
 a compiler other than GCC, this is not necessarily true; however, the
-preprocessor always conforms to the standard, unless the
-@option{-traditional} option is used.
+preprocessor always conforms to the standard unless the
+@option{-traditional-cpp} option is used.
 
-This macro is not defined if the @option{-traditional} option is used.
+This macro is not defined if the @option{-traditional-cpp} option is used.
 
 On some hosts, the system compiler uses a different convention, where
 @code{__STDC__} is normally 0, but is 1 if the user specifies strict
-conformance to the C Standard.  GNU CPP follows the host convention when
+conformance to the C Standard.  CPP follows the host convention when
 processing system header files, but when processing user files
 @code{__STDC__} is always 1.  This has been reported to cause problems;
 for instance, some versions of Solaris provide X Windows headers that
-expect @code{__STDC__} to be either undefined or 1.  You may be able to
-work around this sort of problem by using an @option{-I} option to
-cancel treatment of those headers as system headers.  @xref{Invocation}.
+expect @code{__STDC__} to be either undefined or 1.  @xref{Invocation}.
 
 @item __STDC_VERSION__
 This macro expands to the C Standard's version number, a long integer
@@ -1815,8 +1837,8 @@ The value @code{199409L} signifies the 1989 C standard as amended in
 the 1999 revision of the C standard.  Support for the 1999 revision is
 not yet complete.
 
-This macro is not defined if the @option{-traditional} option is used, nor
-when compiling C++ or Objective-C@.
+This macro is not defined if the @option{-traditional-cpp} option is
+used, nor when compiling C++ or Objective-C@.
 
 @item __STDC_HOSTED__
 This macro is defined, with value 1, if the compiler's target is a
@@ -1893,6 +1915,11 @@ calculate a single number, then compare that against a threshold:
 @noindent
 Many people find this form easier to understand.
 
+@item __OBJC__
+This macro is defined, with value 1, when the Objective-C compiler is in
+use.  You can use @code{__OBJC__} to test whether a header is compiled
+by a C compiler or a Objective-C compiler.
+
 @item __GNUG__
 The GNU C++ compiler defines this.  Testing it is equivalent to
 testing @code{@w{(__GNUC__ && __cplusplus)}}.
@@ -1945,6 +1972,10 @@ unsigned on the target machine.  It exists to cause the standard header
 file @file{limits.h} to work correctly.  You should not use this macro
 yourself; instead, refer to the standard macros defined in @file{limits.h}.
 
+@item __WCHAR_UNSIGNED__
+Like @code{__CHAR_UNSIGNED__}, this macro is defined if and only if the
+data type @code{wchar_t} is unsigned and the front-end is in C++ mode.
+
 @item __REGISTER_PREFIX__
 This macro expands to a single token (not a string constant) which is
 the prefix applied to CPU register names in assembly language for this
@@ -1975,6 +2006,74 @@ typedefs, respectively.  They exist to make the standard header files
 these macros directly; instead, include the appropriate headers and use
 the typedefs.
 
+@item __CHAR_BIT__
+@itemx __WCHAR_BIT__
+@itemx __SHRT_BIT__
+@itemx __INT_BIT__
+@itemx __LONG_BIT__
+@itemx __LONG_LONG_BIT__
+@itemx __FLOAT_BIT__
+@itemx __DOUBLE_BIT__
+@itemx __LONG_DOUBLE_BIT__
+These macros are defined to the number of bits used in the
+representation of the data types @code{char}, @code{wchar_t},
+@code{short}, @code{int}, @code{long}, @code{long long}, @code{float},
+@code{double} and @code{long double}.  They exist to make the standard
+header given numerical limits work correctly.  You should not use
+these macros directly; instead, include the appropriate headers.
+
+@item __USING_SJLJ_EXCEPTIONS__
+This macro is defined, with value 1, if the compiler uses the old
+mechanism based on @code{setjmp} and @code{longjmp} for exception
+handling.
+
+@item __NEXT_RUNTIME__
+This macro is defined, with value 1, if (and only if) the NeXT runtime
+(as in @option{-fnext-runtime}) is in use for Objective-C.  If the GNU
+runtime is used, this macro is not defined, so that you can use this
+macro to determine which runtime (NeXT or GNU) is being used.
+
+@item __TARGET_BITS_ORDER__
+This macro describes the target's bits order in a byte.  Its value is
+@code{__GCC_LITTLE_ENDIAN__} or @code{__GCC_BIG_ENDIAN__}.
+
+@item __TARGET_BYTES_ORDER__
+This macro is defined with value @code{__GCC_LITTLE_ENDIAN__} or
+@code{__GCC_BIG_ENDIAN__} if the target's bytes order within a word
+is little-endian or big-endian, respectively.
+
+@item __TARGET_INT_WORDS_ORDER__
+This macro is defined with value @code{__GCC_LITTLE_ENDIAN__} or
+@code{__GCC_BIG_ENDIAN__} if the target's words order within a
+multi-word integer datum is little-endian or big-endian, respectively.
+
+@item __TARGET_FLOAT_WORDS_ORDER__
+This macro is defined with value @code{__GCC_LITTLE_ENDIAN__} or
+@code{__GCC_BIG_ENDIAN__} if the target's words order within a
+multi-word floating-point datum is little-endian or big-endian, respectively.
+
+@item __TARGET_FLOAT_FORMAT__
+This macro is defined to describe the floating-point format used by the
+target.  It has value in the set comprised of:
+@code{__UNKNOWN_FORMAT__}, @code{__IEEE_FORMAT__},
+@code{__IBM_FORMAT__}, @code{__C4X_FORMAT__} and @code{__VAX_FORMAT__}.
+
+@item __TARGET_USES_VAX_F_FLOAT__
+This macro is defined with value 1 if the target uses the VAX F-format
+for the single precision floating-point data type; else if has value 0.
+
+@item __TARGET_USES_VAX_D_FLOAT__
+@item __TARGET_USES_VAX_G_FLOAT__
+These macros are always defined, with values 0 or 1.  If
+@code{__TARGET_FLOAT_FORMAT__} is @code{__VAX_FORMAT__} then they have
+mutually exclusive values; else both have value 0.  Non-zero
+@code{__TARGET_USES_VAX_D_FLOAT__} means the target uses the VAX
+D-format for the double precision floating-point data type; non-zero
+@code{__TARGET_USES_VAX_G_FLOAT__} means the VAX G-format is used.
+
+@item __TARGET_USES_VAX_H_FLOAT__
+When non-zero, the target uses the VAX H-format for the extended
+precision floating-point data type.
 @end table
 
 @node System-specific Predefined Macros
@@ -2107,6 +2206,50 @@ the same, the redefinition is silently ignored.  This allows, for
 instance, two different headers to define a common macro.  The
 preprocessor will only complain if the definitions do not match.
 
+@node Directives Within Macro Arguments
+@section Directives Within Macro Arguments
+@cindex macro arguments and directives
+
+Occasionally it is convenient to use preprocessor directives within
+the arguments of a macro.  The C and C++ standards declare that
+behavior in these cases is undefined.
+
+Versions of CPP prior to 3.2 would reject such constructs with an
+error message.  This was the only syntactic difference between normal
+functions and function-like macros, so it seemed attractive to remove
+this limitation, and people would often be surprised that they could
+not use macros in this way.  Moreover, sometimes people would use
+conditional compilation in the argument list to a normal library
+function like @samp{printf}, only to find that after a library upgrade
+@samp{printf} had changed to be a function-like macro, and their code
+would no longer compile.  So from version 3.2 we changed CPP to
+successfully process arbitrary directives within macro arguments in
+exactly the same way as it would have processed the directive were the
+function-like macro invocation not present.
+
+If, within a macro invocation, that macro is redefined, then the new
+definition takes effect in time for argument pre-expansion, but the
+original definition is still used for argument replacement.  Here is a
+pathological example:
+
+@smallexample
+#define f(x) x x
+f (1
+#undef f
+#define f 2
+f)
+@end smallexample
+
+@noindent
+which expands to
+
+@smallexample
+1 2 1 2
+@end smallexample
+
+@noindent
+with the semantics described above.
+
 @node Macro Pitfalls
 @section Macro Pitfalls
 @cindex problems with macros
@@ -2694,7 +2837,7 @@ good practice if there is a lot of @var{controlled text}, because it
 helps people match the @samp{#endif} to the corresponding @samp{#ifdef}.
 Older programs sometimes put @var{MACRO} directly after the
 @samp{#endif} without enclosing it in a comment.  This is invalid code
-according to the C standard.  GNU CPP accepts it with a warning.  It
+according to the C standard.  CPP accepts it with a warning.  It
 never affects which @samp{#ifndef} the @samp{#endif} matches.
 
 @findex #ifndef
@@ -3026,6 +3169,13 @@ input.  Subsequent lines are counted from @var{linenum}.
 effect.  In addition, @var{filename} is a string constant.  The
 following line and all subsequent lines are reported to come from the
 file it specifies, until something else happens to change that.
+@var{filename} is interpreted according to the normal rules for a string
+constant: backslash escapes are interpreted.  This is different from
+@samp{#include}.
+
+Previous versions of CPP did not interpret escapes in @samp{#line};
+we have changed it because the standard requires they be interpreted,
+and most other compilers do.
 
 @item #line @var{anything else}
 @var{anything else} is checked for macro calls, which are expanded.
@@ -3035,7 +3185,35 @@ The result should match one of the above two forms.
 @samp{#line} directives alter the results of the @code{__FILE__} and
 @code{__LINE__} predefined macros from that point on.  @xref{Standard
 Predefined Macros}.  They do not have any effect on @samp{#include}'s
-idea of the directory containing the current file.
+idea of the directory containing the current file.  This is a change
+from GCC 2.95.  Previously, a file reading
+
+@smallexample
+#line 1 "../src/gram.y"
+#include "gram.h"
+@end smallexample
+
+would search for @file{gram.h} in @file{../src}, then the @option{-I}
+chain; the directory containing the physical source file would not be
+searched.  In GCC 3.0 and later, the @samp{#include} is not affected by
+the presence of a @samp{#line} referring to a different directory.
+
+We made this change because the old behavior caused problems when
+generated source files were transported between machines.  For instance,
+it is common practice to ship generated parsers with a source release,
+so that people building the distribution do not need to have yacc or
+Bison installed.  These files frequently have @samp{#line} directives
+referring to the directory tree of the system where the distribution was
+created.  If GCC tries to search for headers in those directories, the
+build is likely to fail.
+
+The new behavior can cause failures too, if the generated file is not
+in the same directory as its source and it attempts to include a header
+which would be visible searching from the directory containing the
+source file.  However, this problem is easily solved with an additional
+@option{-I} switch on the command line.  The failures caused by the old
+semantics could sometimes be corrected only by editing the generated
+files, which is difficult and error-prone.
 
 @node Pragmas
 @chapter Pragmas
@@ -3162,8 +3340,8 @@ This directive is not part of the C standard, but it is not an official
 GNU extension either.  We believe it came from System V@.
 
 @findex #sccs
-The @samp{#sccs} directive is recognized on some systems, because it
-appears in their header files.  It is a very old, obscure, extension
+The @samp{#sccs} directive is recognized, because it appears in the
+header files of some systems.  It is a very old, obscure, extension
 which we did not invent, and we have been unable to find any
 documentation of what it should do, so GCC simply ignores it.
 
@@ -3215,7 +3393,8 @@ of the form
 These are called @dfn{linemarkers}.  They are inserted as needed into
 the output (but never within a string or character constant).  They mean
 that the following line originated in file @var{filename} at line
-@var{linenum}.
+@var{linenum}.  @var{filename} will never contain any non-printing
+characters; they are replaced with octal escape sequences.
 
 After the file name comes zero or more flags, which are @samp{1},
 @samp{2}, @samp{3}, or @samp{4}.  If there are multiple flags, spaces
@@ -3256,91 +3435,230 @@ the directive name.
 
 Traditional (pre-standard) C preprocessing is rather different from
 the preprocessing specified by the standard.  When GCC is given the
-@option{-traditional} option, it attempts to emulate a traditional
-preprocessor.  We do not guarantee that GCC's behavior under
-@option{-traditional} matches any pre-standard preprocessor exactly.
+@option{-traditional-cpp} option, it attempts to emulate a traditional
+preprocessor.
 
-Traditional mode exists only for backward compatibility.  We have no
-plans to augment it in any way nor will we change it except to fix
-catastrophic bugs.  You should be aware that modern C libraries often
-have header files which are incompatible with traditional mode.
+GCC versions 3.2 and later only support traditional mode semantics in
+the preprocessor, and not in the compiler front ends.  This chapter
+outlines the traditional preprocessor semantics we implemented.
 
-This is a list of the differences.  It may not be complete, and may not
-correspond exactly to the behavior of either GCC or a true traditional
-preprocessor.
+The implementation does not correspond precisely to the behavior of
+earlier versions of GCC, nor to any true traditional preprocessor.
+After all, inconsistencies among traditional implementations were a
+major motivation for C standardization.  However, we intend that it
+should be compatible with true traditional preprocessors in all ways
+that actually matter.
 
-@itemize @bullet
-@item
-Traditional macro expansion pays no attention to single-quote or
-double-quote characters; macro argument symbols are replaced by the
-argument values even when they appear within apparent string or
-character constants.
+@menu
+* Traditional lexical analysis::
+* Traditional macros::
+* Traditional miscellany::
+* Traditional warnings::
+@end menu
 
-@item
-Traditionally, it is permissible for a macro expansion to end in the
-middle of a string or character constant.  The constant continues into
-the text surrounding the macro call.
+@node Traditional lexical analysis
+@section Traditional lexical analysis
 
-@item
-However, the end of the line terminates a string or character constant,
-with no error.  (This is a kluge.  Traditional mode is commonly used to
-preprocess things which are not C, and have a different comment syntax.
-Single apostrophes often appear in comments.  This kluge prevents the
-traditional preprocessor from issuing errors on such comments.)
+The traditional preprocessor does not decompose its input into tokens
+the same way a standards-conforming preprocessor does.  The input is
+simply treated as a stream of text with minimal internal form.
 
-@item
-Preprocessing directives are recognized in traditional C only when their
-leading @samp{#} appears in the first column.  There can be no
-whitespace between the beginning of the line and the @samp{#}.
+This implementation does not treat trigraphs (@pxref{trigraphs})
+specially since they were an invention of the standards committee.  It
+handles arbitrarily-positioned escaped newlines properly and splices
+the lines as you would expect; many traditional preprocessors did not
+do this.
 
-@item
-In traditional C, a comment is equivalent to no text at all.  (In ISO
-C, a comment counts as whitespace.)  It can be used sort of the same way
-that @samp{##} is used in ISO C, to paste macro arguments together.
+The form of horizontal whitespace in the input file is preserved in
+the output.  In particular, hard tabs remain hard tabs.  This can be
+useful if, for example, you are preprocessing a Makefile.
 
-@item
-Traditional C does not have the concept of a preprocessing number.
+Traditional CPP only recognizes C-style block comments, and treats the
+@samp{/*} sequence as introducing a comment only if it lies outside
+quoted text.  Quoted text is introduced by the usual single and double
+quotes, and also by an initial @samp{<} in a @code{#include}
+directive.
 
-@item
-A macro is not suppressed within its own definition, in traditional C@.
-Thus, any macro that is used recursively inevitably causes an error.
+Traditionally, comments are completely removed and are not replaced
+with a space.  Since a traditional compiler does its own tokenization
+of the output of the preprocessor, this means that comments can
+effectively be used as token paste operators.  However, comments
+behave like separators for text handled by the preprocessor itself,
+since it doesn't re-lex its input.  For example, in
 
-@item
-The @samp{#} and @samp{##} operators are not available in traditional
-C@.
+@smallexample
+#if foo/**/bar
+@end smallexample
+
+@noindent
+@samp{foo} and @samp{bar} are distinct identifiers and expanded
+separately if they happen to be macros.  In other words, this
+directive is equivalent to
+
+@smallexample
+#if foo bar
+@end smallexample
 
+@noindent
+rather than
+
+@smallexample
+#if foobar
+@end smallexample
+
+Generally speaking, in traditional mode an opening quote need not have
+a matching closing quote.  In particular, a macro may be defined with
+replacement text that contains an unmatched quote.  Of course, if you
+attempt to compile preprocessed output containing an unmatched quote
+you will get a syntax error.
+
+However, all preprocessing directives other than @code{#define}
+require matching quotes.  For example:
+
+@smallexample
+#define m This macro's fine and has an unmatched quote
+"/* This is not a comment.  */
+/* This is a comment.  The following #include directive
+   is ill-formed.  */
+#include <stdio.h
+@end smallexample
+
+Just as for the ISO preprocessor, what would be a closing quote can be
+escaped with a backslash to prevent the quoted text from closing.
+
+@node Traditional macros
+@section Traditional macros
+
+The major difference between traditional and ISO macros is that the
+former expand to text rather than to a token sequence.  CPP removes
+all leading and trailing horizontal whitespace from a macro's
+replacement text before storing it, but preserves the form of internal
+whitespace.
+
+One consequence is that it is legitimate for the replacement text to
+contain an unmatched quote (@pxref{Traditional lexical analysis}). An
+unclosed string or character constant continues into the text
+following the macro call.  Similarly, the text at the end of a macro's
+expansion can run together with the text after the macro invocation to
+produce a single token.
+
+Normally comments are removed from the replacement text after the
+macro is expanded, but if the @option{-CC} option is passed on the
+command line comments are preserved.  (In fact, the current
+implementation removes comments even before saving the macro
+replacement text, but it careful to do it in such a way that the
+observed effect is identical even in the function-like macro case.)
+
+The ISO stringification operator @samp{#} and token paste operator
+@samp{##} have no special meaning.  As explained later, an effect
+similar to these operators can be obtained in a different way.  Macro
+names that are embedded in quotes, either from the main file or after
+macro replacement, do not expand.
+
+CPP replaces an unquoted object-like macro name with its replacement
+text, and then rescans it for further macros to replace.  Unlike
+standard macro expansion, traditional macro expansion has no provision
+to prevent recursion.  If an object-like macro appears unquoted in its
+replacement text, it will be replaced again during the rescan pass,
+and so on @emph{ad infinitum}.  GCC detects when it is expanding
+recursive macros, emits an error message, and continues after the
+offending macro invocation.
+
+@smallexample
+#define PLUS +
+#define INC(x) PLUS+x
+INC(foo);
+     @expansion{} ++foo;
+@end smallexample
+
+Function-like macros are similar in form but quite different in
+behavior to their ISO counterparts.  Their arguments are contained
+within parentheses, are comma-separated, and can cross physical lines.
+Commas within nested parentheses are not treated as argument
+separators.  Similarly, a quote in an argument cannot be left
+unclosed; a following comma or parenthesis that comes before the
+closing quote is treated like any other character.  There is no
+facility for handling variadic macros.
+
+This implementation removes all comments from macro arguments, unless
+the @option{-C} option is given.  The form of all other horizontal
+whitespace in arguments is preserved, including leading and trailing
+whitespace.  In particular
+
+@smallexample
+f( )
+@end smallexample
+
+@noindent
+is treated as an invocation of the macro @samp{f} with a single
+argument consisting of a single space.  If you want to invoke a
+function-like macro that takes no arguments, you must not leave any
+whitespace between the parentheses.
+
+If a macro argument crosses a new line, the new line is replaced with
+a space when forming the argument.  If the previous line contained an
+unterminated quote, the following line inherits the quoted state.
+
+Traditional preprocessors replace parameters in the replacement text
+with their arguments regardless of whether the parameters are within
+quotes or not.  This provides a way to stringize arguments.  For
+example
+
+@smallexample
+#define str(x) "x"
+str(/* A comment */some text )
+     @expansion{} "some text "
+@end smallexample
+
+@noindent
+Note that the comment is removed, but that the trailing space is
+preserved.  Here is an example of using a comment to effect token
+pasting.
+
+@smallexample
+#define suffix(x) foo_/**/x
+suffix(bar)
+     @expansion{} foo_bar
+@end smallexample
+
+@node Traditional miscellany
+@section Traditional miscellany
+
+Here are some things to be aware of when using the traditional
+preprocessor.
+
+@itemize @bullet
 @item
-In traditional C, the text at the end of a macro expansion can run
-together with the text after the macro call, to produce a single token.
-This is impossible in ISO C@.
+Preprocessing directives are recognized only when their leading
+@samp{#} appears in the first column.  There can be no whitespace
+between the beginning of the line and the @samp{#}, but whitespace can
+follow the @samp{#}.
 
 @item
-None of the GNU extensions to the preprocessor are available in
-traditional mode, with the exception of a partial implementation of
-assertions, and those may be removed in the future.
+A true traditional C preprocessor does not recognize @samp{#error} or
+@samp{#pragma}, and may not recognize @samp{#elif}.  CPP supports all
+the directives in traditional mode that it supports in ISO mode,
+including extensions, with the exception that the effects of
+@samp{#pragma GCC poison} are undefined.
 
 @item
-A true traditional C preprocessor does not recognize @samp{#elif},
-@samp{#error}, or @samp{#pragma}.  GCC supports @samp{#elif} and
-@samp{#error} even in traditional mode, but not @samp{#pragma}.
+__STDC__ is not defined.
 
 @item
-Traditional mode is text-based, not token-based, and comments are
-stripped after macro expansion.  Therefore, @samp{/**/} can be used to
-paste tokens together provided that there is no whitespace between it
-and the tokens to be pasted.
+If you use digraphs the behaviour is undefined.
 
 @item
-Traditional mode preserves the amount and form of whitespace provided by
-the user.  Hard tabs remain hard tabs.  This can be useful, e.g.@: if you
-are preprocessing a Makefile (which we do not encourage).
+If a line that looks like a directive appears within macro arguments,
+the behaviour is undefined.
+
 @end itemize
 
+@node Traditional warnings
+@section Traditional warnings
 You can request warnings about features that did not exist, or worked
 differently, in traditional C with the @option{-Wtraditional} option.
-This works only if you do @emph{not} specify @option{-traditional}.  GCC
-does not warn about features of ISO C which you must use when you are
-using a conforming compiler, such as the @samp{#} and @samp{##}
+GCC does not warn about features of ISO C which you must use when you
+are using a conforming compiler, such as the @samp{#} and @samp{##}
 operators.
 
 Presently @option{-Wtraditional} warns about:
@@ -3363,9 +3681,9 @@ traditional implementations would not recognize @samp{#elif}, so it
 suggests avoiding it altogether.
 
 @item
-A function-like macro that appears without an argument list.  In
-traditional C this was an error.  In ISO C it merely means that the
-macro is not expanded.
+A function-like macro that appears without an argument list.  In some
+traditional preprocessors this was an error.  In ISO C it merely means
+that the macro is not expanded.
 
 @item
 The unary plus operator.  This did not exist in traditional C@.
@@ -3393,7 +3711,7 @@ reliance on behavior described here, as it is possible that it will
 change subtly in future implementations.
 
 Also documented here are obsolete features and changes from previous
-versions of GNU CPP@.
+versions of CPP@.
 
 @menu
 * Implementation-defined behavior::
@@ -3406,7 +3724,7 @@ versions of GNU CPP@.
 @section Implementation-defined behavior
 @cindex implementation-defined behavior
 
-This is how GNU CPP behaves in all the cases which the C standard
+This is how CPP behaves in all the cases which the C standard
 describes as @dfn{implementation-defined}.  This term means that the
 implementation is free to do what it likes, but must document its choice
 and stick to it.
@@ -3429,17 +3747,25 @@ same column as it did in the original source file.
 
 @item The numeric value of character constants in preprocessor expressions.
 
-The preprocessor and compiler interpret character constants in the same
-way; escape sequences such as @samp{\a} are given the values they would
-have on the target machine.
-
-Multi-character character constants are interpreted a character at a
-time, shifting the previous result left by the number of bits per
-character on the host, and adding the new character.  For example, 'ab'
-on an 8-bit host would be interpreted as @w{'a' * 256 + 'b'}.  If there
-are more characters in the constant than can fit in the widest native
-integer type on the host, usually a @code{long}, the excess characters
-are ignored and a diagnostic is given.
+The preprocessor and compiler interpret character constants in the
+same way; i.e.@: escape sequences such as @samp{\a} are given the
+values they would have on the target machine.
+
+The compiler values a multi-character character constant a character
+at a time, shifting the previous value left by the number of bits per
+target character, and then or-ing in the bit-pattern of the new
+character truncated to the width of a target character.  The final
+bit-pattern is given type @code{int}, and is therefore signed,
+regardless of whether single characters are signed or not (a slight
+change from versions 3.1 and earlier of GCC).  If there are more
+characters in the constant than would fit in the target @code{int} the
+compiler issues a warning, and the excess leading characters are
+ignored.
+
+For example, 'ab' for a target with an 8-bit @code{char} would be
+interpreted as @w{(int) ((unsigned char) 'a' * 256 + (unsigned char)
+'b')}, and '\234a' as @w{(int) ((unsigned char) '\234' * 256 + (unsigned
+char) 'a')}.
 
 @item Source file inclusion.
 
@@ -3466,7 +3792,7 @@ pragmas.
 @section Implementation limits
 @cindex implementation limits
 
-GNU CPP has a small number of internal limits.  This section lists the
+CPP has a small number of internal limits.  This section lists the
 limits which the C standard requires to be no lower than some minimum,
 and all the others we are aware of.  We intend there to be as few limits
 as possible.  If you encounter an undocumented or inconvenient limit,
@@ -3489,7 +3815,7 @@ The standard requires at least 15 levels.
 
 @item Nesting levels of conditional inclusion.
 
-The C standard mandates this be at least 63.  GNU CPP is limited only by
+The C standard mandates this be at least 63.  CPP is limited only by
 available memory.
 
 @item Levels of parenthesised expressions within a full expression.
@@ -3504,7 +3830,7 @@ requires only that the first 63 be significant.
 
 @item Number of macros simultaneously defined in a single translation unit.
 
-The standard requires at least 4095 be possible.  GNU CPP is limited only
+The standard requires at least 4095 be possible.  CPP is limited only
 by available memory.
 
 @item Number of parameters in a macro definition and arguments in a macro call.
@@ -3514,7 +3840,7 @@ required by the standard is 127.
 
 @item Number of characters on a logical source line.
 
-The C standard requires a minimum of 4096 be permitted.  GNU CPP places
+The C standard requires a minimum of 4096 be permitted.  CPP places
 no limits on this, but you may get incorrect column numbers reported in
 diagnostics for lines longer than 65,535 characters.
 
@@ -3531,14 +3857,13 @@ may not be a limitation.
 @node Obsolete Features
 @section Obsolete Features
 
-GNU CPP has a number of features which are present mainly for
+CPP has a number of features which are present mainly for
 compatibility with older programs.  We discourage their use in new code.
 In some cases, we plan to remove the feature in a future version of GCC@.
 
 @menu
 * Assertions::
 * Obsolete once-only headers::
-* Miscellaneous obsolete features::
 @end menu
 
 @node Assertions
@@ -3628,7 +3953,7 @@ You can also make or cancel assertions using command line options.
 @node Obsolete once-only headers
 @subsection Obsolete once-only headers
 
-GNU CPP supports two more ways of indicating that a header file should be
+CPP supports two more ways of indicating that a header file should be
 read only once.  Neither one is as portable as a wrapper @samp{#ifndef},
 and we recommend you do not use them in new programs.
 
@@ -3661,49 +3986,12 @@ matter what.
 but it is not recognized by all preprocessors, so you cannot rely on it
 in a portable program.
 
-@node Miscellaneous obsolete features
-@subsection Miscellaneous obsolete features
-
-Here are a few more obsolete features.
-
-@itemize @bullet
-@cindex invalid token paste
-@item Attempting to paste two tokens which together do not form a valid
-preprocessing token.
-
-The preprocessor currently warns about this and outputs the two tokens
-adjacently, which is probably the behavior the programmer intends.  It
-may not work in future, though.
-
-Most of the time, when you get this warning, you will find that @samp{##}
-is being used superstitiously, to guard against whitespace appearing
-between two tokens.  It is almost always safe to delete the @samp{##}.
-
-@cindex pragma poison
-@item @code{#pragma poison}
-
-This is the same as @code{#pragma GCC poison}.  The version without the
-@code{GCC} prefix is deprecated.  @xref{Pragmas}.
-
-@cindex multi-line string constants
-@item Multi-line string constants
-
-GCC currently allows a string constant to extend across multiple logical
-lines of the source file.  This extension is deprecated and will be
-removed in a future version of GCC@.  Such string constants are already
-rejected in all directives apart from @samp{#define}.
-
-Instead, make use of ISO C concatenation of adjacent string literals, or
-use @samp{\n} followed by a backslash-newline.
-
-@end itemize
-
 @node Differences from previous versions
 @section Differences from previous versions
 @cindex differences from previous versions
 
 This section details behavior which has changed from previous versions
-of GNU CPP@.  We do not plan to change it again in the near future, but
+of CPP@.  We do not plan to change it again in the near future, but
 we do not promise not to, either.
 
 The ``previous versions'' discussed here are 2.95 and before.  The
@@ -3752,7 +4040,7 @@ versions accepted it silently.
 
 Formerly, in a macro expansion, if @samp{##} appeared before a variable
 arguments parameter, and the set of tokens specified for that argument
-in the macro invocation was empty, previous versions of GNU CPP would
+in the macro invocation was empty, previous versions of CPP would
 back up and remove the preceding sequence of non-whitespace characters
 (@strong{not} the preceding token).  This extension is in direct
 conflict with the 1999 C standard and has been drastically pared back.
@@ -3763,14 +4051,24 @@ omitted entirely, the comma will be removed from the expansion.  If the
 variable argument is empty, or the token before @samp{##} is not a
 comma, then @samp{##} behaves as a normal token paste.
 
-@item Traditional mode and GNU extensions
+@item @samp{#line} and @samp{#include}
+
+The @samp{#line} directive used to change GCC's notion of the
+``directory containing the current file,'' used by @samp{#include} with
+a double-quoted header file name.  In 3.0 and later, it does not.
+@xref{Line Control}, for further explanation.
+
+@item Syntax of @samp{#line}
+
+In GCC 2.95 and previous, the string constant argument to @samp{#line}
+was treated the same way as the argument to @samp{#include}: backslash
+escapes were not honored, and the string ended at the second @samp{"}.
+This is not compliant with the C standard.  In GCC 3.0, an attempt was
+made to correct the behavior, so that the string was treated as a real
+string constant, but it turned out to be buggy.  In 3.1, the bugs have
+been fixed.  (We are not fixing the bugs in 3.0 because they affect
+relatively few people and the fix is quite invasive.)
 
-Traditional mode used to be implemented in the same program as normal
-preprocessing.  Therefore, all the GNU extensions to the preprocessor
-were still available in traditional mode.  It is now a separate program
-and does not implement any of the GNU extensions, except for a partial
-implementation of assertions.  Even those may be removed in a future
-release.
 @end itemize
 
 @node Invocation
@@ -3833,452 +4131,28 @@ options may @emph{not} be grouped: @option{-dM} is very different from
 @w{@samp{-d -M}}.
 
 @cindex options
-@table @gcctabopt
-@item -D @var{name}
-Predefine @var{name} as a macro, with definition @code{1}.
-
-@item -D @var{name}=@var{definition}
-Predefine @var{name} as a macro, with definition @var{definition}.
-There are no restrictions on the contents of @var{definition}, but if
-you are invoking the preprocessor from a shell or shell-like program you
-may need to use the shell's quoting syntax to protect characters such as
-spaces that have a meaning in the shell syntax.  If you use more than
-one @option{-D} for the same @var{name}, the rightmost definition takes
-effect.
-
-If you wish to define a function-like macro on the command line, write
-its argument list with surrounding parentheses before the equals sign
-(if any).  Parentheses are meaningful to most shells, so you will need
-to quote the option.  With @command{sh} and @command{csh},
-@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
-
-@item -U @var{name}
-Cancel any previous definition of @var{name}, either built in or
-provided with a @option{-D} option.
-
-All @option{-imacros @var{file}} and @option{-include @var{file}} options
-are processed after all @option{-D} and @option{-U} options.
-
-@item -undef
-Do not predefine any system-specific macros.  The common predefined
-macros remain defined.
-
-@item -I @var{dir}
-Add the directory @var{dir} to the list of directories to be searched
-for header files.  @xref{Search Path}.  Directories named by @option{-I}
-are searched before the standard system include directories.
-
-It is dangerous to specify a standard system include directory in an
-@option{-I} option.  This defeats the special treatment of system
-headers (@pxref{System Headers}).  It can also defeat the repairs to
-buggy system headers which GCC makes when it is installed.
-
-@item -o @var{file}
-Write output to @var{file}.  This is the same as specifying @var{file}
-as the second non-option argument to @command{cpp}.  @command{gcc} has a
-different interpretation of a second non-option argument, so you must
-use @option{-o} to specify the output file.
-
-@item -Wall
-Turns on all optional warnings which are desirable for normal code.  At
-present this is @option{-Wcomment} and @option{-Wtrigraphs}.  Note that
-many of the preprocessor's warnings are on by default and have no
-options to control them.
-
-@item -Wcomment
-@itemx -Wcomments
-Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
-comment, or whenever a backslash-newline appears in a @samp{//} comment.
-(Both forms have the same effect.)
-
-@item -Wtrigraphs
-Warn if any trigraphs are encountered.  This option used to take effect
-only if @option{-trigraphs} was also specified, but now works
-independently.  Warnings are not given for trigraphs within comments, as
-they do not affect the meaning of the program.
-
-@item -Wtraditional
-Warn about certain constructs that behave differently in traditional and
-ISO C@.  Also warn about ISO C constructs that have no traditional C
-equivalent, and problematic constructs which should be avoided.
-@xref{Traditional Mode}.
-
-@item -Wimport
-Warn the first time @samp{#import} is used.
-
-@item -Wundef
-Warn whenever an identifier which is not a macro is encountered in an
-@samp{#if} directive, outside of @samp{defined}.  Such identifiers are
-replaced with zero.
-
-@item -Werror
-Make all warnings into hard errors.  Source code which triggers warnings
-will be rejected.
-
-@item -Wsystem-headers
-Issue warnings for code in system headers.  These are normally unhelpful
-in finding bugs in your own code, therefore suppressed.  If you are
-responsible for the system library, you may want to see them.
-
-@item -w
-Suppress all warnings, including those which GNU CPP issues by default.
-
-@item -pedantic
-Issue all the mandatory diagnostics listed in the C standard.  Some of
-them are left out by default, since they trigger frequently on harmless
-code.
-
-@item -pedantic-errors
-Issue all the mandatory diagnostics, and make all mandatory diagnostics
-into errors.  This includes mandatory diagnostics that GCC issues
-without @samp{-pedantic} but treats as warnings.
-
-@item -M
-Instead of outputting the result of preprocessing, output a rule
-suitable for @command{make} describing the dependencies of the main
-source file.  The preprocessor outputs one @command{make} rule containing
-the object file name for that source file, a colon, and the names of all
-the included files, including those coming from @option{-include} or
-@option{-imacros} command line options.
-
-Unless specified explicitly (with @option{-MT} or @option{-MQ}), the
-object file name consists of the basename of the source file with any
-suffix replaced with object file suffix.  If there are many included
-files then the rule is split into several lines using @samp{\}-newline.
-The rule has no commands.
-
-@item -MM
-Like @option{-M}, but mention only the files included with @code{@w{#include
-"@var{file}"}} or with @option{-include} or @option{-imacros} command line
-options.  System header files included with @code{@w{#include <@var{file}>}}
-are omitted.
-
-@item -MF @var{file}
-When used with @option{-M} or @option{-MM}, specifies a file to write the
-dependencies to.  This allows the preprocessor to write the preprocessed
-file to stdout normally.  If no @option{-MF} switch is given, CPP sends
-the rules to stdout and suppresses normal preprocessed output.
-
-@item -MG
-When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing
-header files as generated files and assume they live in the same
-directory as the source file.  It suppresses preprocessed output, as a
-missing header file is ordinarily an error.
-
-This feature is used in automatic updating of makefiles.
-
-@item -MP
-This option instructs CPP to add a phony target for each dependency
-other than the main file, causing each to depend on nothing.  These
-dummy rules work around errors @command{make} gives if you remove header
-files without updating the @file{Makefile} to match.
-
-This is typical output:
-
-@example
-test.o: test.c test.h
-
-test.h:
-@end example
-
-@item -MT @var{target}
-
-Change the target of the rule emitted by dependency generation.  By
-default CPP takes the name of the main input file, including any path,
-deletes any file suffix such as @samp{.c}, and appends the platform's
-usual object suffix.  The result is the target.
-
-An @option{-MT} option will set the target to be exactly the string you
-specify.  If you want multiple targets, you can specify them as a single
-argument to @option{-MT}, or use multiple @option{-MT} options.
-
-For example, @option{@w{-MT '$(objpfx)foo.o'}} might give
-
-@example
-$(objpfx)foo.o: foo.c
-@end example
-
-@item -MQ @var{target}
-
-Same as @option{-MT}, but it quotes any characters which are special to
-Make.  @option{@w{-MQ '$(objpfx)foo.o'}} gives
-
-@example
-$$(objpfx)foo.o: foo.c
-@end example
-
-The default target is automatically quoted, as if it were given with
-@option{-MQ}.
-
-@item -MD @var{file}
-@itemx -MMD @var{file}
-@option{-MD @var{file}} is equivalent to @option{-M -MF @var{file}}, and
-@option{-MMD @var{file}} is equivalent to @option{-MM -MF @var{file}}.
-
-Due to limitations in the compiler driver, you must use these switches
-when you want to generate a dependency file as a side-effect of normal
-compilation.
-
-@item -x c
-@itemx -x c++
-@itemx -x objective-c
-@itemx -x assembler-with-cpp
-Specify the source language: C, C++, Objective-C, or assembly.  This has
-nothing to do with standards conformance or extensions; it merely
-selects which base syntax to expect.  If you give none of these options,
-cpp will deduce the language from the extension of the source file:
-@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}.  Some other common
-extensions for C++ and assembly are also recognized.  If cpp does not
-recognize the extension, it will treat the file as C; this is the most
-generic mode.
-
-@strong{Note:} Previous versions of cpp accepted a @option{-lang} option
-which selected both the language and the standards conformance level.
-This option has been removed, because it conflicts with the @option{-l}
-option.
-
-@item -std=@var{standard}
-@itemx -ansi
-Specify the standard to which the code should conform.  Currently cpp
-only knows about the standards for C; other language standards will be
-added in the future.
-
-@var{standard}
-may be one of:
-@table @code
-@item iso9899:1990
-@itemx c89
-The ISO C standard from 1990.  @samp{c89} is the customary shorthand for
-this version of the standard.
-
-The @option{-ansi} option is equivalent to @option{-std=c89}.
-
-@item iso9899:199409
-The 1990 C standard, as amended in 1994.
-
-@item iso9899:1999
-@itemx c99
-@itemx iso9899:199x
-@itemx c9x
-The revised ISO C standard, published in December 1999.  Before
-publication, this was known as C9X@.
-
-@item gnu89
-The 1990 C standard plus GNU extensions.  This is the default.
-
-@item gnu99
-@itemx gnu9x
-The 1999 C standard plus GNU extensions.
-@end table
-
-@item -I-
-Split the include path.  Any directories specified with @option{-I}
-options before @option{-I-} are searched only for headers requested with
-@code{@w{#include "@var{file}"}}; they are not searched for
-@code{@w{#include <@var{file}>}}.  If additional directories are
-specified with @option{-I} options after the @option{-I-}, those
-directories are searched for all @samp{#include} directives.
-
-In addition, @option{-I-} inhibits the use of the directory of the current
-file directory as the first search directory for @code{@w{#include
-"@var{file}"}}.  @xref{Search Path}.
-
-@item -nostdinc
-Do not search the standard system directories for header files.
-Only the directories you have specified with @option{-I} options
-(and the directory of the current file, if appropriate) are searched.
-
-@item -nostdinc++
-Do not search for header files in the C++-specific standard directories,
-but do still search the other standard directories.  (This option is
-used when building the C++ library.)
-
-@item -include @var{file}
-
-Process @var{file} as if @code{#include "file"} appeared as the first
-line of the primary source file.  However, the first directory searched
-for @var{file} is the preprocessor's working directory @emph{instead of}
-the directory containing the main source file.  If not found there, it
-is searched for in the remainder of the @code{#include "@dots{}"} search
-chain as normal.
-
-If multiple @option{-include} options are given, the files are included
-in the order they appear on the command line.
-
-@item -imacros @var{file}
-
-Exactly like @option{-include}, except that any output produced by
-scanning @var{file} is thrown away.  Macros it defines remain defined.
-This allows you to acquire all the macros from a header without also
-processing its declarations.
-
-All files specified by @option{-imacros} are processed before all files
-specified by @option{-include}.
-
-@item -idirafter @var{dir}
-Search @var{dir} for header files, but do it @emph{after} all
-directories specified with @option{-I} and the standard system directories
-have been exhausted.  @var{dir} is treated as a system include directory.
-
-@item -iprefix @var{prefix}
-Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
-options.  If the prefix represents a directory, you should include the
-final @samp{/}.
-
-@item -iwithprefix @var{dir}
-@itemx -iwithprefixbefore @var{dir}
-
-Append @var{dir} to the prefix specified previously with
-@option{-iprefix}, and add the resulting directory to the include search
-path.  @option{-iwithprefixbefore} puts it in the same place @option{-I}
-would; @option{-iwithprefix} puts it where @option{-idirafter} would.
-
-Use of these options is discouraged.
-
-@item -isystem @var{dir}
-Search @var{dir} for header files, after all directories specified by
-@option{-I} but before the standard system directories.  Mark it
-as a system directory, so that it gets the same special treatment as
-is applied to the standard system directories.  @xref{System Headers}.
-
-@item -fpreprocessed
-Indicate to the preprocessor that the input file has already been
-preprocessed.  This suppresses things like macro expansion, trigraph
-conversion, escaped newline splicing, and processing of most directives.
-The preprocessor still recognizes and removes comments, so that you can
-pass a file preprocessed with @option{-C} to the compiler without
-problems.  In this mode the integrated preprocessor is little more than
-a tokenizer for the front ends.
-
-@option{-fpreprocessed} is implicit if the input file has one of the
-extensions @samp{.i}, @samp{.ii} or @samp{.mi}.  These are the
-extensions that GCC uses for preprocessed files created by
-@option{-save-temps}.
-
-@item -ftabstop=@var{width}
-Set the distance between tab stops.  This helps the preprocessor report
-correct column numbers in warnings or errors, even if tabs appear on the
-line.  If the value is less than 1 or greater than 100, the option is
-ignored.  The default is 8.
-
-@item -fno-show-column
-Do not print column numbers in diagnostics.  This may be necessary if
-diagnostics are being scanned by a program that does not understand the
-column numbers, such as @command{dejagnu}.
-
-@item -A @var{predicate}=@var{answer}
-Make an assertion with the predicate @var{predicate} and answer
-@var{answer}.  This form is preferred to the older form @option{-A
-@var{predicate}(@var{answer})}, which is still supported, because
-it does not use shell special characters.  @xref{Assertions}.
-
-@item -A -@var{predicate}=@var{answer}
-Cancel an assertion with the predicate @var{predicate} and answer
-@var{answer}.
-
-@item -A-
-Cancel all predefined assertions and all assertions preceding it on
-the command line.  Also, undefine all predefined macros and all
-macros preceding it on the command line.  (This is a historical wart and
-may change in the future.)
-
-@item -dCHARS
-@var{CHARS} is a sequence of one or more of the following characters,
-and must not be preceded by a space.  Other characters are interpreted
-by the compiler proper, or reserved for future versions of GCC, and so
-are silently ignored.  If you specify characters whose behavior
-conflicts, the result is undefined.
-
-@table @samp
-@item M
-Instead of the normal output, generate a list of @samp{#define}
-directives for all the macros defined during the execution of the
-preprocessor, including predefined macros.  This gives you a way of
-finding out what is predefined in your version of the preprocessor.
-Assuming you have no file @file{foo.h}, the command
-
-@example
-touch foo.h; cpp -dM foo.h
-@end example
-
-@noindent
-will show all the predefined macros.
-
-@item D
-Like @samp{M} except in two respects: it does @emph{not} include the
-predefined macros, and it outputs @emph{both} the @samp{#define}
-directives and the result of preprocessing.  Both kinds of output go to
-the standard output file.
-
-@item N
-Like @samp{D}, but emit only the macro names, not their expansions.
-
-@item I
-Output @samp{#include} directives in addition to the result of
-preprocessing.
-@end table
+@include cppopts.texi
+@c man end
 
-@item -P
-Inhibit generation of linemarkers in the output from the preprocessor.
-This might be useful when running the preprocessor on something that is
-not C code, and will be sent to a program which might be confused by the
-linemarkers.  @xref{Preprocessor Output}.
-
-@item -C
-Do not discard comments.  All comments are passed through to the output
-file, except for comments in processed directives, which are deleted
-along with the directive.
-
-You should be prepared for side effects when using @option{-C}; it
-causes the preprocessor to treat comments as tokens in their own right.
-For example, comments appearing at the start of what would be a
-directive line have the effect of turning that line into an ordinary
-source line, since the first token on the line is no longer a @samp{#}.
-
-@item -gcc
-Define the macros @sc{__gnuc__}, @sc{__gnuc_minor__} and
-@sc{__gnuc_patchlevel__}.  These are defined automatically when you use
-@command{gcc -E}; you can turn them off in that case with
-@option{-no-gcc}.
-
-@item -traditional
-Try to imitate the behavior of old-fashioned C, as opposed to ISO
-C@.  @xref{Traditional Mode}.
-
-@item -trigraphs
-Process trigraph sequences.  @xref{Initial processing}.
-
-@item -remap
-Enable special code to work around file systems which only permit very
-short file names, such as MS-DOS@.
-
-@item -$
-Forbid the use of @samp{$} in identifiers.  The C standard allows
-implementations to define extra characters that can appear in
-identifiers.  By default GNU CPP permits @samp{$}, a common extension.
-
-@item -h
-@itemx --help
-@itemx --target-help
-Print text describing all the command line options instead of
-preprocessing anything.
-
-@item -v
-Verbose mode.  Print out GNU CPP's version number at the beginning of
-execution, and report the final form of the include path.
-
-@item -H
-Print the name of each header file used, in addition to other normal
-activities.  Each name is indented to show how deep in the
-@samp{#include} stack it is.
-
-@item -version
-@itemx --version
-Print out GNU CPP's version number.  With one dash, proceed to
-preprocess as normal.  With two dashes, exit immediately.
-@end table
+@node Environment Variables
+@chapter Environment Variables
+@cindex environment variables
+@c man begin ENVIRONMENT
+
+This section describes the environment variables that affect how CPP
+operates.  You can use them to specify directories or prefixes to use
+when searching for include files, or to control dependency output.
+
+Note that you can also specify places to search using options such as
+@option{-I}, and control dependency output with options like
+@option{-M} (@pxref{Invocation}).  These take precedence over
+environment variables, which in turn take precedence over the
+configuration of GCC@.
+@include cppenv.texi
 @c man end
 
+@page
 @include fdl.texi
 
 @page
@@ -4286,6 +4160,14 @@ preprocess as normal.  With two dashes, exit immediately.
 @unnumbered Index of Directives
 @printindex fn
 
+@node Option Index
+@unnumbered Option Index
+@noindent
+CPP's command line options and environment variables are indexed here
+without any initial @samp{-} or @samp{--}.
+@printindex op
+
+@page
 @node Concept Index
 @unnumbered Concept Index
 @printindex cp