diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-19 05:34:31 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-19 05:34:31 +0000 |
commit | 806fe15ec1838389137de157d0f484177a3cbc5e (patch) | |
tree | edb34abe06088024ce40380f1b5573f991d29584 /gcc/c/c-decl.c | |
parent | 88943ddeb3caf4af541d5f58f81d0e5d23da1281 (diff) | |
download | gcc-806fe15ec1838389137de157d0f484177a3cbc5e.tar.gz |
gcc/c-family/
* c-opts.c (sanitize_cpp_opts): Make warn_long_long be set according
to warn_c90_c99_compat.
* c.opt (Wc90-c99-compat, Wdeclaration-after-statement): Initialize
to -1.
gcc/c/
* c-decl.c (warn_variable_length_array): Pass OPT_Wvla unconditionally
to pedwarn_c90.
* c-errors.c: Include "opts.h".
(pedwarn_c90): Rewrite to handle -Wno-c90-c99-compat better.
* c-parser.c (disable_extension_diagnostics): Handle negative value
of warn_c90_c99_compat, too.
(restore_extension_diagnostics): Likewise.
(c_parser_compound_statement_nostart): Pass
OPT_Wdeclaration_after_statement unconditionally to pedwarn_c90.
gcc/testsuite/
* gcc.dg/Wc90-c99-compat-4.c: Remove all dg-warnings.
* gcc.dg/Wc90-c99-compat-5.c: Remove all dg-errors.
* gcc.dg/Wc90-c99-compat-7.c: New test.
* gcc.dg/Wc90-c99-compat-8.c: New test.
* gcc.dg/Wdeclaration-after-statement-4.c: New test.
libcpp/
* charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat.
* lex.c (_cpp_lex_direct): Likewise.
* macro.c (replace_args): Likewise.
(parse_params): Likewise.
* include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat
to char.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214131 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7ba35bf7e09..138b0142b9b 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4920,27 +4920,23 @@ check_bitfield_type_and_width (tree *type, tree *width, tree orig_name) static void warn_variable_length_array (tree name, tree size) { - int const_size = TREE_CONSTANT (size); - enum opt_code opt = (warn_vla == -1 && !warn_c90_c99_compat) - ? OPT_Wpedantic : OPT_Wvla; - - if (const_size) + if (TREE_CONSTANT (size)) { if (name) - pedwarn_c90 (input_location, opt, + pedwarn_c90 (input_location, OPT_Wvla, "ISO C90 forbids array %qE whose size " "can%'t be evaluated", name); else - pedwarn_c90 (input_location, opt, "ISO C90 forbids array " + pedwarn_c90 (input_location, OPT_Wvla, "ISO C90 forbids array " "whose size can%'t be evaluated"); } else { if (name) - pedwarn_c90 (input_location, opt, + pedwarn_c90 (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qE", name); else - pedwarn_c90 (input_location, opt, "ISO C90 forbids variable " + pedwarn_c90 (input_location, OPT_Wvla, "ISO C90 forbids variable " "length array"); } } |