[0/1] c++/106423: Fix pragma suppression of -Wc++20-compat diagnostics

Message ID 20220724043902.1777378-1-tom@honermann.net
Headers
Series c++/106423: Fix pragma suppression of -Wc++20-compat diagnostics |

Message

Li, Pan2 via Gcc-patches July 24, 2022, 4:39 a.m. UTC
  This change addresses the following issue raised on the libc-alpha mailing list:
  https://sourceware.org/pipermail/libc-alpha/2022-July/140825.html
Glibc 2.36 adds a char8_t typedef in C++ modes that do not enable the char8_t
builtin type (C++17 and earlier by default; subject to _GNU_SOURCE and use of
the -f[no-]char8_t option).  When -Wc++20-compat diagnostics are enabled, the
following warning is issued from the glibc uchar.h header.
  warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]
Such diagnostics are not desired from system headers, so glibc would like to
suppress the diagnostic using '#pragma GCC diagnostic ignored "-Wc++20-compat"',
but attempting to do so currently fails.  This patch corrects that.

Tom Honermann (1):
  c++/106423: Fix pragma suppression of -Wc++20-compat diagnostics.

 gcc/c-family/c-opts.cc                 |  7 +++++++
 gcc/c-family/c.opt                     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/keywords2.C | 16 ++++++++++++++++
 gcc/testsuite/g++.dg/cpp2a/keywords2.C | 13 +++++++++++++
 libcpp/include/cpplib.h                |  4 ++++
 libcpp/init.cc                         |  1 +
 6 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/keywords2.C
 create mode 100644 gcc/testsuite/g++.dg/cpp2a/keywords2.C