diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2025-08-05 08:21:55 +0200 |
|---|---|---|
| committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-08-05 08:21:55 +0200 |
| commit | ab7c16990fca6b456156895d8d0d5e1a37476d38 (patch) | |
| tree | 636e7b0ccf5e61d17515701f81dcbb39474f72b5 /libcpp | |
| parent | 2361b20f7a4f9ee65184aff2d0299bfc3e0d0f76 (diff) | |
libcpp: Add testcase for CWG2579 [PR120778]
Another easy part from the paper.
Part of the CWG2579 has been already done in an earlier paper (with
test commits by Marek) and the remaining part is implemented correctly,
we diagnose as error when token pasting doesn't form a valid token.
Except that message
pasting """" and """" does not give a valid preprocessing token
looked weird and so I've updated the message to use %< and %> instead
of \" quoting.
2025-08-05 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/120778
* macro.cc (paste_tokens): Use %< and %> instead of \" in
diagnostics around %.*s.
* g++.dg/DRs/dr2579.C: New test.
* c-c++-common/cpp/va-opt-6.c: Expect ' rather than \" around
tokens in incorrect pasting diagnostics.
* gcc.dg/c23-attr-syntax-6.c: Likewise.
* gcc.dg/cpp/paste12.c: Likewise.
* gcc.dg/cpp/paste12-2.c: Likewise.
* gcc.dg/cpp/paste14.c: Likewise.
* gcc.dg/cpp/paste14-2.c: Likewise.
Diffstat (limited to 'libcpp')
| -rw-r--r-- | libcpp/macro.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpp/macro.cc b/libcpp/macro.cc index d869b023935..158c8215e52 100644 --- a/libcpp/macro.cc +++ b/libcpp/macro.cc @@ -1071,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); |
