From: Jakub Jelinek Date: Thu, 16 Jan 2025 16:23:02 +0000 (+0100) Subject: c++: Change c++2b and gnu++2b to c++23 and gnu++23 in C++ diagnostics X-Git-Tag: basepoints/gcc-16~2596 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03e0bf3f4f9bd85dcc1f60c4e38157609d754c91;p=thirdparty%2Fgcc.git 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 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 --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc index fa87913174d..e450c9a57f0 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, "% or % 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, "% or % 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 0896576fd28..31666005c32 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 " "% 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 % " - "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 0532c68e35d..3f2c3d831fd 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 % 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 % 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 a91c7aae375..2d7ea9fbe2f 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, "% 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 ("% in % 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 2039f526604..ce9ef1fdba5 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, "% 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 e2ab255a7d5..15528baf042 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, "% only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); } else {