From f3bede718836610fd741175f4a1b74ba5717e283 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sun, 10 Aug 2014 06:10:49 +0000 Subject: 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 --- gcc/doc/invoke.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/doc') diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3582035..fdb0b84 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -241,6 +241,7 @@ Objective-C and Objective-C++ Dialects}. -w -Wextra -Wall -Waddress -Waggregate-return @gol -Waggressive-loop-optimizations -Warray-bounds @gol -Wno-attributes -Wno-builtin-macro-redefined @gol +-Wc90-c99-compat @gol -Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual @gol -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol @@ -4517,6 +4518,15 @@ example, warn if an unsigned variable is compared against zero with Warn whenever a function call is cast to a non-matching type. For example, warn if @code{int malloc()} is cast to @code{anything *}. +@item -Wc90-c99-compat @r{(C and Objective-C only)} +@opindex Wc90-c99-compat +@opindex Wno-c90-c99-compat +Warn about features not present in ISO C90, but present in ISO C99. +For instance, warn about use of variable length arrays, @code{long long} +type, @code{bool} type, compound literals, designated initializers, and so +on. This option is independent of the standards mode. Warnings are disabled +in the expression that follows @code{__extension__}. + @item -Wc++-compat @r{(C and Objective-C only)} Warn about ISO C constructs that are outside of the common subset of ISO C and ISO C++, e.g.@: request for implicit conversion from -- cgit v1.1