https://gcc.gnu.org/g:03e0bf3f4f9bd85dcc1f60c4e38157609d754c91
commit r15-6957-g03e0bf3f4f9bd85dcc1f60c4e38157609d754c91 Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Jan 16 17:23:02 2025 +0100 c++: Change c++2b and gnu++2b to c++23 and gnu++23 in C++ diagnostics This is something we should have done when -std=c++23 was made the primary option and -std=c++2b turned into undocumented alias. 2025-01-16 Jakub Jelinek <ja...@redhat.com> gcc/cp/ * parser.cc (cp_parser_lambda_declarator_opt, cp_parser_statement, cp_parser_selection_statement, cp_parser_jump_statement): Use -std=c++23 and -std=gnu++23 in diagnostics rather than -std=c++2b and -std=gnu++2b. * semantics.cc (finish_compound_literal): Likewise. * typeck2.cc (build_functional_cast_1): Likewise. * decl.cc (start_decl): Likewise. * constexpr.cc (ensure_literal_type_for_constexpr_object, potential_constant_expression_1): Likewise. gcc/c-family/ * c-lex.cc (interpret_float): Use -std=c++23 and -std=gnu++23 in diagnostics rather than -std=c++2b and -std=gnu++2b. Diff: --- gcc/c-family/c-lex.cc | 4 ++-- gcc/cp/constexpr.cc | 6 +++--- gcc/cp/decl.cc | 4 ++-- gcc/cp/parser.cc | 22 +++++++++++----------- gcc/cp/semantics.cc | 2 +- gcc/cp/typeck2.cc | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc index fa87913174d5..e450c9a57f0c 100644 --- a/gcc/c-family/c-lex.cc +++ b/gcc/c-family/c-lex.cc @@ -1307,7 +1307,7 @@ interpret_float (const cpp_token *token, unsigned int flags, if (cxx_dialect < cxx23 && pedantic) pedwarn (input_location, OPT_Wc__23_extensions, "%<f%d%> or %<F%d%> suffix on floating constant only " - "available with %<-std=c++2b%> or %<-std=gnu++2b%>", + "available with %<-std=c++23%> or %<-std=gnu++23%>", n, n); } else @@ -1328,7 +1328,7 @@ interpret_float (const cpp_token *token, unsigned int flags, else if (cxx_dialect < cxx23 && pedantic) pedwarn (input_location, OPT_Wc__23_extensions, "%<bf16%> or %<BF16%> suffix on floating constant only " - "available with %<-std=c++2b%> or %<-std=gnu++2b%>"); + "available with %<-std=c++23%> or %<-std=gnu++23%>"); } else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE) type = long_double_type_node; diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 0896576fd28e..31666005c321 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -122,7 +122,7 @@ ensure_literal_type_for_constexpr_object (tree decl) error_at (DECL_SOURCE_LOCATION (decl), "variable %qD of non-literal type %qT in " "%<constexpr%> function only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>", decl, type); + "%<-std=c++23%> or %<-std=gnu++23%>", decl, type); explain_non_literal_class (type); decl = error_mark_node; } @@ -10736,8 +10736,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, return true; else if (flags & tf_error) constexpr_error (loc, fundef_p, "label definition in %<constexpr%> " - "function only available with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "function only available with %<-std=c++23%> or " + "%<-std=gnu++23%>"); return false; case ANNOTATE_EXPR: diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 0532c68e35dd..3f2c3d831fd8 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -6202,13 +6202,13 @@ start_decl (const cp_declarator *declarator, if (CP_DECL_THREAD_LOCAL_P (decl) && !DECL_REALLY_EXTERN (decl)) error_at (DECL_SOURCE_LOCATION (decl), "%qD defined %<thread_local%> in %qs function only " - "available with %<-std=c++2b%> or %<-std=gnu++2b%>", decl, + "available with %<-std=c++23%> or %<-std=gnu++23%>", decl, DECL_IMMEDIATE_FUNCTION_P (current_function_decl) ? "consteval" : "constexpr"); else if (TREE_STATIC (decl)) error_at (DECL_SOURCE_LOCATION (decl), "%qD defined %<static%> in %qs function only available " - "with %<-std=c++2b%> or %<-std=gnu++2b%>", decl, + "with %<-std=c++23%> or %<-std=gnu++23%>", decl, DECL_IMMEDIATE_FUNCTION_P (current_function_decl) ? "consteval" : "constexpr"); else diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index a91c7aae3757..2d7ea9fbe2fc 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -12165,8 +12165,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) { pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda declaration " - "specifiers only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "specifiers only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); omitted_parms_loc = UNKNOWN_LOCATION; } /* Peek at the params, see if we have an xobj parameter. */ @@ -12262,8 +12262,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) { pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda transaction " - "qualifier only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "qualifier only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); omitted_parms_loc = UNKNOWN_LOCATION; } @@ -12275,8 +12275,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) { pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda exception " - "specification only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "specification only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); omitted_parms_loc = UNKNOWN_LOCATION; } @@ -12293,8 +12293,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) if (omitted_parms_loc) pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda trailing " - "return type only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "return type only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); cp_lexer_consume_token (parser->lexer); return_type = cp_parser_trailing_type_id (parser); } @@ -13069,7 +13069,7 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr, if (cxx_dialect < cxx23) pedwarn (loc, OPT_Wc__23_extensions, "label at end of compound statement only available " - "with %<-std=c++2b%> or %<-std=gnu++2b%>"); + "with %<-std=c++23%> or %<-std=gnu++23%>"); return; } in_compound_for_pragma = false; @@ -13826,7 +13826,7 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p, if (cxx_dialect < cxx23) pedwarn (tok->location, OPT_Wc__23_extensions, "%<if consteval%> only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); bool save_in_consteval_if_p = in_consteval_if_p; statement = begin_if_stmt (); @@ -15225,7 +15225,7 @@ cp_parser_jump_statement (cp_parser* parser, tree &std_attrs) && cxx_dialect < cxx23) { error ("%<goto%> in %<constexpr%> function only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); cp_function_chain->invalid_constexpr = true; } diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 2039f5266042..ce9ef1fdba53 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -3751,7 +3751,7 @@ finish_compound_literal (tree type, tree compound_literal, else if (cxx_dialect < cxx23) pedwarn (input_location, OPT_Wc__23_extensions, "%<auto{x}%> only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); type = do_auto_deduction (type, compound_literal, type, complain, adc_variable_type); if (type == error_mark_node) diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index e2ab255a7d50..15528baf0427 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -2507,7 +2507,7 @@ build_functional_cast_1 (location_t loc, tree exp, tree parms, else if (cxx_dialect < cxx23) pedwarn (loc, OPT_Wc__23_extensions, "%<auto(x)%> only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); } else {