summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-29 12:09:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-29 12:09:37 +0000
commita182c763a46274ab3896955e8628cd612cb85e93 (patch)
tree1cb6969668582a88e15febb0d2435a1ddd4ca215
parent581af848ad9bbb298ab10f264c7fd83f665aa1a9 (diff)
downloadgcc-a182c763a46274ab3896955e8628cd612cb85e93.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49315 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/c-decl.c2
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/lang-specs.h4
-rw-r--r--gcc/cppinit.c8
-rw-r--r--gcc/cpplib.h2
-rw-r--r--gcc/gcc.c21
-rw-r--r--gcc/objc/lang-specs.h4
9 files changed, 52 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 73370c32e8d..d201d87e3e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 2d21a43ca80..54ec18c8f19 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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"))
{
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 567cd40a704..92f5a4a96d6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 95f142731a6..70fcf452786 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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 */;
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index 67a3ecbe3e8..e48bf7436f1 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -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}\
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index c0f0348ff65..ab3dad78d90 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -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;
}
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 367491b226e..eeeecc0e3ae 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -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
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 62202058949..8968af6d0cf 100644
--- a/gcc/gcc.c
+++ b/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),
diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h
index 26f18f12886..2abf6337a59 100644
--- a/gcc/objc/lang-specs.h
+++ b/gcc/objc/lang-specs.h
@@ -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",