aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-05-19 21:35:58 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-05-20 20:47:49 +0100
commitee336ecb2a7161bc28f6c5343d97870a8d15e177 (patch)
tree3fdaf3e119220700ece9fd114e603f6b124f68b6 /gcc/ada/gcc-interface/decl.c
parent66168f96f07b12bbe0beb6e0e988818f624d56bd (diff)
downloadgcc-ee336ecb2a7161bc28f6c5343d97870a8d15e177.zip
gcc-ee336ecb2a7161bc28f6c5343d97870a8d15e177.tar.gz
gcc-ee336ecb2a7161bc28f6c5343d97870a8d15e177.tar.bz2
c++: Add new warning options for C++ language mismatches
This adds new warning flags, enabled by default: -Wc++11-extensions, -Wc++14-extensions, -Wc++17-extensions, -Wc++20-extensions, and -Wc++23-extensions. The names of the flags are copied from Clang, which already has similar options. No new diagnostics are added, but the new OPT_Wxxx variables are used to control existing pedwarns about occurences of new C++ constructs in code using an old C++ standard dialect. This allows several existing warnings that cannot currently be disabled to be controlled by the appropriate -Wno-xxx flag. For example, it will now be possible to disable warnings about using variadic templates in C++98 code, by using the new -Wno-c++11-extensions option. This will allow libstdc++ headers to disable those warnings unconditionally by using diagnostic pragmas, so that they are not emitted even if -Wsystem-headers is used. Some of the affected diagnostics are currently only given when -Wpedantic is used. Now that we have a more specific warning flag, we could consider making them not depend on -Wpedantic, and only on the new flag. This patch does not do that, as it intends to make no changes to what is accepted/rejected by default. The only effect should be that the new option is shown when -fdiagnostics-show-option is active, and that some warnings can be disabled by using the new flags (and for the warnings that previously only dependend on -Wpedantic, it will now be possible to disable just those warnings while still using -Wpedantic for its other benefits). gcc/c-family/ChangeLog: * c.opt (Wc++11-extensions, Wc++14-extensions) (Wc++17-extensions, Wc++20-extensions, Wc++23-extensions): New options. gcc/cp/ChangeLog: * call.c (maybe_warn_array_conv): Use new warning option. * decl.c (mark_inline_variable, grokdeclarator): Likewise. * error.c (maybe_warn_cpp0x): Likewise. * parser.c (cp_parser_primary_expression) (cp_parser_unqualified_id) (cp_parser_pseudo_destructor_name) (cp_parser_lambda_introducer) (cp_parser_lambda_declarator_opt) (cp_parser_selection_statement) (cp_parser_init_statement) (cp_parser_decomposition_declaration) (cp_parser_function_specifier_opt) (cp_parser_static_assert) (cp_parser_namespace_definition) (cp_parser_using_declaration) (cp_parser_asm_definition) (cp_parser_ctor_initializer_opt_and_function_body) (cp_parser_initializer_list) (cp_parser_type_parameter_key) (cp_parser_member_declaration) (cp_parser_try_block) (cp_parser_std_attribute_spec): Likewise. * pt.c (check_template_variable): Likewise. gcc/ChangeLog: * doc/invoke.texi (-Wno-c++11-extensions) (-Wno-c++14-extensions, -Wno-c++17-extensions) (-Wno-c++20-extensions, -Wno-c++23-extensions): Document new options.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
0 files changed, 0 insertions, 0 deletions