mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-18 10:00:35 +08:00
re PR other/1502 (Nonexistent -W options not diagnosed)
PR other/1502: * cppinit.c (cpp_handle_option): Add ignore argument, if it is zero, don't ignore unrecognized -W* options. (cpp_handle_options): Pass 1 as last argument to cpp_handle_option. * cpplib.h (cpp_handle_option): Adjust prototype. * c-decl.c (c_decode_options): Pass 0 as last argument to cpp_handle_option. PR c/2896: * gcc.c (cpp_unique_options): Split from cpp_options. (cpp_options): Source cpp_unique_options. (default_compilers): Use cpp_unique_options instead of cpp_options when used together with cc1_options. (static_specs): Add cpp_unique_options. * objc/lang-specs.h: Use cpp_unique_options instead of cpp_options when used together with cc1_options. * decl2.c (cxx_decode_option): Pass 0 as last argument to cpp_handle_option. * lang-specs.h: Use cpp_unique_options instead of cpp_options when used together with cc1_options. From-SVN: r49315
This commit is contained in:
parent
b8b98c66af
commit
ffdeea47b9
@ -1,3 +1,22 @@
|
||||
2002-01-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR other/1502:
|
||||
* cppinit.c (cpp_handle_option): Add ignore argument, if it is zero,
|
||||
don't ignore unrecognized -W* options.
|
||||
(cpp_handle_options): Pass 1 as last argument to cpp_handle_option.
|
||||
* cpplib.h (cpp_handle_option): Adjust prototype.
|
||||
* c-decl.c (c_decode_options): Pass 0 as last argument to
|
||||
cpp_handle_option.
|
||||
|
||||
PR c/2896:
|
||||
* gcc.c (cpp_unique_options): Split from cpp_options.
|
||||
(cpp_options): Source cpp_unique_options.
|
||||
(default_compilers): Use cpp_unique_options instead of cpp_options
|
||||
when used together with cc1_options.
|
||||
(static_specs): Add cpp_unique_options.
|
||||
* objc/lang-specs.h: Use cpp_unique_options instead of cpp_options
|
||||
when used together with cc1_options.
|
||||
|
||||
2002-01-29 Kazu Hirata <kazu@hxi.com>
|
||||
|
||||
* config/h8300/h8300-protos.h: Update the prototype of
|
||||
|
@ -463,7 +463,7 @@ c_decode_option (argc, argv)
|
||||
int strings_processed;
|
||||
char *p = argv[0];
|
||||
|
||||
strings_processed = cpp_handle_option (parse_in, argc, argv);
|
||||
strings_processed = cpp_handle_option (parse_in, argc, argv, 0);
|
||||
|
||||
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
|
||||
{
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* decl2.c (cxx_decode_option): Pass 0 as last argument to
|
||||
cpp_handle_option.
|
||||
* lang-specs.h: Use cpp_unique_options instead of cpp_options
|
||||
when used together with cc1_options.
|
||||
|
||||
2002-01-29 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/5132
|
||||
|
@ -493,7 +493,7 @@ cxx_decode_option (argc, argv)
|
||||
int strings_processed;
|
||||
const char *p = argv[0];
|
||||
|
||||
strings_processed = cpp_handle_option (parse_in, argc, argv);
|
||||
strings_processed = cpp_handle_option (parse_in, argc, argv, 0);
|
||||
|
||||
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
|
||||
/* ignore */;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Definitions for specs for C++.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
@ -49,7 +49,7 @@ Boston, MA 02111-1307, USA. */
|
||||
%{ansi:-D__STRICT_ANSI__ -trigraphs -$}\
|
||||
%(cpp_options) %b.ii \n}\
|
||||
cc1plus %{save-temps:-fpreprocessed %b.ii}\
|
||||
%{!save-temps:%(cpp_options)\
|
||||
%{!save-temps:%(cpp_unique_options)\
|
||||
%{!no-gcc:-D__GNUG__=%v1} \
|
||||
%{!Wno-deprecated:-D__DEPRECATED}\
|
||||
%{!fno-exceptions:-D__EXCEPTIONS}\
|
||||
|
@ -1317,12 +1317,14 @@ parse_option (input)
|
||||
|
||||
/* Handle one command-line option in (argc, argv).
|
||||
Can be called multiple times, to handle multiple sets of options.
|
||||
If ignore is non-zero, this will ignore unrecognized -W* options.
|
||||
Returns number of strings consumed. */
|
||||
int
|
||||
cpp_handle_option (pfile, argc, argv)
|
||||
cpp_handle_option (pfile, argc, argv, ignore)
|
||||
cpp_reader *pfile;
|
||||
int argc;
|
||||
char **argv;
|
||||
int ignore;
|
||||
{
|
||||
int i = 0;
|
||||
struct cpp_pending *pend = CPP_OPTION (pfile, pending);
|
||||
@ -1733,6 +1735,8 @@ cpp_handle_option (pfile, argc, argv)
|
||||
CPP_OPTION (pfile, warnings_are_errors) = 0;
|
||||
else if (!strcmp (argv[i], "-Wno-system-headers"))
|
||||
CPP_OPTION (pfile, warn_system_headers) = 0;
|
||||
else if (! ignore)
|
||||
return i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1754,7 +1758,7 @@ cpp_handle_options (pfile, argc, argv)
|
||||
|
||||
for (i = 0; i < argc; i += strings_processed)
|
||||
{
|
||||
strings_processed = cpp_handle_option (pfile, argc - i, argv + i);
|
||||
strings_processed = cpp_handle_option (pfile, argc - i, argv + i, 1);
|
||||
if (strings_processed == 0)
|
||||
break;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *));
|
||||
structure reliable. Options processing is not completed until you
|
||||
call cpp_finish_options. */
|
||||
extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
|
||||
extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
|
||||
extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **, int));
|
||||
extern void cpp_post_options PARAMS ((cpp_reader *));
|
||||
|
||||
/* This function reads the file, but does not start preprocessing. It
|
||||
|
21
gcc/gcc.c
21
gcc/gcc.c
@ -673,10 +673,9 @@ static const char *link_libgcc_spec = LINK_LIBGCC_SPEC;
|
||||
static const char *trad_capable_cpp =
|
||||
"%{traditional|ftraditional|traditional-cpp:trad}cpp0";
|
||||
|
||||
static const char *cpp_options =
|
||||
static const char *cpp_unique_options =
|
||||
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
|
||||
%{std*} %{nostdinc*}\
|
||||
%{C} %{v} %{I*} %{P} %{$} %I\
|
||||
%{nostdinc*} %{C} %{v} %{I*} %{P} %{$} %I\
|
||||
%{MD:-M -MF %W{!o: %b.d}%W{o*:%.d%*}}\
|
||||
%{MMD:-MM -MF %W{!o: %b.d}%W{o*:%.d%*}}\
|
||||
%{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{M|MD|MM|MMD:%{o*:-MQ %*}}\
|
||||
@ -686,12 +685,17 @@ static const char *cpp_options =
|
||||
%{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\
|
||||
%{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
|
||||
%{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
|
||||
%{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}}\
|
||||
%{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}} %{remap}\
|
||||
%{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
|
||||
%{E:%{!M*:%W{o*}}}";
|
||||
|
||||
/* This contains cpp options which are common with cc1_options and are passed
|
||||
only when preprocessing only to avoid duplication. */
|
||||
static const char *cpp_options =
|
||||
"%(cpp_unique_options) %{std*} %{d*} %{W*} %{w} %{pedantic*}\
|
||||
%{fshow-column} %{fno-show-column}\
|
||||
%{fleading-underscore} %{fno-leading-underscore}\
|
||||
%{fno-operator-names} %{ftabstop=*} %{remap}\
|
||||
%{g3:-dD} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*&U*&A*} %{i*} %Z %i\
|
||||
%{E:%{!M*:%W{o*}}}";
|
||||
%{fno-operator-names} %{ftabstop=*}";
|
||||
|
||||
/* NB: This is shared amongst all front-ends. */
|
||||
static const char *cc1_options =
|
||||
@ -840,7 +844,7 @@ static const struct compiler default_compilers[] =
|
||||
tradcpp0 -lang-c %{ansi:-std=c89} %(cpp_options) %{!pipe:%g.i} |\n\
|
||||
cc1 -fpreprocessed %{!pipe:%g.i} %(cc1_options)}\
|
||||
%{!traditional:%{!ftraditional:%{!traditional-cpp:\
|
||||
cc1 -lang-c %{ansi:-std=c89} %(cpp_options) %(cc1_options)}}}}\
|
||||
cc1 -lang-c %{ansi:-std=c89} %(cpp_unique_options) %(cc1_options)}}}}\
|
||||
%{!fsyntax-only:%(invoke_as)}}}}", 0},
|
||||
{"-",
|
||||
"%{!E:%e-E required when input is from standard input}\
|
||||
@ -1367,6 +1371,7 @@ static struct spec_list static_specs[] =
|
||||
INIT_STATIC_SPEC ("invoke_as", &invoke_as),
|
||||
INIT_STATIC_SPEC ("cpp", &cpp_spec),
|
||||
INIT_STATIC_SPEC ("cpp_options", &cpp_options),
|
||||
INIT_STATIC_SPEC ("cpp_unique_options", &cpp_unique_options),
|
||||
INIT_STATIC_SPEC ("trad_capable_cpp", &trad_capable_cpp),
|
||||
INIT_STATIC_SPEC ("cc1", &cc1_spec),
|
||||
INIT_STATIC_SPEC ("cc1_options", &cc1_options),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Definitions for specs for Objective-C.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
@ -35,7 +35,7 @@ Boston, MA 02111-1307, USA. */
|
||||
tradcpp0 -lang-objc %{ansi:-std=c89} %(cpp_options) %{!pipe:%g.mi} |\n\
|
||||
cc1obj -fpreprocessed %{!pipe:%g.mi} %(cc1_options) %{gen-decls}}\
|
||||
%{!traditional:%{!ftraditional:%{!traditional-cpp:\
|
||||
cc1obj %{ansi:-std=c89} %(cpp_options) %(cc1_options) %{gen-decls}}}}}\
|
||||
cc1obj %{ansi:-std=c89} %(cpp_unique_options) %(cc1_options) %{gen-decls}}}}}\
|
||||
%{!fsyntax-only:%(invoke_as)}}}}", 0},
|
||||
{".mi", "@objc-cpp-output", 0},
|
||||
{"@objc-cpp-output",
|
||||
|
Loading…
x
Reference in New Issue
Block a user