diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-08-24 09:55:57 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-08-24 09:55:57 +0200 |
commit | 365202625d2f2d6694dba889ca67498fefb59c68 (patch) | |
tree | 0eb106ecafdb17bdb057a8efc837647c5598fe8b /libcpp/init.cc | |
parent | 42301c02e458cdce646ffaf7ea1df502ab2e8ddc (diff) | |
download | gcc-365202625d2f2d6694dba889ca67498fefb59c68.zip gcc-365202625d2f2d6694dba889ca67498fefb59c68.tar.gz gcc-365202625d2f2d6694dba889ca67498fefb59c68.tar.bz2 |
preprocessor: Implement C++23 P2437R1 - Support for #warning [PR106646]
On Thu, Aug 18, 2022 at 11:02:44PM +0000, Joseph Myers wrote:
> ISO C2x standardizes the existing #warning extension. Arrange
> accordingly for it not to be diagnosed with -std=c2x -pedantic, but to
> be diagnosed with -Wc11-c2x-compat.
And here is the corresponding C++ version.
Don't pedwarn about this for C++23/GNU++23 and tweak the diagnostics
for C++ otherwise, + testsuite coverage.
The diagnostic wording is similar e.g. to the #elifdef diagnostics.
2022-08-24 Jakub Jelinek <jakub@redhat.com>
PR c++/106646
* init.cc: Implement C++23 P2437R1 - Support for #warning.
(lang_defaults): Set warning_directive for GNUCXX23 and CXX23.
* directives.cc (directive_diagnostics): Use different wording of
#warning pedwarn for C++.
* g++.dg/cpp/warning-1.C: New test.
* g++.dg/cpp/warning-2.C: New test.
* g++.dg/cpp/warning-3.C: New test.
Diffstat (limited to 'libcpp/init.cc')
-rw-r--r-- | libcpp/init.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libcpp/init.cc b/libcpp/init.cc index b184e1f..39e7e75 100644 --- a/libcpp/init.cc +++ b/libcpp/init.cc @@ -123,8 +123,8 @@ static const struct lang_flags lang_defaults[] = /* CXX17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0 }, /* GNUCXX20 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, /* CXX20 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, - /* GNUCXX23 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1 }, - /* CXX23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1 }, + /* GNUCXX23 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1 }, + /* CXX23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1 }, /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; |