Commit e582248c by Neil Booth Committed by Neil Booth

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
parent 7894cb27
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> 2001-01-09 Bernd Schmidt <bernds@redhat.com>
* sh.md (reload_outsf): Generate recognizable patterns for * sh.md (reload_outsf): Generate recognizable patterns for
......
...@@ -3092,7 +3092,8 @@ cpp [@samp{-P}] [@samp{-C}] [@samp{-gcc}] [@samp{-traditional}] ...@@ -3092,7 +3092,8 @@ cpp [@samp{-P}] [@samp{-C}] [@samp{-gcc}] [@samp{-traditional}]
[@samp{-W}@var{warn}...] [@samp{-I}@var{dir}...] [@samp{-W}@var{warn}...] [@samp{-I}@var{dir}...]
[@samp{-D}@var{macro}[=@var{defn}]...] [@samp{-U}@var{macro}] [@samp{-D}@var{macro}[=@var{defn}]...] [@samp{-U}@var{macro}]
[@samp{-A}@var{predicate}(@var{answer})] [@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}] [@samp{-x} @var{language}] [@samp{-std=}@var{standard}]
@var{infile} @var{outfile} @var{infile} @var{outfile}
...@@ -3347,6 +3348,9 @@ Do not search the standard system directories for header files. ...@@ -3347,6 +3348,9 @@ Do not search the standard system directories for header files.
Only the directories you have specified with @samp{-I} options Only the directories you have specified with @samp{-I} options
(and the current directory, if appropriate) are searched. (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++ @item -nostdinc++
@findex -nostdinc++ @findex -nostdinc++
Do not search for header files in the C++-specific standard directories, 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 ...@@ -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 one @samp{-D} for the same @var{name}, the rightmost definition takes
effect. 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} @item -U @var{name}
@findex -U @findex -U
Do not predefine @var{name}. If both @samp{-U} and @samp{-D} are Do not predefine @var{name}.
specified for one name, whichever one appears later on the command line
wins. 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 @item -undef
@findex -undef @findex -undef
...@@ -3436,7 +3446,7 @@ Like @samp{-dD}, but emit only the macro names, not their expansions. ...@@ -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 Output @samp{#include} directives in addition to the result of
preprocessing. preprocessing.
@item -M [-MG] @item -M
@findex -M @findex -M
Instead of outputting the result of preprocessing, output a rule Instead of outputting the result of preprocessing, output a rule
suitable for @code{make} describing the dependencies of the main source 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 ...@@ -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 included files. If there are many included files then the rule is split
into several lines using @samp{\}-newline. into several lines using @samp{\}-newline.
@samp{-MG} says to treat missing header files as generated files and @item -MM
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]
@findex -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}"}. System header files included with @samp{#include
<@var{file}>} are omitted. <@var{file}>} are omitted.
@item -MD @var{file} @item -MF @var{file}
@findex -MD @findex -MF
Like @samp{-M} but the dependency information is written to @var{file}. When used with @samp{-M} or @samp{-MM}, specifies a file to write the
This is in addition to compiling the file as specified --- @samp{-MD} dependencies to. This allows the preprocessor to write the preprocessed
does not inhibit ordinary compilation the way @samp{-M} does. 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.
In Mach, you can use the utility @code{md} to merge multiple dependency @item -MG
files into a single dependency file suitable for using with the @findex -MG
@samp{make} command. 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.
@item -MMD @var{file} This feature is used in automatic updating of makefiles.
@findex -MMD
Like @samp{-MD} except mention only user header files, not system
header files.
@item -MP @item -MP
@findex -MP @findex -MP
This option instructs CPP to add a phony target for each dependency This option instructs CPP to add a phony target for each dependency
other than the main file, causing each to depend on nothing. These other than the main file, causing each to depend on nothing. These
dummy rules work around errors MAKE gives if you remove header files dummy rules work around errors @code{make} gives if you remove header
without updating the Makefile to match. files without updating the @code{Makefile} to match.
This is typical output:- This is typical output:-
...@@ -3493,8 +3494,8 @@ This is typical output:- ...@@ -3493,8 +3494,8 @@ This is typical output:-
@item -MQ @var{target} @item -MQ @var{target}
@item -MT @var{target} @item -MT @var{target}
@findex -MT
@findex -MQ @findex -MQ
@findex -MT
By default CPP uses the main file name, including any path, and appends 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 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 for dependency generation. With @samp{-MT} you can specify a
......
...@@ -1042,9 +1042,11 @@ new_pending_directive (pend, text, handler) ...@@ -1042,9 +1042,11 @@ new_pending_directive (pend, text, handler)
DEF_OPT("H", 0, OPT_H) \ DEF_OPT("H", 0, OPT_H) \
DEF_OPT("I", no_dir, OPT_I) \ DEF_OPT("I", no_dir, OPT_I) \
DEF_OPT("M", 0, OPT_M) \ DEF_OPT("M", 0, OPT_M) \
DEF_OPT("MD", no_fil, OPT_MD) \
DEF_OPT("MF", no_fil, OPT_MF) \ DEF_OPT("MF", no_fil, OPT_MF) \
DEF_OPT("MG", 0, OPT_MG) \ DEF_OPT("MG", 0, OPT_MG) \
DEF_OPT("MM", 0, OPT_MM) \ DEF_OPT("MM", 0, OPT_MM) \
DEF_OPT("MMD", no_fil, OPT_MMD) \
DEF_OPT("MP", 0, OPT_MP) \ DEF_OPT("MP", 0, OPT_MP) \
DEF_OPT("MQ", no_tgt, OPT_MQ) \ DEF_OPT("MQ", no_tgt, OPT_MQ) \
DEF_OPT("MT", no_tgt, OPT_MT) \ DEF_OPT("MT", no_tgt, OPT_MT) \
...@@ -1461,6 +1463,21 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1461,6 +1463,21 @@ cpp_handle_option (pfile, argc, argv)
deps_add_target (pfile->deps, arg, opt_code == OPT_MQ); deps_add_target (pfile->deps, arg, opt_code == OPT_MQ);
break; 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: case OPT_A:
if (arg[0] == '-') if (arg[0] == '-')
{ {
...@@ -1673,12 +1690,13 @@ cpp_post_options (pfile) ...@@ -1673,12 +1690,13 @@ cpp_post_options (pfile)
set its callbacks correctly before calling cpp_start_read. */ set its callbacks correctly before calling cpp_start_read. */
init_dependency_output (pfile); init_dependency_output (pfile);
/* -MG doesn't select the form of output and must be specified with /* After checking the environment variables, check if -M or -MM has
one of -M or -MM. -MG doesn't make sense unless preprocessed not been specified, but other -M options have. */
output (and compilation) is inhibited. */ if (CPP_OPTION (pfile, print_deps) == 0 &&
if (CPP_OPTION (pfile, print_deps_missing_files) (CPP_OPTION (pfile, print_deps_missing_files)
&& CPP_OPTION (pfile, print_deps) == 0) || CPP_OPTION (pfile, deps_file)
cpp_fatal (pfile, "-MG must be specified with one of -M or -MM"); || CPP_OPTION (pfile, deps_phony_targets)))
cpp_fatal (pfile, "you must additionally specify either -M or -MM");
} }
/* Set up dependency-file output. */ /* Set up dependency-file output. */
...@@ -1726,10 +1744,12 @@ init_dependency_output (pfile) ...@@ -1726,10 +1744,12 @@ init_dependency_output (pfile)
CPP_OPTION (pfile, print_deps_append) = 1; CPP_OPTION (pfile, print_deps_append) = 1;
} }
/* If dependencies go to standard output, we need to suppress /* If dependencies go to standard output, or -MG is used, we should
output. The user may be requesting other stuff to stdout, with suppress output. The user may be requesting other stuff to
-dM, -v etc. We let them shoot themselves in the foot. */ stdout, with -dM, -v etc. We let them shoot themselves in the
if (CPP_OPTION (pfile, deps_file) == 0) foot. */
if (CPP_OPTION (pfile, deps_file) == 0
|| CPP_OPTION (pfile, print_deps_missing_files))
CPP_OPTION (pfile, no_output) = 1; CPP_OPTION (pfile, no_output) = 1;
} }
......
...@@ -255,14 +255,15 @@ in the following sections. ...@@ -255,14 +255,15 @@ in the following sections.
@item Preprocessor Options @item Preprocessor Options
@xref{Preprocessor Options,,Options Controlling the Preprocessor}. @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
@smallexample @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 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H
-idirafter @var{dir} -idirafter @var{dir}
-include @var{file} -imacros @var{file} -include @var{file} -imacros @var{file}
-iprefix @var{file} -iwithprefix @var{dir} -iprefix @var{file} -iwithprefix @var{dir}
-iwithprefixbefore @var{dir} -isystem @var{dir} -isystem-c++ @var{dir} -iwithprefixbefore @var{dir} -isystem @var{dir} -isystem-c++ @var{dir}
-M -MD -MM -MMD -MG -nostdinc -P -trigraphs -M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap
-undef -U@var{macro} -Wp,@var{option} -trigraphs -undef -U@var{macro} -Wp,@var{option}
@end smallexample @end smallexample
@item Assembler Option @item Assembler Option
...@@ -3222,12 +3223,8 @@ Process @var{file} as input, discarding the resulting output, before ...@@ -3222,12 +3223,8 @@ Process @var{file} as input, discarding the resulting output, before
processing the regular input file. Because the output generated from processing the regular input file. Because the output generated from
@var{file} is discarded, the only effect of @samp{-imacros @var{file}} @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 is to make the macros defined in @var{file} available for use in the
main input. main input. All the @samp{-include} and @samp{-imacros} options are
processed in the order in which they are written.
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.
@item -idirafter @var{dir} @item -idirafter @var{dir}
@cindex second include path @cindex second include path
...@@ -3266,6 +3263,15 @@ Options}, for information on @samp{-I}. ...@@ -3266,6 +3263,15 @@ Options}, for information on @samp{-I}.
By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
search path to only those directories you specify explicitly. 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 @item -undef
Do not predefine any nonstandard macros. (Including architecture flags). Do not predefine any nonstandard macros. (Including architecture flags).
...@@ -3285,44 +3291,86 @@ Used with the @samp{-E} option. ...@@ -3285,44 +3291,86 @@ Used with the @samp{-E} option.
@cindex make @cindex make
@cindex dependencies, make @cindex dependencies, make
@item -M @item -M
Tell the preprocessor to output a rule suitable for @code{make} @findex -M
describing the dependencies of each object file. For each source file, Instead of outputting the result of preprocessing, output a rule
the preprocessor outputs one @code{make}-rule whose target is the object suitable for @code{make} describing the dependencies of the main source
file name for that source file and whose dependencies are all the file. The preprocessor outputs one @code{make} rule containing the
@code{#include} header files it uses. This rule may be a single line or object file name for that source file, a colon, and the names of all the
may be continued with @samp{\}-newline if it is long. The list of rules included files. If there are many included files then the rule is split
is printed on standard output instead of the preprocessed C program. into several lines using @samp{\}-newline.
@samp{-M} implies @samp{-E}. @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 Another way to specify output of a @code{make} rule is by setting
the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
Variables}). 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 @item -MG
Treat missing header files as generated files and assume they live in the @findex -MG
same directory as the source file. If you specify @samp{-MG}, you When used with @samp{-M} or @samp{-MM}, @samp{-MG} says to treat missing
must also specify either @samp{-M} or @samp{-MM}. @samp{-MG} is not header files as generated files and assume they live in the same
supported with @samp{-MD} or @samp{-MMD}. 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 @item -H
Print the name of each header file used, in addition to other normal 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. ...@@ -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 Define macro @var{macro} as @var{defn}. All instances of @samp{-D} on
the command line are processed before any @samp{-U} options. 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} @item -U@var{macro}
Undefine macro @var{macro}. @samp{-U} options are evaluated after all Undefine macro @var{macro}. @samp{-U} options are evaluated after all
@samp{-D} options, but before any @samp{-include} and @samp{-imacros} @samp{-D} options, but before any @samp{-include} and @samp{-imacros}
options. 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 @item -dM
Tell the preprocessor to output only a list of the macro definitions 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} 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. ...@@ -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. Like @samp{-dD} except that the macro arguments and contents are omitted.
Only @samp{#define @var{name}} is included in the output. 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 @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} @item -Wp,@var{option}
Pass @var{option} as an option to the preprocessor. If @var{option} Pass @var{option} as an option to the preprocessor. If @var{option}
......
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