diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/macro.cc | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index b5188fd..e58fad1 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2025-08-04 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * macro.cc (stringify_arg): For C++26 emit a pedarn instead of warning + for \ at the end of stringification. + 2025-08-03 Jakub Jelinek <jakub@redhat.com> PR c++/120845 diff --git a/libcpp/macro.cc b/libcpp/macro.cc index be25710..158c821 100644 --- a/libcpp/macro.cc +++ b/libcpp/macro.cc @@ -1003,7 +1003,10 @@ stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count) /* Ignore the final \ of invalid string literals. */ if (backslash_count & 1) { - cpp_error (pfile, CPP_DL_WARNING, + cpp_error (pfile, + CPP_OPTION (pfile, cplusplus) + && CPP_OPTION (pfile, lang) >= CLK_GNUCXX26 + ? CPP_DL_PEDWARN : CPP_DL_WARNING, "invalid string literal, ignoring final %<\\%>"); dest--; } @@ -1068,7 +1071,7 @@ paste_tokens (cpp_reader *pfile, location_t location, /* Mandatory error for all apart from assembler. */ if (CPP_OPTION (pfile, lang) != CLK_ASM) cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0, - "pasting \"%.*s\" and \"%.*s\" does not give " + "pasting %<%.*s%> and %<%.*s%> does not give " "a valid preprocessing token", (int) (lhsend - buf), buf, (int) (end - rhsstart), rhsstart); |