Commit ec85a978 by Sandra Loosemore Committed by Sandra Loosemore

cppdiropts.texi: Merge documentation of -I, -iquote, -isystem, and -idirafter.

2017-01-07  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* doc/cppdiropts.texi: Merge documentation of -I, -iquote,
	-isystem, and -idirafter.  Copy-edit.
	* doc/cppopts.texi: Copy-edit.  Remove contradiction about 
	default for -ftrack-macro-expansion.  Delete obsolete and 
	badly-formatted implementation details about -fdebug-cpp output.
	* doc/cppwarnopts.texi: Copy-edit.

From-SVN: r244200
parent 5ccf1d8d
2017-01-07 Sandra Loosemore <sandra@codesourcery.com>
* doc/cppdiropts.texi: Merge documentation of -I, -iquote,
-isystem, and -idirafter. Copy-edit.
* doc/cppopts.texi: Copy-edit. Remove contradiction about
default for -ftrack-macro-expansion. Delete obsolete and
badly-formatted implementation details about -fdebug-cpp output.
* doc/cppwarnopts.texi: Copy-edit.
2017-01-07 David Malcolm <dmalcolm@redhat.com> 2017-01-07 David Malcolm <dmalcolm@redhat.com>
PR c++/72803 PR c++/72803
......
...@@ -10,61 +10,85 @@ ...@@ -10,61 +10,85 @@
@c formatted for inclusion in the CPP manual; otherwise the main GCC manual. @c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
@item -I @var{dir} @item -I @var{dir}
@itemx -iquote @var{dir}
@itemx -isystem @var{dir}
@itemx -idirafter @var{dir}
@opindex I @opindex I
@opindex iquote
@opindex isystem
@opindex idirafter
Add the directory @var{dir} to the list of directories to be searched Add the directory @var{dir} to the list of directories to be searched
for header files. for header files during preprocessing.
@ifset cppmanual @ifset cppmanual
@xref{Search Path}. @xref{Search Path}.
@end ifset @end ifset
If you use more than If @var{dir} begins with @samp{=}, then the @samp{=} is replaced
one @option{-I} option, the directories are scanned in left-to-right by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
order; the standard system directories come after.
Directories specified with @option{-iquote} apply only to the quote
form of the directive, @code{@w{#include "@var{file}"}}.
Directories specified with @option{-I}, @option{-isystem},
or @option{-idirafter} apply to lookup for both the
@code{@w{#include "@var{file}"}} and
@code{@w{#include <@var{file}>}} directives.
You can specify any number or combination of these options on the
command line to search for header files in several directories.
The lookup order is as follows:
@enumerate
@item
For the quote form of the include directive, the directory of the current
file is searched first.
@item
For the quote form of the include directive, the directories specified
by @option{-iquote} options are searched in left-to-right order,
as they appear on the command line.
@item
Directories specified with @option{-I} options are scanned in
left-to-right order.
This can be used to override a system header @item
Directories specified with @option{-isystem} options are scanned in
left-to-right order.
@item
Standard system directories are scanned.
@item
Directories specified with @option{-idirafter} options are scanned in
left-to-right order.
@end enumerate
You can use @option{-I} to override a system header
file, substituting your own version, since these directories are file, substituting your own version, since these directories are
searched before the system header file directories. However, you should searched before the standard system header file directories.
However, you should
not use this option to add directories that contain vendor-supplied not use this option to add directories that contain vendor-supplied
system header files (use @option{-isystem} for that). system header files; use @option{-isystem} for that.
The @option{-isystem} and @option{-idirafter} options also mark the directory
as a system directory, so that it gets the same special treatment that
is applied to the standard system directories.
@ifset cppmanual
@xref{System Headers}.
@end ifset
If a standard system include directory, or a directory specified with If a standard system include directory, or a directory specified with
@option{-isystem}, is also specified with @option{-I}, the @option{-I} @option{-isystem}, is also specified with @option{-I}, the @option{-I}
option is ignored. The directory is still searched but as a option is ignored. The directory is still searched but as a
system directory at its normal position in the system include chain. system directory at its normal position in the system include chain.
This is to ensure that GCC's procedure to fix buggy system headers and This is to ensure that GCC's procedure to fix buggy system headers and
the ordering for the @code{include_next} directive are not inadvertently changed. the ordering for the @code{#include_next} directive are not inadvertently
changed.
If you really need to change the search order for system directories, If you really need to change the search order for system directories,
use the @option{-nostdinc} and/or @option{-isystem} options. use the @option{-nostdinc} and/or @option{-isystem} options.
@ifset cppmanual @ifset cppmanual
@xref{System Headers}. @xref{System Headers}.
@end ifset @end ifset
If @var{dir} begins with @code{=}, then the @code{=} is replaced
by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
@item -iquote @var{dir}
@opindex iquote
Search @var{dir} only for header files requested with
@code{@w{#include "@var{file}"}}; they are not searched for
@code{@w{#include <@var{file}>}}, before all directories specified by
@option{-I} and before the standard system directories.
@ifset cppmanual
@xref{Search Path}.
@end ifset
If @var{dir} begins with @code{=}, then the @code{=} is replaced
by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
@item -isystem @var{dir}
@opindex isystem
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.
@ifset cppmanual
@xref{System Headers}.
@end ifset
If @var{dir} begins with @code{=}, then the @code{=} is replaced
by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
@item -I- @item -I-
@opindex I- @opindex I-
Split the include path. Split the include path.
...@@ -86,14 +110,6 @@ file directory as the first search directory for @code{@w{#include ...@@ -86,14 +110,6 @@ file directory as the first search directory for @code{@w{#include
@xref{Search Path}. @xref{Search Path}.
@end ifset @end ifset
@item -idirafter @var{dir}
@opindex idirafter
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.
If @var{dir} begins with @code{=}, then the @code{=} will be replaced
by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
@item -iprefix @var{prefix} @item -iprefix @var{prefix}
@opindex iprefix @opindex iprefix
Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix} Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
...@@ -124,8 +140,10 @@ target-specific C++ headers. ...@@ -124,8 +140,10 @@ target-specific C++ headers.
@item -nostdinc @item -nostdinc
@opindex nostdinc @opindex nostdinc
Do not search the standard system directories for header files. Do not search the standard system directories for header files.
Only the directories you have specified with @option{-I} options Only the directories explicitly specified with @option{-I},
(and the directory of the current file, if appropriate) are searched. @option{-iquote}, @option{-isystem}, and/or @option{-idirafter}
options (and the directory of the current file, if appropriate)
are searched.
@item -nostdinc++ @item -nostdinc++
@opindex nostdinc++ @opindex nostdinc++
......
...@@ -16,7 +16,7 @@ Predefine @var{name} as a macro, with definition @code{1}. ...@@ -16,7 +16,7 @@ Predefine @var{name} as a macro, with definition @code{1}.
@item -D @var{name}=@var{definition} @item -D @var{name}=@var{definition}
The contents of @var{definition} are tokenized and processed as if The contents of @var{definition} are tokenized and processed as if
they appeared during translation phase three in a @samp{#define} they appeared during translation phase three in a @samp{#define}
directive. In particular, the definition will be truncated by directive. In particular, the definition is truncated by
embedded newline characters. embedded newline characters.
If you are invoking the preprocessor from a shell or shell-like If you are invoking the preprocessor from a shell or shell-like
...@@ -25,8 +25,8 @@ characters such as spaces that have a meaning in the shell syntax. ...@@ -25,8 +25,8 @@ characters such as spaces that have a meaning in the shell syntax.
If you wish to define a function-like macro on the command line, write If you wish to define a function-like macro on the command line, write
its argument list with surrounding parentheses before the equals sign its argument list with surrounding parentheses before the equals sign
(if any). Parentheses are meaningful to most shells, so you will need (if any). Parentheses are meaningful to most shells, so you should
to quote the option. With @command{sh} and @command{csh}, quote the option. With @command{sh} and @command{csh},
@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works. @option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
@option{-D} and @option{-U} options are processed in the order they @option{-D} and @option{-U} options are processed in the order they
...@@ -92,7 +92,7 @@ This option does not suppress the preprocessor's debug output, such as ...@@ -92,7 +92,7 @@ This option does not suppress the preprocessor's debug output, such as
rules you should explicitly specify the dependency output file with rules you should explicitly specify the dependency output file with
@option{-MF}, or use an environment variable like @option{-MF}, or use an environment variable like
@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output @env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output
will still be sent to the regular output stream as normal. is still sent to the regular output stream as normal.
Passing @option{-M} to the driver implies @option{-E}, and suppresses Passing @option{-M} to the driver implies @option{-E}, and suppresses
warnings with an implicit @option{-w}. warnings with an implicit @option{-w}.
...@@ -105,15 +105,14 @@ directly or indirectly, from such a header. ...@@ -105,15 +105,14 @@ directly or indirectly, from such a header.
This implies that the choice of angle brackets or double quotes in an This implies that the choice of angle brackets or double quotes in an
@samp{#include} directive does not in itself determine whether that @samp{#include} directive does not in itself determine whether that
header will appear in @option{-MM} dependency output. This is a header appears in @option{-MM} dependency output.
slight change in semantics from GCC versions 3.0 and earlier.
@anchor{dashMF} @anchor{dashMF}
@item -MF @var{file} @item -MF @var{file}
@opindex MF @opindex MF
When used with @option{-M} or @option{-MM}, specifies a When used with @option{-M} or @option{-MM}, specifies a
file to write the dependencies to. If no @option{-MF} switch is given file to write the dependencies to. If no @option{-MF} switch is given
the preprocessor sends the rules to the same place it would have sent the preprocessor sends the rules to the same place it would send
preprocessed output. preprocessed output.
When used with the driver options @option{-MD} or @option{-MMD}, When used with the driver options @option{-MD} or @option{-MMD},
...@@ -154,7 +153,7 @@ default CPP takes the name of the main input file, deletes any ...@@ -154,7 +153,7 @@ default CPP takes the name of the main input file, deletes any
directory components and any file suffix such as @samp{.c}, and directory components and any file suffix such as @samp{.c}, and
appends the platform's usual object suffix. The result is the target. 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 An @option{-MT} option sets the target to be exactly the string you
specify. If you want multiple targets, you can specify them as a single specify. If you want multiple targets, you can specify them as a single
argument to @option{-MT}, or use multiple @option{-MT} options. argument to @option{-MT}, or use multiple @option{-MT} options.
...@@ -269,8 +268,7 @@ option makes the preprocessor and the compiler consume more ...@@ -269,8 +268,7 @@ option makes the preprocessor and the compiler consume more
memory. The @var{level} parameter can be used to choose the level of memory. The @var{level} parameter can be used to choose the level of
precision of token location tracking thus decreasing the memory precision of token location tracking thus decreasing the memory
consumption if necessary. Value @samp{0} of @var{level} de-activates consumption if necessary. Value @samp{0} of @var{level} de-activates
this option just as if no @option{-ftrack-macro-expansion} was present this option. Value @samp{1} tracks tokens locations in a
on the command line. Value @samp{1} tracks tokens locations in a
degraded mode for the sake of minimal memory overhead. In this mode degraded mode for the sake of minimal memory overhead. In this mode
all tokens resulting from the expansion of an argument of a all tokens resulting from the expansion of an argument of a
function-like macro have the same location. Value @samp{2} tracks function-like macro have the same location. Value @samp{2} tracks
...@@ -312,10 +310,10 @@ supported by the system's @code{iconv} library routine. ...@@ -312,10 +310,10 @@ supported by the system's @code{iconv} library routine.
@item -fpch-deps @item -fpch-deps
@opindex fpch-deps @opindex fpch-deps
When using precompiled headers (@pxref{Precompiled Headers}), this flag When using precompiled headers (@pxref{Precompiled Headers}), this flag
will cause the dependency-output flags to also list the files from the causes the dependency-output flags to also list the files from the
precompiled header's dependencies. If not specified only the precompiled header's dependencies. If not specified, only the
precompiled header would be listed and not the files that were used to precompiled header are listed and not the files that were used to
create it because those files are not consulted when a precompiled create it, because those files are not consulted when a precompiled
header is used. header is used.
@item -fpch-preprocess @item -fpch-preprocess
...@@ -340,11 +338,11 @@ current directory. ...@@ -340,11 +338,11 @@ current directory.
@item -fworking-directory @item -fworking-directory
@opindex fworking-directory @opindex fworking-directory
@opindex fno-working-directory @opindex fno-working-directory
Enable generation of linemarkers in the preprocessor output that will Enable generation of linemarkers in the preprocessor output that
let the compiler know the current working directory at the time of let the compiler know the current working directory at the time of
preprocessing. When this option is enabled, the preprocessor will preprocessing. When this option is enabled, the preprocessor
emit, after the initial linemarker, a second linemarker with the emits, after the initial linemarker, a second linemarker with the
current working directory followed by two slashes. GCC will use this current working directory followed by two slashes. GCC uses this
directory, when it's present in the preprocessed input, as the directory, when it's present in the preprocessed input, as the
directory emitted as the current working directory in some debugging directory emitted as the current working directory in some debugging
information formats. This option is implicitly enabled if debugging information formats. This option is implicitly enabled if debugging
...@@ -380,6 +378,7 @@ directive line have the effect of turning that line into an ordinary ...@@ -380,6 +378,7 @@ 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{#}. source line, since the first token on the line is no longer a @samp{#}.
@item -CC @item -CC
@opindex CC
Do not discard comments, including during macro expansion. This is Do not discard comments, including during macro expansion. This is
like @option{-C}, except that comments contained within macros are like @option{-C}, except that comments contained within macros are
also passed through to the output file where the macro is expanded. also passed through to the output file where the macro is expanded.
...@@ -480,7 +479,7 @@ touch foo.h; cpp -dM foo.h ...@@ -480,7 +479,7 @@ touch foo.h; cpp -dM foo.h
@end smallexample @end smallexample
@noindent @noindent
will show all the predefined macros. shows all the predefined macros.
@ifclear cppmanual @ifclear cppmanual
If you use @option{-dM} without the @option{-E} option, @option{-dM} is If you use @option{-dM} without the @option{-E} option, @option{-dM} is
...@@ -515,14 +514,10 @@ undefined at the time. ...@@ -515,14 +514,10 @@ undefined at the time.
@item -fdebug-cpp @item -fdebug-cpp
@opindex fdebug-cpp @opindex fdebug-cpp
This option is only useful for debugging GCC. When used with This option is only useful for debugging GCC. When used from CPP or with
@option{-E}, dumps debugging information about location maps. Every @option{-E}, it dumps debugging information about location maps. Every
token in the output is preceded by the dump of the map its location token in the output is preceded by the dump of the map its location
belongs to. The dump of the map holding the location of a token would belongs to.
be:
@smallexample
@{@samp{P}:@file{/file/path};@samp{F}:@file{/includer/path};@samp{L}:@var{line_num};@samp{C}:@var{col_num};@samp{S}:@var{system_header_p};@samp{M}:@var{map_address};@samp{E}:@var{macro_expansion_p},@samp{loc}:@var{location}@}
@end smallexample
When used without @option{-E}, this option has no effect. When used from GCC without @option{-E}, this option has no effect.
...@@ -46,14 +46,14 @@ This warning is also enabled by @option{-Wpedantic} and @option{-Wextra}. ...@@ -46,14 +46,14 @@ This warning is also enabled by @option{-Wpedantic} and @option{-Wextra}.
@opindex Wunused-macros @opindex Wunused-macros
Warn about macros defined in the main file that are unused. A macro Warn about macros defined in the main file that are unused. A macro
is @dfn{used} if it is expanded or tested for existence at least once. is @dfn{used} if it is expanded or tested for existence at least once.
The preprocessor will also warn if the macro has not been used at the The preprocessor also warns if the macro has not been used at the
time it is redefined or undefined. time it is redefined or undefined.
Built-in macros, macros defined on the command line, and macros Built-in macros, macros defined on the command line, and macros
defined in include files are not warned about. defined in include files are not warned about.
@emph{Note:} If a macro is actually used, but only used in skipped @emph{Note:} If a macro is actually used, but only used in skipped
conditional blocks, then CPP will report it as unused. To avoid the conditional blocks, then the preprocessor reports it as unused. To avoid the
warning in such a case, you might improve the scope of the macro's warning in such a case, you might improve the scope of the macro's
definition by, for example, moving it into the first skipped block. definition by, for example, moving it into the first skipped block.
Alternatively, you could provide a dummy use with something like: Alternatively, you could provide a dummy use with something like:
...@@ -67,7 +67,7 @@ Alternatively, you could provide a dummy use with something like: ...@@ -67,7 +67,7 @@ Alternatively, you could provide a dummy use with something like:
@opindex Wno-endif-labels @opindex Wno-endif-labels
@opindex Wendif-labels @opindex Wendif-labels
Do not warn whenever an @code{#else} or an @code{#endif} are followed by text. Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
This usually happens in code of the form This sometimes happens in older programs with code of the form
@smallexample @smallexample
#if FOO #if FOO
...@@ -78,6 +78,5 @@ This usually happens in code of the form ...@@ -78,6 +78,5 @@ This usually happens in code of the form
@end smallexample @end smallexample
@noindent @noindent
The second and third @code{FOO} should be in comments, but often are not The second and third @code{FOO} should be in comments.
in older programs. This warning is on by default. This warning is on by default.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment