diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-07 17:54:11 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-07 17:54:11 +0000 |
commit | 45efa6b955cb4a928d259f5835b4813c3e1a83c2 (patch) | |
tree | c5bbf1972f8b8352a6aade708eabaa4fab6c6328 /gcc/c-family/c-opts.c | |
parent | 0e4e775a957d392e5c78a684004f2b82bbc3beff (diff) | |
download | gcc-45efa6b955cb4a928d259f5835b4813c3e1a83c2.tar.gz |
c-family/
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* c.opt(Warray-bounds,Wdelete-non-virtual-dtor,Wenum-compare,
Wmain,Woverlength-strings, Wunknown-pragmas,Wunused-macros):
Use LangEnabledBy.
(Wswitch,Wswitch-default,Wswitch-enum): Likewise. Move here from
common.opt.
(Wvariadic-macros): Init(1).
* c-opts.c (c_common_handle_option): Do not handle them
explicitly.
(c_common_post_options): Likewise.
(sanitize_cpp_opts): warn_unused_macros is now
cpp_warn_unused_macros.
(push_command_line_include): Likewise.
* c-common.c (warn_unknown_pragmas): Do not define.
* c-common.h (warn_unknown_pragmas): Do not declare.
gcc/
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* common.opt (Wswitch,Wswitch-default,Wswitch-enum): Move to c.opt.
fortran/
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* options.c (set_Wall): Do not set warn_switch here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-opts.c')
-rw-r--r-- | gcc/c-family/c-opts.c | 66 |
1 files changed, 10 insertions, 56 deletions
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index b420d2a2cc1..6fedd1e7502 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -96,12 +96,6 @@ static bool std_cxx_inc = true; /* If the quote chain has been split by -I-. */ static bool quote_chain_split; -/* If -Wunused-macros. */ -static bool warn_unused_macros; - -/* If -Wvariadic-macros. */ -static bool warn_variadic_macros = true; - /* Number of deferred options. */ static size_t deferred_count; @@ -365,26 +359,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, case OPT_Wall: /* ??? Don't add new options here. Use LangEnabledBy in c.opt. */ set_Wformat (value); - warn_switch = value; - warn_array_bounds = value; - - /* Only warn about unknown pragmas that are not in system - headers. */ - warn_unknown_pragmas = value; - - if (!c_dialect_cxx ()) - { - /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding - can turn it off only if it's not explicit. */ - if (warn_main == -1) - warn_main = (value ? 2 : 0); - - /* In C, -Wall and -Wc++-compat turns on -Wenum-compare, - which we do here. In C++ it is on by default, which is - done in c_common_post_options. */ - if (warn_enum_compare == -1) - warn_enum_compare = value; - } cpp_opts->warn_trigraphs = value; cpp_opts->warn_comments = value; @@ -400,10 +374,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_Wc___compat: - /* Because -Wenum-compare is the default in C++, -Wc++-compat - implies -Wenum-compare. */ - if (warn_enum_compare == -1 && value) - warn_enum_compare = value; cpp_opts->warn_cxx_operator_names = value; break; @@ -480,22 +450,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, case OPT_Wunknown_pragmas: /* Set to greater than 1, so that even unknown pragmas in system headers will be warned about. */ + /* ??? There is no way to handle this automatically for now. */ warn_unknown_pragmas = value * 2; break; - case OPT_Wunused_macros: - warn_unused_macros = value; - break; - - case OPT_Wvariadic_macros: - warn_variadic_macros = value; - break; - - case OPT_Weffc__: - if (value) - warn_nonvdtor = true; - break; - case OPT_ansi: if (!c_dialect_cxx ()) set_std_c89 (false, true); @@ -692,10 +650,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, case OPT_Wpedantic: cpp_opts->cpp_pedantic = 1; cpp_opts->warn_endif_labels = 1; - if (warn_overlength_strings == -1) - warn_overlength_strings = 1; - if (warn_main == -1) - warn_main = 2; break; case OPT_print_objc_runtime_info: @@ -883,21 +837,21 @@ c_common_post_options (const char **pfilename) /* -Woverlength-strings is off by default, but is enabled by -Wpedantic. It is never enabled in C++, as the minimum limit is not normative in that standard. */ - if (warn_overlength_strings == -1 || c_dialect_cxx ()) + if (c_dialect_cxx ()) warn_overlength_strings = 0; /* Wmain is enabled by default in C++ but not in C. */ /* Wmain is disabled by default for -ffreestanding (!flag_hosted), - even if -Wall was given (warn_main will be 2 if set by -Wall, 1 - if set by -Wmain). */ + even if -Wall or -Wpedantic was given (warn_main will be 2 if set + by -Wall, 1 if set by -Wmain). */ if (warn_main == -1) warn_main = (c_dialect_cxx () && flag_hosted) ? 1 : 0; else if (warn_main == 2) warn_main = flag_hosted ? 1 : 0; - /* In C, -Wall and -Wc++-compat enable -Wenum-compare, which we do - in c_common_handle_option; if it has not yet been set, it is - disabled by default. In C++, it is enabled by default. */ + /* In C, -Wall and -Wc++-compat enable -Wenum-compare; if it has not + yet been set, it is disabled by default. In C++, it is enabled + by default. */ if (warn_enum_compare == -1) warn_enum_compare = c_dialect_cxx () ? 1 : 0; @@ -1228,7 +1182,7 @@ sanitize_cpp_opts (void) /* Similarly with -Wno-variadic-macros. No check for c99 here, since this also turns off warnings about GCCs extension. */ cpp_opts->warn_variadic_macros - = warn_variadic_macros && (pedantic || warn_traditional); + = cpp_warn_variadic_macros && (pedantic || warn_traditional); /* If we're generating preprocessor output, emit current directory if explicitly requested or if debugging information is enabled. @@ -1239,7 +1193,7 @@ sanitize_cpp_opts (void) if (cpp_opts->directives_only) { - if (warn_unused_macros) + if (cpp_warn_unused_macros) error ("-fdirectives-only is incompatible with -Wunused_macros"); if (cpp_opts->traditional) error ("-fdirectives-only is incompatible with -traditional"); @@ -1382,7 +1336,7 @@ push_command_line_include (void) { include_cursor++; /* -Wunused-macros should only warn about macros defined hereafter. */ - cpp_opts->warn_unused_macros = warn_unused_macros; + cpp_opts->warn_unused_macros = cpp_warn_unused_macros; /* Restore the line map from <command line>. */ if (!cpp_opts->preprocessed) cpp_change_file (parse_in, LC_RENAME, this_input_filename); |