From e91f9da57928ab10e2206c64ce490477d3b46ec1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 4 Feb 2021 18:30:45 +0100 Subject: [PATCH] c++, libcpp: Use make_signed_t in the 1z diagnostics The following patch uses make_signed_t instead of make_signed::type in the diagnostics, because the former is shorter. It is true that one can't use make_signed::type in C++11 code (which is why I haven't changed it in the testcase which is c++11 effective target), but the message talks about C++23 and make_signed_t is a C++14 and later feature, so I think it is fine. 2021-02-04 Jakub Jelinek * expr.c (cpp_classify_number): Use make_signed_t instead of make_signed::type in the diagnostics. * g++.dg/warn/Wsize_t-literals.C: Expect make_signed_t instead of make_signed::type in the diagnostics. --- gcc/testsuite/g++.dg/warn/Wsize_t-literals.C | 4 ++-- libcpp/expr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C b/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C index dc0025ba585..ef910a502b4 100644 --- a/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C +++ b/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C @@ -8,5 +8,5 @@ std::size_t S1 = 5678ZU; // { dg-warning {use of C\+\+23 .size_t. integer consta std::size_t s2 = 1234uz; // { dg-warning {use of C\+\+23 .size_t. integer constant} "" { target c++20_down } } std::size_t S2 = 5678UZ; // { dg-warning {use of C\+\+23 .size_t. integer constant} "" { target c++20_down } } -std::make_signed::type pd1 = 1234z; // { dg-warning {use of C\+\+23 .make_signed::type. integer constant} "" { target c++20_down } } -std::make_signed::type PD1 = 5678Z; // { dg-warning {use of C\+\+23 .make_signed::type. integer constant} "" { target c++20_down } } +std::make_signed::type pd1 = 1234z; // { dg-warning {use of C\+\+23 .make_signed_t. integer constant} "" { target c++20_down } } +std::make_signed::type PD1 = 5678Z; // { dg-warning {use of C\+\+23 .make_signed_t. integer constant} "" { target c++20_down } } diff --git a/libcpp/expr.c b/libcpp/expr.c index 42007f98b93..dd5611dce0e 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -820,7 +820,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token, { const char *message = (result & CPP_N_UNSIGNED) == CPP_N_UNSIGNED ? N_("use of C++23 % integer constant") - : N_("use of C++23 %::type%> integer constant"); + : N_("use of C++23 %%> integer constant"); cpp_warning_with_line (pfile, CPP_W_SIZE_T_LITERALS, virtual_location, 0, message); } -- 2.30.2