public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114436] New: #pragma GCC system_header vs. _Pragma("GCC system_header")
@ 2024-03-22 18:18 finke at cognitec dot com
2024-03-22 18:28 ` [Bug preprocessor/114436] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: finke at cognitec dot com @ 2024-03-22 18:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114436
Bug ID: 114436
Summary: #pragma GCC system_header vs. _Pragma("GCC
system_header")
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: finke at cognitec dot com
Target Milestone: ---
Created attachment 57784
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57784&action=edit
code snippet
When using the _Pragma operator instead of the #pragma directive for "GCC
system_header", a different behavior can be observed:
Warnings in included header files are not being ignored as it is the case with
the #pragma directive.
The attached code snippet does emit an error when compiled with
"g++ -Werror=unused-parameter pragma.cc"
The expectation would be, that it compiles without error (clang is compiling it
without error).
gcc versions tested: 4.8.5 & 13.2.1
Output from compiler:
In file included from pragma.h:10:0,
from pragma.cc:1:
third_party.h:4:13: error: unused parameter 'force_unused_warning'
[-Werror=unused-parameter]
inline void foo( int force_unused_warning) {
^
cc1plus: some warnings being treated as errors
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/114436] #pragma GCC system_header vs. _Pragma("GCC system_header")
2024-03-22 18:18 [Bug c++/114436] New: #pragma GCC system_header vs. _Pragma("GCC system_header") finke at cognitec dot com
@ 2024-03-22 18:28 ` pinskia at gcc dot gnu.org
2024-03-22 19:36 ` lhyatt at gcc dot gnu.org
2024-03-23 21:36 ` lhyatt at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-22 18:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114436
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=114423
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe this is related to how _Pragma is treated in general.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/114436] #pragma GCC system_header vs. _Pragma("GCC system_header")
2024-03-22 18:18 [Bug c++/114436] New: #pragma GCC system_header vs. _Pragma("GCC system_header") finke at cognitec dot com
2024-03-22 18:28 ` [Bug preprocessor/114436] " pinskia at gcc dot gnu.org
@ 2024-03-22 19:36 ` lhyatt at gcc dot gnu.org
2024-03-23 21:36 ` lhyatt at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2024-03-22 19:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114436
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-03-22
Status|UNCONFIRMED |NEW
CC| |lhyatt at gcc dot gnu.org
--- Comment #2 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
This should fix it correctly, will test it sometime.
diff --git a/libcpp/directives.cc b/libcpp/directives.cc
index 479f8c716e8..36cc762e704 100644
--- a/libcpp/directives.cc
+++ b/libcpp/directives.cc
@@ -1986,7 +1986,9 @@ destringize_and_run (cpp_reader *pfile, const cpp_string
*in,
/* Finish inlining run_directive. */
pfile->buffer->file = NULL;
+ const auto new_sysp = pfile->buffer->sysp;
_cpp_pop_buffer (pfile);
+ pfile->buffer->sysp = new_sysp;
/* Reset the old macro state before ... */
XDELETE (pfile->context);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/114436] #pragma GCC system_header vs. _Pragma("GCC system_header")
2024-03-22 18:18 [Bug c++/114436] New: #pragma GCC system_header vs. _Pragma("GCC system_header") finke at cognitec dot com
2024-03-22 18:28 ` [Bug preprocessor/114436] " pinskia at gcc dot gnu.org
2024-03-22 19:36 ` lhyatt at gcc dot gnu.org
@ 2024-03-23 21:36 ` lhyatt at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2024-03-23 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114436
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2024-March/6
| |48297.html
--- Comment #3 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Slight variation of the above submitted for review at
https://gcc.gnu.org/pipermail/gcc-patches/2024-March/648297.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-23 21:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 18:18 [Bug c++/114436] New: #pragma GCC system_header vs. _Pragma("GCC system_header") finke at cognitec dot com
2024-03-22 18:28 ` [Bug preprocessor/114436] " pinskia at gcc dot gnu.org
2024-03-22 19:36 ` lhyatt at gcc dot gnu.org
2024-03-23 21:36 ` lhyatt 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).