diff options
author | Joseph Myers <joseph@codesourcery.com> | 2011-03-22 22:19:01 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2011-03-22 22:19:01 +0000 |
commit | 66017846ecd165a4bbc8bd414adfee622551ccf5 (patch) | |
tree | e7a92293cb8f4b6b6d4cc0cf3576affafacecb3e /gcc/gcc.c | |
parent | e8b97ccd59010685e183b437b1f192e01e2809ad (diff) | |
download | gcc-66017846ecd165a4bbc8bd414adfee622551ccf5.tar.gz |
gcc.c (driver_unknown_option_callback): Only permit and save unknown -Wno- options.
* gcc.c (driver_unknown_option_callback): Only permit and save
unknown -Wno- options.
(driver_wrong_lang_callback): Save options directly instead of via
driver_unknown_option_callback.
From-SVN: r171307
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c index ef308e33dc3..e6ddf41afd2 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3080,16 +3080,24 @@ save_switch (const char *opt, size_t n_args, const char *const *args, } /* Handle an option DECODED that is unknown to the option-processing - machinery, but may be known to specs. */ + machinery. */ static bool driver_unknown_option_callback (const struct cl_decoded_option *decoded) { - save_switch (decoded->canonical_option[0], - decoded->canonical_option_num_elements - 1, - &decoded->canonical_option[1], false); - - return false; + const char *opt = decoded->arg; + if (opt[1] == 'W' && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-' + && !(decoded->errors & CL_ERR_NEGATIVE)) + { + /* Leave unknown -Wno-* options for the compiler proper, to be + diagnosed only if there are warnings. */ + save_switch (decoded->canonical_option[0], + decoded->canonical_option_num_elements - 1, + &decoded->canonical_option[1], false); + return false; + } + else + return true; } /* Handle an option DECODED that is not marked as CL_DRIVER. @@ -3110,7 +3118,9 @@ driver_wrong_lang_callback (const struct cl_decoded_option *decoded, error ("unrecognized command line option %qs", decoded->orig_option_with_args_text); else - driver_unknown_option_callback (decoded); + save_switch (decoded->canonical_option[0], + decoded->canonical_option_num_elements - 1, + &decoded->canonical_option[1], false); } /* Note that an option (index OPT_INDEX, argument ARG, value VALUE) |