summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2017-08-16 12:24:50 +0000
committerMarc Espie <espie@cvs.openbsd.org>2017-08-16 12:24:50 +0000
commite547a8ea8a2ec60ecd833f0b46d088a2a4042c4a (patch)
treea1b364da7af38adcc32973f626113a81c6df58d3
parentbbaeeb2a2254803c0bd02e33f2b13e6041e57a22 (diff)
have -Wno-* work the same on gcc3 as well.
old patch, belated test by aoyama@, okay aoyama@
-rw-r--r--gnu/usr.bin/gcc/gcc/c-opts.c18
-rw-r--r--gnu/usr.bin/gcc/gcc/toplev.c7
2 files changed, 23 insertions, 2 deletions
diff --git a/gnu/usr.bin/gcc/gcc/c-opts.c b/gnu/usr.bin/gcc/gcc/c-opts.c
index 193b6f16f1b..d20dec4cf5c 100644
--- a/gnu/usr.bin/gcc/gcc/c-opts.c
+++ b/gnu/usr.bin/gcc/gcc/c-opts.c
@@ -520,6 +520,15 @@ c_common_init_options (lang)
warn_sign_compare = -1;
}
+static char *bad_option;
+
+void
+do_final_options ()
+{
+ if (bad_option)
+ error ("unrecognized command line option %s", bad_option);
+}
+
/* Handle one command-line option in (argc, argv).
Can be called multiple times, to handle multiple sets of options.
Returns number of strings consumed. */
@@ -576,7 +585,14 @@ c_common_decode_option (argc, argv)
lang_flag = lang_flags[(c_language << 1) + flag_objc];
opt_index = find_opt (opt + 1, lang_flag);
if (opt_index == N_OPTS)
- goto done;
+ {
+ if (result == 0 && !on && opt[1] == 'W')
+ {
+ bad_option = argv[0];
+ result = 1;
+ }
+ goto done;
+ }
result = 1;
option = &cl_options[opt_index];
diff --git a/gnu/usr.bin/gcc/gcc/toplev.c b/gnu/usr.bin/gcc/gcc/toplev.c
index 673b3d31346..ed64a04c528 100644
--- a/gnu/usr.bin/gcc/gcc/toplev.c
+++ b/gnu/usr.bin/gcc/gcc/toplev.c
@@ -5519,6 +5519,8 @@ do_compile ()
It is not safe to call this function more than once. */
+extern void do_final_options ();
+
int
toplev_main (argc, argv)
int argc;
@@ -5536,7 +5538,10 @@ toplev_main (argc, argv)
do_compile ();
if (errorcount || sorrycount)
- return (FATAL_EXIT_CODE);
+ {
+ do_final_options ();
+ return (FATAL_EXIT_CODE);
+ }
return (SUCCESS_EXIT_CODE);
}