public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/106423] New: -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored @ 2022-07-24 3:32 tom at honermann dot net 2022-07-24 4:41 ` [Bug c++/106423] " tom at honermann dot net ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: tom at honermann dot net @ 2022-07-24 3:32 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106423 Bug ID: 106423 Summary: -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tom at honermann dot net Target Milestone: --- As demonstrated at https://godbolt.org/z/GoTqPTcM3, use of gcc's '#pragma GCC diagnostic ignored "-Wc++20-compat"' directive fails to suppress -Wc++20-compat enabled diagnostics. gcc versions 10 and up are affected. $ cat t.cpp #pragma GCC diagnostic ignored "-Wc++20-compat" int constinit; $ gcc -c -std=c++17 -Wc++20-compat t.cpp t.cpp:2:5: warning: identifier ‘constinit’ is a keyword in C++20 [-Wc++20-compat] 2 | int constinit; | ^~~~~~~~~ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/106423] -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored 2022-07-24 3:32 [Bug c++/106423] New: -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored tom at honermann dot net @ 2022-07-24 4:41 ` tom at honermann dot net 2022-08-09 7:05 ` ville.voutilainen at gmail dot com 2022-08-16 19:15 ` cvs-commit at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: tom at honermann dot net @ 2022-07-24 4:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106423 --- Comment #1 from Tom Honermann <tom at honermann dot net> --- A patch for this issue was submitted to the gcc-patches mailing list and is available at https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/106423] -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored 2022-07-24 3:32 [Bug c++/106423] New: -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored tom at honermann dot net 2022-07-24 4:41 ` [Bug c++/106423] " tom at honermann dot net @ 2022-08-09 7:05 ` ville.voutilainen at gmail dot com 2022-08-16 19:15 ` cvs-commit at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: ville.voutilainen at gmail dot com @ 2022-08-09 7:05 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106423 Ville Voutilainen <ville.voutilainen at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ville.voutilainen at gmail dot com Last reconfirmed| |2022-08-09 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/106423] -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored 2022-07-24 3:32 [Bug c++/106423] New: -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored tom at honermann dot net 2022-07-24 4:41 ` [Bug c++/106423] " tom at honermann dot net 2022-08-09 7:05 ` ville.voutilainen at gmail dot com @ 2022-08-16 19:15 ` cvs-commit at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2022-08-16 19:15 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106423 --- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:60468d6cd46a3bd3afe8ff856f82afcd4c65a217 commit r13-2081-g60468d6cd46a3bd3afe8ff856f82afcd4c65a217 Author: Tom Honermann <tom@honermann.net> Date: Mon Aug 1 14:49:00 2022 -0400 c++: Fix pragma suppression of -Wc++20-compat diagnostics [PR106423] Gcc's '#pragma GCC diagnostic' directives are processed in "early mode" (see handle_pragma_diagnostic_early) for the C++ frontend and, as such, require that the target diagnostic option be enabled for the preprocessor (see c_option_is_from_cpp_diagnostics). This change modifies the -Wc++20-compat option definition to register it as a preprocessor option so that its associated diagnostics can be suppressed. The changes also implicitly disable the option in C++20 and later modes. These changes are consistent with the definition of the -Wc++11-compat option. This support is motivated by the need to suppress the following diagnostic otherwise issued in C++17 and earlier modes due to the char8_t typedef present in the uchar.h header file in glibc 2.36. warning: identifier âchar8_tâ is a keyword in C++20 [-Wc++20-compat] Tests are added to validate suppression of both -Wc++11-compat and -Wc++20-compat related diagnostics (fixes were only needed for the C++20 case). PR c++/106423 gcc/c-family/ChangeLog: * c-opts.cc (c_common_post_options): Disable -Wc++20-compat diagnostics in C++20 and later. * c.opt (Wc++20-compat): Enable hooks for the preprocessor. gcc/cp/ChangeLog: * parser.cc (cp_lexer_saving_tokens): Add comment regarding diagnostic requirements. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/keywords2.C: New test. * g++.dg/cpp2a/keywords2.C: New test. libcpp/ChangeLog: * include/cpplib.h (cpp_warning_reason): Add CPP_W_CXX20_COMPAT. * init.cc (cpp_create_reader): Add cpp_warn_cxx20_compat. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-16 19:15 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-24 3:32 [Bug c++/106423] New: -Wc++20-compat diagnostics not suppressed by #pragma GCC diagnostic ignored tom at honermann dot net 2022-07-24 4:41 ` [Bug c++/106423] " tom at honermann dot net 2022-08-09 7:05 ` ville.voutilainen at gmail dot com 2022-08-16 19:15 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).