From a55b23646ff646bcee211963e5676a00304714ff Mon Sep 17 00:00:00 2001 From: mrs Date: Wed, 5 May 2004 12:20:33 +0000 Subject: [PATCH] * doc/invoke.texi (Directory Options): Document -iquote. * doc/cpp.texi: Likewise. * doc/cppopts.texi: Likewise. * c-opts.c (c_common_missing_argument): Add -iquote processing. (c_common_handle_option): Likewise. * c.opt (iquote): Add. * gcc.h (DEFAULT_WORD_SWITCH_TAKES_ARG): Add -iquote. * c-incpath.c (merge_include_chains): Update comment to use -iquote. * c-opts.c (case OPT_I): Deprecate -I- support. * doc/invoke.texi: Likewise. * doc/cpp.texi: Likewise. * doc/cppopts.texi: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81521 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 +++++++++++++++ gcc/c-incpath.c | 8 +++++--- gcc/c-opts.c | 6 ++++++ gcc/c.opt | 6 +++++- gcc/doc/cpp.texi | 26 +++++++++++++++++-------- gcc/doc/cppopts.texi | 11 +++++++++++ gcc/doc/invoke.texi | 55 ++++++++++++++++++++++++++++++---------------------- gcc/gcc.h | 4 ++-- 8 files changed, 95 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 147f1c7..9306c4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2004-05-3 Mike Stump + + * doc/invoke.texi (Directory Options): Document -iquote. + * doc/cpp.texi: Likewise. + * doc/cppopts.texi: Likewise. + * c-opts.c (c_common_missing_argument): Add -iquote processing. + (c_common_handle_option): Likewise. + * c.opt (iquote): Add. + * gcc.h (DEFAULT_WORD_SWITCH_TAKES_ARG): Add -iquote. + * c-incpath.c (merge_include_chains): Update comment to use -iquote. + + * c-opts.c (case OPT_I): Deprecate -I- support. + * doc/invoke.texi: Likewise. + * doc/cpp.texi: Likewise. + * doc/cppopts.texi: Likewise. + 2004-05-05 Steven Bosscher * basic-block.h (free_basic_block_vars): Update prototype. diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c index 167b05a..b4da86f 100644 --- a/gcc/c-incpath.c +++ b/gcc/c-incpath.c @@ -171,6 +171,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, int cxx_stdinc) JOIN, unless it duplicates JOIN in which case the last path is removed. Return the head of the resulting chain. Any of HEAD, JOIN and SYSTEM can be NULL. */ + static struct cpp_dir * remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, struct cpp_dir *system, struct cpp_dir *join, @@ -243,9 +244,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, We can't just merge the lists and then uniquify them because then we may lose directories from the <> search path that should be - there; consider -Ifoo -Ibar -I- -Ifoo -Iquux. It is however safe - to treat -Ibar -Ifoo -I- -Ifoo -Iquux as if written -Ibar -I- -Ifoo - -Iquux. */ + there; consider -iquote foo -iquote bar -Ifoo -Iquux. It is + however safe to treat -iquote bar -iquote foo -Ifoo -Iquux as if + written -iquote bar -Ifoo -Iquux. */ + static void merge_include_chains (cpp_reader *pfile, int verbose) { diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 9acdf6f..8dc308c 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -162,6 +162,7 @@ c_common_missing_argument (const char *opt, size_t code) case OPT_idirafter: case OPT_isysroot: case OPT_isystem: + case OPT_iquote: error ("missing path after \"%s\"", opt); break; @@ -303,6 +304,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) error ("-I- specified twice"); quote_chain_split = true; split_quote_chain (); + inform ("obsolete option -I- used, please use -iquote instead"); } break; @@ -954,6 +956,10 @@ c_common_handle_option (size_t scode, const char *arg, int value) iprefix = arg; break; + case OPT_iquote: + add_path (xstrdup (arg), QUOTE, 0); + break; + case OPT_isysroot: sysroot = arg; break; diff --git a/gcc/c.opt b/gcc/c.opt index e862770..83dc98d 100644 --- a/gcc/c.opt +++ b/gcc/c.opt @@ -103,7 +103,7 @@ Print the name of header files as they are used I C ObjC C++ ObjC++ Joined Separate --I Add to the end of the main include path. -I- gives more include path control; see info documentation +-I Add to the end of the main include path M C ObjC C++ ObjC++ @@ -720,6 +720,10 @@ isystem C ObjC C++ ObjC++ Joined Separate -isystem Add to the start of the system include path +iquote +C ObjC C++ ObjC++ Joined Separate +-iquote Add to the end of the quote include path + iwithprefix C ObjC C++ ObjC++ Joined Separate -iwithprefix Add to the end of the system include path diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 5d1cb9b..3996582 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -759,9 +759,11 @@ named @var{file} in a standard list of system directories. You can prepend directories to this list with the @option{-I} option (@pxref{Invocation}). @item #include "@var{file}" -This variant is used for header files of your own program. It searches -for a file named @var{file} first in the directory containing the -current file, then in the same directories used for @code{<@var{file}>}. +This variant is used for header files of your own program. It +searches for a file named @var{file} first in the directory containing +the current file, then in the quote directories and then the same +directories used for @code{<@var{file}>}. You can prepend directories +to the list of quote directories with the @option{-iquote} option. @end table The argument of @samp{#include}, whether delimited with quote marks or @@ -883,9 +885,10 @@ standard C library facilities, or the standard C library itself. @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 -places it would have looked for a header requested with angle brackets. -For example, if @file{/usr/include/sys/stat.h} contains +first in the directory containing the current file, then in the +directories as specified by @option{-iquote} options, then in the same +places it would have looked for a header requested with angle +brackets. 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. @@ -898,7 +901,8 @@ This has two effects. First, directories appearing before the quote marks. Directories after @option{-I-} are searched for all headers. Second, the directory containing the current file is not searched for anything, unless it happens to be one of the directories -named by an @option{-I} switch. +named by an @option{-I} switch. @option{-I-} is deprecated, -iquote +should be used instead. @option{-I. -I-} is not the same as no @option{-I} options at all, and does not cause the same behavior for @samp{<>} includes that @samp{""} @@ -4039,6 +4043,11 @@ they generally represent bugs in the snapshots. @itemize @bullet +@item -I- deprecated + +This option has been deprecated in 3.5. @option{-iquote} is meant to +replace the need for this option. + @item Order of evaluation of @samp{#} and @samp{##} operators The standard does not specify the order of evaluation of a chain of @@ -4131,7 +4140,8 @@ without notice. @ignore @c man begin SYNOPSIS cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] - [@option{-I}@var{dir}@dots{}] [@option{-W}@var{warn}@dots{}] + [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}] + [@option{-W}@var{warn}@dots{}] [@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}] [@option{-MP}] [@option{-MQ} @var{target}@dots{}] [@option{-MT} @var{target}@dots{}] diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index 686de1d..468f17f 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -400,6 +400,7 @@ file directory as the first search directory for @code{@w{#include @ifset cppmanual @xref{Search Path}. @end ifset +This option has been deprecated. @item -nostdinc @opindex nostdinc @@ -466,6 +467,16 @@ is applied to the standard system directories. @xref{System Headers}. @end ifset +@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 + @item -fdollars-in-identifiers @opindex fdollars-in-identifiers @anchor{fdollars-in-identifiers} diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6161c18..44d621d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -328,7 +328,7 @@ in the following sections. @item Directory Options @xref{Directory Options,,Options for Directory Search}. -@gccoptlist{-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}} +@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} -specs=@var{file} -I-} @item Target Options @c I wrote this xref this way to avoid overfull hbox. -- rms @@ -5263,28 +5263,12 @@ the ordering for the include_next directive are not inadvertently changed. If you really need to change the search order for system directories, use the @option{-nostdinc} and/or @option{-isystem} options. -@item -I- -@opindex I- -Any directories you specify with @option{-I} options before the @option{-I-} -option are searched only for the case of @samp{#include "@var{file}"}; -they are not searched for @samp{#include <@var{file}>}. - -If additional directories are specified with @option{-I} options after -the @option{-I-}, these directories are searched for all @samp{#include} -directives. (Ordinarily @emph{all} @option{-I} directories are used -this way.) - -In addition, the @option{-I-} option inhibits the use of the current -directory (where the current input file came from) as the first search -directory for @samp{#include "@var{file}"}. There is no way to -override this effect of @option{-I-}. With @option{-I.} you can specify -searching the directory which was current when the compiler was -invoked. That is not exactly the same as what the preprocessor does -by default, but it is often satisfactory. - -@option{-I-} does not inhibit the use of the standard system directories -for header files. Thus, @option{-I-} and @option{-nostdinc} are -independent. +@item -iquote@var{dir} +@opindex iquote +Add the directory @var{dir} to the head of the list of directories to +be searched for header files only for the case of @samp{#include +"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, +otherwise just like @option{-I}. @item -L@var{dir} @opindex L @@ -5342,6 +5326,31 @@ program uses when determining what switches to pass to @file{cc1}, @file{cc1plus}, @file{as}, @file{ld}, etc. More than one @option{-specs=@var{file}} can be specified on the command line, and they are processed in order, from left to right. + +@item -I- +@opindex I- +This option has been deprecated. Please use @option{-iquote} instead for +@option{-I} directories before the @option{-I-} and remove the @option{-I-}. +Any directories you specify with @option{-I} options before the @option{-I-} +option are searched only for the case of @samp{#include "@var{file}"}; +they are not searched for @samp{#include <@var{file}>}. + +If additional directories are specified with @option{-I} options after +the @option{-I-}, these directories are searched for all @samp{#include} +directives. (Ordinarily @emph{all} @option{-I} directories are used +this way.) + +In addition, the @option{-I-} option inhibits the use of the current +directory (where the current input file came from) as the first search +directory for @samp{#include "@var{file}"}. There is no way to +override this effect of @option{-I-}. With @option{-I.} you can specify +searching the directory which was current when the compiler was +invoked. That is not exactly the same as what the preprocessor does +by default, but it is often satisfactory. + +@option{-I-} does not inhibit the use of the standard system directories +for header files. Thus, @option{-I-} and @option{-nostdinc} are +independent. @end table @c man end diff --git a/gcc/gcc.h b/gcc/gcc.h index 9df9ffd..f5a04d3 100644 --- a/gcc/gcc.h +++ b/gcc/gcc.h @@ -48,8 +48,8 @@ struct spec_function || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \ || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \ || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \ - || !strcmp (STR, "isystem") || !strcmp (STR, "-param") \ - || !strcmp (STR, "specs") \ + || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \ + || !strcmp (STR, "-param") || !strcmp (STR, "specs") \ || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ")) -- 2.7.4