diff options
author | Marek Polacek <polacek@redhat.com> | 2014-08-10 06:10:49 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-08-10 06:10:49 +0000 |
commit | f3bede718836610fd741175f4a1b74ba5717e283 (patch) | |
tree | ad84805c19739010caa9af61cb0d2c384e5aa852 /gcc/c-family | |
parent | 7a9f1eed30e169e4d1cfbe4167190db495213406 (diff) | |
download | gcc-f3bede718836610fd741175f4a1b74ba5717e283.zip gcc-f3bede718836610fd741175f4a1b74ba5717e283.tar.gz gcc-f3bede718836610fd741175f4a1b74ba5717e283.tar.bz2 |
re PR c/51849 (-Wc99-compat would be considered useful)
PR c/51849
gcc/
* gcc/doc/invoke.texi: Document -Wc90-c99-compat.
gcc/c-family/
* c-opts.c (sanitize_cpp_opts): Pass warn_c90_c99_compat to libcpp.
* c.opt (Wc90-c99-compat): Add option.
gcc/c/
* c-decl.c (build_array_declarator): Remove check for !flag_isoc99.
Call pedwarn_c90 instead of pedwarn.
(check_bitfield_type_and_width): Likewise.
(declspecs_add_qual): Likewise.
(declspecs_add_type): Likewise.
(warn_variable_length_array): Unify function for -pedantic and -Wvla.
Adjust to only call pedwarn_c90.
(grokdeclarator): Remove pedantic && !flag_isoc99 check. Call
pedwarn_c90 instead of pedwarn.
* c-errors.c (pedwarn_c90): Handle -Wc90-c99-compat.
* c-parser.c (disable_extension_diagnostics): Handle
warn_c90_c99_compat.
(restore_extension_diagnostics): Likewise.
(c_parser_enum_specifier): Remove check for !flag_isoc99. Call
pedwarn_c90 instead of pedwarn.
(c_parser_initelt): Likewise.
(c_parser_postfix_expression): Likewise.
(c_parser_postfix_expression_after_paren_type): Likewise.
(c_parser_compound_statement_nostart): Remove check for !flag_isoc99.
* c-tree.h: Fix formatting.
* c-typeck.c (build_array_ref): Remove check for !flag_isoc99. Call
pedwarn_c90 instead of pedwarn.
gcc/testsuite/
* gcc.dg/Wc90-c99-compat-1.c: New test.
* gcc.dg/Wc90-c99-compat-2.c: New test.
* gcc.dg/Wc90-c99-compat-3.c: New test.
* gcc.dg/Wc90-c99-compat-4.c: New test.
* gcc.dg/Wc90-c99-compat-5.c: New test.
* gcc.dg/Wc90-c99-compat-6.c: New test.
* gcc.dg/wvla-1.c: Adjust dg-warning.
* gcc.dg/wvla-2.c: Adjust dg-warning.
* gcc.dg/wvla-4.c: Adjust dg-warning.
* gcc.dg/wvla-6.c: Adjust dg-warning.
libcpp/
* lex.c (_cpp_lex_direct): Warn when -Wc90-c99-compat is in effect.
* charset.c (_cpp_valid_ucn): Likewise.
* include/cpplib.h (cpp_options): Add cpp_warn_c90_c99_compat.
* macro.c (replace_args): Warn when -Wc90-c99-compat is in effect.
(parse_params): Likewise.
From-SVN: r213786
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 1 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 803eb7b..e71f6ed 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2014-08-10 Marek Polacek <polacek@redhat.com> + + PR c/51849 + * c-opts.c (sanitize_cpp_opts): Pass warn_c90_c99_compat to libcpp. + * c.opt (Wc90-c99-compat): Add option. + 2014-08-07 Trevor Saunders <tsaunders@mozilla.com> * c-gimplify.c, cilk.c: Remove includes of pointer-set.h. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 3f8e6e6..43a8b9d 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1295,6 +1295,7 @@ sanitize_cpp_opts (void) cpp_opts->unsigned_char = !flag_signed_char; cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS; cpp_opts->warn_date_time = cpp_warn_date_time; + cpp_opts->cpp_warn_c90_c99_compat = warn_c90_c99_compat; /* Wlong-long is disabled by default. It is enabled by: [-Wpedantic | -Wtraditional] -std=[gnu|c]++98 ; or diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index c3be622..356a79f 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -291,6 +291,10 @@ Wbuiltin-macro-redefined C ObjC C++ ObjC++ Warning Warn when a built-in preprocessor macro is undefined or redefined +Wc90-c99-compat +C ObjC Var(warn_c90_c99_compat) Warning +Warn about features not present in ISO C90, but present in ISO C99 + Wc++-compat C ObjC Var(warn_cxx_compat) Warning Warn about C constructs that are not in the common subset of C and C++ |