diff options
author | Jason Merrill <jason@redhat.com> | 2024-08-27 13:14:45 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2024-08-28 05:52:12 -0400 |
commit | 7f4f1bb29a47fbe63a15dda8acfe247b2e934959 (patch) | |
tree | f550f01e78364b28c43bbe79606bc108ec69f97b /gcc/cp | |
parent | 0beac1db38855eae0f71fa982ed05069d3873a9c (diff) | |
download | gcc-7f4f1bb29a47fbe63a15dda8acfe247b2e934959.zip gcc-7f4f1bb29a47fbe63a15dda8acfe247b2e934959.tar.gz gcc-7f4f1bb29a47fbe63a15dda8acfe247b2e934959.tar.bz2 |
c++: add missing -Wc++??-extensions checks
The pedwarns for each of these features should be silenced by
the appropriate -Wno-c++??-extensions.
The handle_pragma_diagnostic_impl change is necessary so that we handle
-Wc++23-extensions early so it's available to interpret_float while lexing.
gcc/c-family/ChangeLog:
* c-pragma.cc (handle_pragma_diagnostic_impl): Also handle
-Wc++23-extensions early.
* c-lex.cc (interpret_float): Use -Wc++23-extensions for extended
floating point literal pedwarn.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_simple_type_specifier): Use
-Wc++20-extensions for auto parameter pedwarn.
* pt.cc (do_decl_instantiation, do_type_instantiation): Use
-Wc++11-extensions for 'extern template'.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/extern_template-7.C: New test.
* g++.dg/cpp23/ext-floating19.C: New test.
* g++.dg/cpp2a/abbrev-fn1.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/parser.cc | 2 | ||||
-rw-r--r-- | gcc/cp/pt.cc | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index a722641..918072d 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -20527,7 +20527,7 @@ cp_parser_simple_type_specifier (cp_parser* parser, error_at (token->location, "use of %<auto%> in template argument"); else if (!flag_concepts) - pedwarn (token->location, 0, + pedwarn (token->location, OPT_Wc__20_extensions, "use of %<auto%> in parameter declaration " "only available with %<-std=c++20%> or %<-fconcepts%>"); else if (cxx_dialect < cxx14) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 24a6241d..9e0f048 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -26531,8 +26531,8 @@ do_decl_instantiation (tree decl, tree storage) ; else if (storage == ridpointers[(int) RID_EXTERN]) { - if (cxx_dialect == cxx98) - pedwarn (input_location, OPT_Wpedantic, + if (cxx_dialect == cxx98 && pedantic) + pedwarn (input_location, OPT_Wc__11_extensions, "ISO C++ 1998 forbids the use of %<extern%> on explicit " "instantiations"); extern_p = 1; @@ -26598,8 +26598,8 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain) { if (storage == ridpointers[(int) RID_EXTERN]) { - if (cxx_dialect == cxx98) - pedwarn (input_location, OPT_Wpedantic, + if (cxx_dialect == cxx98 && pedantic) + pedwarn (input_location, OPT_Wc__11_extensions, "ISO C++ 1998 forbids the use of %<extern%> on " "explicit instantiations"); } |