cppinit.c (OPT_MD, OPT_MMD): Restore.
* cppinit.c (OPT_MD, OPT_MMD): Restore. (cpp_handle_option): Handle them. (cpp_post_options): Ensure one of -M or -MM is specified with any other -M? option. (init_dependency_output): Suppress output with -MG. * cpp.texi: Update. * invoke.texi: Update. From-SVN: r38833
This commit is contained in:
parent
7894cb2753
commit
e582248c93
@ -1,3 +1,16 @@
|
||||
2001-01-09 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cppinit.c (OPT_MD, OPT_MMD): Restore.
|
||||
(cpp_handle_option): Handle them.
|
||||
(cpp_post_options): Ensure one of -M or -MM is specified with
|
||||
any other -M? option.
|
||||
(init_dependency_output): Suppress output with -MG.
|
||||
|
||||
2001-01-09 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cpp.texi: Update.
|
||||
* invoke.texi: Update.
|
||||
|
||||
2001-01-09 Bernd Schmidt <bernds@redhat.com>
|
||||
|
||||
* sh.md (reload_outsf): Generate recognizable patterns for
|
||||
|
65
gcc/cpp.texi
65
gcc/cpp.texi
@ -3092,7 +3092,8 @@ cpp [@samp{-P}] [@samp{-C}] [@samp{-gcc}] [@samp{-traditional}]
|
||||
[@samp{-W}@var{warn}...] [@samp{-I}@var{dir}...]
|
||||
[@samp{-D}@var{macro}[=@var{defn}]...] [@samp{-U}@var{macro}]
|
||||
[@samp{-A}@var{predicate}(@var{answer})]
|
||||
[@samp{-M}|@samp{-MM}|@samp{-MD}|@samp{-MMD} [@samp{-MG}]]
|
||||
[@samp{-M}|@samp{-MM}][@samp{-MG}][@samp{-MF}@var{filename}]
|
||||
[@samp{-MP}][@samp{-MQ}@var{target}...][@samp{-MT}@var{target}...]
|
||||
[@samp{-x} @var{language}] [@samp{-std=}@var{standard}]
|
||||
@var{infile} @var{outfile}
|
||||
|
||||
@ -3347,6 +3348,9 @@ Do not search the standard system directories for header files.
|
||||
Only the directories you have specified with @samp{-I} options
|
||||
(and the current directory, if appropriate) are searched.
|
||||
|
||||
By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
|
||||
search path to only those directories you specify explicitly.
|
||||
|
||||
@item -nostdinc++
|
||||
@findex -nostdinc++
|
||||
Do not search for header files in the C++-specific standard directories,
|
||||
@ -3375,11 +3379,17 @@ spaces that have a meaning in the shell syntax. If you use more than
|
||||
one @samp{-D} for the same @var{name}, the rightmost definition takes
|
||||
effect.
|
||||
|
||||
Any @samp{-D} and @samp{-U} options on the command line are processed in
|
||||
order, and always before @samp{-imacros @var{file}}, regardless of the
|
||||
order in which they are written.
|
||||
|
||||
@item -U @var{name}
|
||||
@findex -U
|
||||
Do not predefine @var{name}. If both @samp{-U} and @samp{-D} are
|
||||
specified for one name, whichever one appears later on the command line
|
||||
wins.
|
||||
Do not predefine @var{name}.
|
||||
|
||||
Any @samp{-D} and @samp{-U} options on the command line are processed in
|
||||
order, and always before @samp{-imacros @var{file}}, regardless of the
|
||||
order in which they are written.
|
||||
|
||||
@item -undef
|
||||
@findex -undef
|
||||
@ -3436,7 +3446,7 @@ Like @samp{-dD}, but emit only the macro names, not their expansions.
|
||||
Output @samp{#include} directives in addition to the result of
|
||||
preprocessing.
|
||||
|
||||
@item -M [-MG]
|
||||
@item -M
|
||||
@findex -M
|
||||
Instead of outputting the result of preprocessing, output a rule
|
||||
suitable for @code{make} describing the dependencies of the main source
|
||||
@ -3445,43 +3455,34 @@ object file name for that source file, a colon, and the names of all the
|
||||
included files. If there are many included files then the rule is split
|
||||
into several lines using @samp{\}-newline.
|
||||
|
||||
@samp{-MG} says to treat missing header files as generated files and
|
||||
assume they live in the same directory as the source file. It must be
|
||||
specified in addition to @samp{-M}.
|
||||
|
||||
This feature is used in automatic updating of makefiles.
|
||||
|
||||
@item -MM [-MG]
|
||||
@item -MM
|
||||
@findex -MM
|
||||
Like @samp{-M} but mention only the files included with @samp{#include
|
||||
Like @samp{-M}, but mention only the files included with @samp{#include
|
||||
"@var{file}"}. System header files included with @samp{#include
|
||||
<@var{file}>} are omitted.
|
||||
|
||||
@item -MD @var{file}
|
||||
@findex -MD
|
||||
Like @samp{-M} but the dependency information is written to @var{file}.
|
||||
This is in addition to compiling the file as specified --- @samp{-MD}
|
||||
does not inhibit ordinary compilation the way @samp{-M} does.
|
||||
@item -MF @var{file}
|
||||
@findex -MF
|
||||
When used with @samp{-M} or @samp{-MM}, specifies a file to write the
|
||||
dependencies to. This allows the preprocessor to write the preprocessed
|
||||
file to stdout normally. If no @samp{-MF} switch is given, CPP sends
|
||||
the rules to stdout and suppresses normal preprocessed output.
|
||||
|
||||
When invoking @code{gcc}, do not specify the @var{file} argument.
|
||||
@code{gcc} will create file names made by replacing ".c" with ".d" at
|
||||
the end of the input file names.
|
||||
@item -MG
|
||||
@findex -MG
|
||||
When used with @samp{-M} or @samp{-MM}, @samp{-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.
|
||||
|
||||
In Mach, you can use the utility @code{md} to merge multiple dependency
|
||||
files into a single dependency file suitable for using with the
|
||||
@samp{make} command.
|
||||
|
||||
@item -MMD @var{file}
|
||||
@findex -MMD
|
||||
Like @samp{-MD} except mention only user header files, not system
|
||||
header files.
|
||||
This feature is used in automatic updating of makefiles.
|
||||
|
||||
@item -MP
|
||||
@findex -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 MAKE gives if you remove header files
|
||||
without updating the Makefile to match.
|
||||
dummy rules work around errors @code{make} gives if you remove header
|
||||
files without updating the @code{Makefile} to match.
|
||||
|
||||
This is typical output:-
|
||||
|
||||
@ -3493,8 +3494,8 @@ This is typical output:-
|
||||
|
||||
@item -MQ @var{target}
|
||||
@item -MT @var{target}
|
||||
@findex -MT
|
||||
@findex -MQ
|
||||
@findex -MT
|
||||
By default CPP uses the main file name, including any path, and appends
|
||||
the object suffix, normally ``.o'', to it to obtain the name of the
|
||||
target for dependency generation. With @samp{-MT} you can specify a
|
||||
|
@ -1042,9 +1042,11 @@ new_pending_directive (pend, text, handler)
|
||||
DEF_OPT("H", 0, OPT_H) \
|
||||
DEF_OPT("I", no_dir, OPT_I) \
|
||||
DEF_OPT("M", 0, OPT_M) \
|
||||
DEF_OPT("MD", no_fil, OPT_MD) \
|
||||
DEF_OPT("MF", no_fil, OPT_MF) \
|
||||
DEF_OPT("MG", 0, OPT_MG) \
|
||||
DEF_OPT("MM", 0, OPT_MM) \
|
||||
DEF_OPT("MMD", no_fil, OPT_MMD) \
|
||||
DEF_OPT("MP", 0, OPT_MP) \
|
||||
DEF_OPT("MQ", no_tgt, OPT_MQ) \
|
||||
DEF_OPT("MT", no_tgt, OPT_MT) \
|
||||
@ -1461,6 +1463,21 @@ cpp_handle_option (pfile, argc, argv)
|
||||
deps_add_target (pfile->deps, arg, opt_code == OPT_MQ);
|
||||
break;
|
||||
|
||||
/* -MD and -MMD for cpp0 are deprecated and undocumented
|
||||
(use -M or -MM with -MF instead), and probably should be
|
||||
removed with the next major GCC version. For the moment
|
||||
we allow these for the benefit of Automake 1.4, which
|
||||
uses these when dependency tracking is enabled. Automake
|
||||
1.5 will fix this. */
|
||||
case OPT_MD:
|
||||
CPP_OPTION (pfile, print_deps) = 2;
|
||||
CPP_OPTION (pfile, deps_file) = arg;
|
||||
break;
|
||||
case OPT_MMD:
|
||||
CPP_OPTION (pfile, print_deps) = 1;
|
||||
CPP_OPTION (pfile, deps_file) = arg;
|
||||
break;
|
||||
|
||||
case OPT_A:
|
||||
if (arg[0] == '-')
|
||||
{
|
||||
@ -1673,12 +1690,13 @@ cpp_post_options (pfile)
|
||||
set its callbacks correctly before calling cpp_start_read. */
|
||||
init_dependency_output (pfile);
|
||||
|
||||
/* -MG doesn't select the form of output and must be specified with
|
||||
one of -M or -MM. -MG doesn't make sense unless preprocessed
|
||||
output (and compilation) is inhibited. */
|
||||
if (CPP_OPTION (pfile, print_deps_missing_files)
|
||||
&& CPP_OPTION (pfile, print_deps) == 0)
|
||||
cpp_fatal (pfile, "-MG must be specified with one of -M or -MM");
|
||||
/* After checking the environment variables, check if -M or -MM has
|
||||
not been specified, but other -M options have. */
|
||||
if (CPP_OPTION (pfile, print_deps) == 0 &&
|
||||
(CPP_OPTION (pfile, print_deps_missing_files)
|
||||
|| CPP_OPTION (pfile, deps_file)
|
||||
|| CPP_OPTION (pfile, deps_phony_targets)))
|
||||
cpp_fatal (pfile, "you must additionally specify either -M or -MM");
|
||||
}
|
||||
|
||||
/* Set up dependency-file output. */
|
||||
@ -1726,10 +1744,12 @@ init_dependency_output (pfile)
|
||||
CPP_OPTION (pfile, print_deps_append) = 1;
|
||||
}
|
||||
|
||||
/* If dependencies go to standard output, we need to suppress
|
||||
output. The user may be requesting other stuff to stdout, with
|
||||
-dM, -v etc. We let them shoot themselves in the foot. */
|
||||
if (CPP_OPTION (pfile, deps_file) == 0)
|
||||
/* If dependencies go to standard output, or -MG is used, we should
|
||||
suppress output. The user may be requesting other stuff to
|
||||
stdout, with -dM, -v etc. We let them shoot themselves in the
|
||||
foot. */
|
||||
if (CPP_OPTION (pfile, deps_file) == 0
|
||||
|| CPP_OPTION (pfile, print_deps_missing_files))
|
||||
CPP_OPTION (pfile, no_output) = 1;
|
||||
}
|
||||
|
||||
|
182
gcc/invoke.texi
182
gcc/invoke.texi
@ -255,14 +255,15 @@ in the following sections.
|
||||
@item Preprocessor Options
|
||||
@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
|
||||
@smallexample
|
||||
-A@var{question}(@var{answer}) -C -dD -dM -dN
|
||||
-$ -A@var{question}=@var{answer} -A-@var{question}[=@var{answer}]
|
||||
-C -dD -dI -dM -dN
|
||||
-D@var{macro}@r{[}=@var{defn}@r{]} -E -H
|
||||
-idirafter @var{dir}
|
||||
-include @var{file} -imacros @var{file}
|
||||
-iprefix @var{file} -iwithprefix @var{dir}
|
||||
-iwithprefixbefore @var{dir} -isystem @var{dir} -isystem-c++ @var{dir}
|
||||
-M -MD -MM -MMD -MG -nostdinc -P -trigraphs
|
||||
-undef -U@var{macro} -Wp,@var{option}
|
||||
-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap
|
||||
-trigraphs -undef -U@var{macro} -Wp,@var{option}
|
||||
@end smallexample
|
||||
|
||||
@item Assembler Option
|
||||
@ -3222,12 +3223,8 @@ Process @var{file} as input, discarding the resulting output, before
|
||||
processing the regular input file. Because the output generated from
|
||||
@var{file} is discarded, the only effect of @samp{-imacros @var{file}}
|
||||
is to make the macros defined in @var{file} available for use in the
|
||||
main input.
|
||||
|
||||
Any @samp{-D} and @samp{-U} options on the command line are always
|
||||
processed before @samp{-imacros @var{file}}, regardless of the order in
|
||||
which they are written. All the @samp{-include} and @samp{-imacros}
|
||||
options are processed in the order in which they are written.
|
||||
main input. All the @samp{-include} and @samp{-imacros} options are
|
||||
processed in the order in which they are written.
|
||||
|
||||
@item -idirafter @var{dir}
|
||||
@cindex second include path
|
||||
@ -3266,6 +3263,15 @@ Options}, for information on @samp{-I}.
|
||||
By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
|
||||
search path to only those directories you specify explicitly.
|
||||
|
||||
@item -remap
|
||||
@findex -remap
|
||||
When searching for a header file in a directory, remap file names if a
|
||||
file named @file{header.gcc} exists in that directory. This can be used
|
||||
to work around limitations of file systems with file name restrictions.
|
||||
The @file{header.gcc} file should contain a series of lines with two
|
||||
tokens on each line: the first token is the name to map, and the second
|
||||
token is the actual name to use.
|
||||
|
||||
@item -undef
|
||||
Do not predefine any nonstandard macros. (Including architecture flags).
|
||||
|
||||
@ -3285,44 +3291,86 @@ Used with the @samp{-E} option.
|
||||
@cindex make
|
||||
@cindex dependencies, make
|
||||
@item -M
|
||||
Tell the preprocessor to output a rule suitable for @code{make}
|
||||
describing the dependencies of each object file. For each source file,
|
||||
the preprocessor outputs one @code{make}-rule whose target is the object
|
||||
file name for that source file and whose dependencies are all the
|
||||
@code{#include} header files it uses. This rule may be a single line or
|
||||
may be continued with @samp{\}-newline if it is long. The list of rules
|
||||
is printed on standard output instead of the preprocessed C program.
|
||||
@findex -M
|
||||
Instead of outputting the result of preprocessing, output a rule
|
||||
suitable for @code{make} describing the dependencies of the main source
|
||||
file. The preprocessor outputs one @code{make} rule containing the
|
||||
object file name for that source file, a colon, and the names of all the
|
||||
included files. If there are many included files then the rule is split
|
||||
into several lines using @samp{\}-newline.
|
||||
|
||||
@samp{-M} implies @samp{-E}.
|
||||
|
||||
@item -MM
|
||||
@findex -MM
|
||||
Like @samp{-M}, but mention only the files included with @samp{#include
|
||||
"@var{file}"}. System header files included with @samp{#include
|
||||
<@var{file}>} are omitted.
|
||||
|
||||
@item -MF @var{file}
|
||||
@findex -MF
|
||||
When used with @samp{-M} or @samp{-MM}, specifies a file to write the
|
||||
dependencies to. This allows the preprocessor to write the preprocessed
|
||||
file to stdout normally. If no @samp{-MF} switch is given, CPP sends
|
||||
the rules to stdout and suppresses normal preprocessed output.
|
||||
|
||||
Another way to specify output of a @code{make} rule is by setting
|
||||
the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
|
||||
Variables}).
|
||||
|
||||
@item -MM
|
||||
Like @samp{-M} but the output mentions only the user header files
|
||||
included with @samp{#include "@var{file}"}. System header files
|
||||
included with @samp{#include <@var{file}>} are omitted.
|
||||
|
||||
@item -MD
|
||||
Like @samp{-M} but the dependency information is written to a file made by
|
||||
replacing ".c" with ".d" at the end of the input file names.
|
||||
This is in addition to compiling the file as specified---@samp{-MD} does
|
||||
not inhibit ordinary compilation the way @samp{-M} does.
|
||||
|
||||
In Mach, you can use the utility @code{md} to merge multiple dependency
|
||||
files into a single dependency file suitable for using with the @samp{make}
|
||||
command.
|
||||
|
||||
@item -MMD
|
||||
Like @samp{-MD} except mention only user header files, not system
|
||||
header files.
|
||||
|
||||
@item -MG
|
||||
Treat missing header files as generated files and assume they live in the
|
||||
same directory as the source file. If you specify @samp{-MG}, you
|
||||
must also specify either @samp{-M} or @samp{-MM}. @samp{-MG} is not
|
||||
supported with @samp{-MD} or @samp{-MMD}.
|
||||
@findex -MG
|
||||
When used with @samp{-M} or @samp{-MM}, @samp{-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
|
||||
@findex -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 @code{make} gives if you remove header
|
||||
files without updating the @code{Makefile} to match.
|
||||
|
||||
This is typical output:-
|
||||
|
||||
@smallexample
|
||||
/tmp/test.o: /tmp/test.c /tmp/test.h
|
||||
|
||||
/tmp/test.h:
|
||||
@end smallexample
|
||||
|
||||
@item -MQ @var{target}
|
||||
@item -MT @var{target}
|
||||
@findex -MQ
|
||||
@findex -MT
|
||||
By default CPP uses the main file name, including any path, and appends
|
||||
the object suffix, normally ``.o'', to it to obtain the name of the
|
||||
target for dependency generation. With @samp{-MT} you can specify a
|
||||
target yourself, overriding the default one.
|
||||
|
||||
If you want multiple targets, you can specify them as a single argument
|
||||
to @samp{-MT}, or use multiple @samp{-MT} options.
|
||||
|
||||
The targets you specify are output in the order they appear on the
|
||||
command line. @samp{-MQ} is identical to @samp{-MT}, except that the
|
||||
target name is quoted for Make, but with @samp{-MT} it isn't. For
|
||||
example, -MT '$(objpfx)foo.o' gives
|
||||
|
||||
@smallexample
|
||||
$(objpfx)foo.o: /tmp/foo.c
|
||||
@end smallexample
|
||||
|
||||
but -MQ '$(objpfx)foo.o' gives
|
||||
|
||||
@smallexample
|
||||
$$(objpfx)foo.o: /tmp/foo.c
|
||||
@end smallexample
|
||||
|
||||
The default target is automatically quoted, as if it were given with
|
||||
@samp{-MQ}.
|
||||
|
||||
@item -H
|
||||
Print the name of each header file used, in addition to other normal
|
||||
@ -3341,11 +3389,19 @@ Define macro @var{macro} with the string @samp{1} as its definition.
|
||||
Define macro @var{macro} as @var{defn}. All instances of @samp{-D} on
|
||||
the command line are processed before any @samp{-U} options.
|
||||
|
||||
Any @samp{-D} and @samp{-U} options on the command line are processed in
|
||||
order, and always before @samp{-imacros @var{file}}, regardless of the
|
||||
order in which they are written.
|
||||
|
||||
@item -U@var{macro}
|
||||
Undefine macro @var{macro}. @samp{-U} options are evaluated after all
|
||||
@samp{-D} options, but before any @samp{-include} and @samp{-imacros}
|
||||
options.
|
||||
|
||||
Any @samp{-D} and @samp{-U} options on the command line are processed in
|
||||
order, and always before @samp{-imacros @var{file}}, regardless of the
|
||||
order in which they are written.
|
||||
|
||||
@item -dM
|
||||
Tell the preprocessor to output only a list of the macro definitions
|
||||
that are in effect at the end of preprocessing. Used with the @samp{-E}
|
||||
@ -3359,8 +3415,54 @@ their proper sequence in the rest of the output.
|
||||
Like @samp{-dD} except that the macro arguments and contents are omitted.
|
||||
Only @samp{#define @var{name}} is included in the output.
|
||||
|
||||
@item -dI
|
||||
@findex -dI
|
||||
Output @samp{#include} directives in addition to the result of
|
||||
preprocessing.
|
||||
|
||||
@item -trigraphs
|
||||
Support ISO C trigraphs. The @samp{-ansi} option also has this effect.
|
||||
@findex -trigraphs
|
||||
Process ISO standard trigraph sequences. These are three-character
|
||||
sequences, all starting with @samp{??}, that are defined by ISO C to
|
||||
stand for single characters. For example, @samp{??/} stands for
|
||||
@samp{\}, so @samp{'??/n'} is a character constant for a newline. By
|
||||
default, GCC ignores trigraphs, but in standard-conforming modes it
|
||||
converts them. See the @samp{-std} and @samp{-ansi} options.
|
||||
|
||||
The nine trigraph sequences are
|
||||
@table @samp
|
||||
@item ??(
|
||||
-> @samp{[}
|
||||
|
||||
@item ??)
|
||||
-> @samp{]}
|
||||
|
||||
@item ??<
|
||||
-> @samp{@{}
|
||||
|
||||
@item ??>
|
||||
-> @samp{@}}
|
||||
|
||||
@item ??=
|
||||
-> @samp{#}
|
||||
|
||||
@item ??/
|
||||
-> @samp{\}
|
||||
|
||||
@item ??'
|
||||
-> @samp{^}
|
||||
|
||||
@item ??!
|
||||
-> @samp{|}
|
||||
|
||||
@item ??-
|
||||
-> @samp{~}
|
||||
|
||||
@end table
|
||||
|
||||
Trigraph support is not popular, so many compilers do not implement it
|
||||
properly. Portable code should not rely on trigraphs being either
|
||||
converted or ignored.
|
||||
|
||||
@item -Wp,@var{option}
|
||||
Pass @var{option} as an option to the preprocessor. If @var{option}
|
||||
|
Loading…
x
Reference in New Issue
Block a user