public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
@ 2021-10-29 17:51 ` burnus at gcc dot gnu.org
2021-10-29 22:09 ` burnus at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 17:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
If I look at the 'gcc -E' output, the order is reverted:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic pop
else { b--; ; ; a--; ; }
this should be instead:
else { b--;
#pragma GCC diagnostic push
;
#pragma GCC diagnostic ignored "-Wall"
; a--;
#pragma GCC diagnostic pop
; }
I did observe the same in PR102409 – see analysis there. But contrary to the
issue in the other PR, the patch there does not solve the issue in this PR.
Additionally, for 'GCC diagnostic' there might be a column issue as discussed
in PR91669 comment 3.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
2021-10-29 17:51 ` [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros burnus at gcc dot gnu.org
@ 2021-10-29 22:09 ` burnus at gcc dot gnu.org
2021-10-29 23:26 ` burnus at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 22:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem is that the pragma is not known/registered. In that case, when
calling
libcpp/directives.c's do_pragma, the result is p == NULL
and thus:
if (p)
...
else if (pfile->cb.def_pragma)
...
pfile->cb.def_pragma (pfile, pfile->directive_line);
the latter immediately prints the '#pragma ...'
I think what needs to be done is if (p == NULL && pfile->state.in_directive) to
create a new pragma on the fly and store it in pfile->directive_result to use
it later.
* * *
Side note: For 'gcc -E c-c++-common/gomp/pragma-1.c' the same issue occurs, but
if one adds -fopenmp, p != NULL and everything is fine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
2021-10-29 17:51 ` [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros burnus at gcc dot gnu.org
2021-10-29 22:09 ` burnus at gcc dot gnu.org
@ 2021-10-29 23:26 ` burnus at gcc dot gnu.org
2021-11-10 11:54 ` burnus at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 23:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 51700
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51700&action=edit
Draft patch for the 'gcc -E' / 'gcc -save-temps' issue
This solves the -E / -save-temps preprocessing issue.
For the non -E issue, it could be the issue described at PR 91669.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-10-29 23:26 ` burnus at gcc dot gnu.org
@ 2021-11-10 11:54 ` burnus at gcc dot gnu.org
2023-08-25 20:17 ` lhyatt at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-11-10 11:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #6)
> Created attachment 51700 [details]
> Draft patch for the 'gcc -E' / 'gcc -save-temps' issue
>
> This solves the -E / -save-temps preprocessing issue.
>
> For the non -E issue, it could be the issue described at PR 91669.
Regarding "-E": Actually, looking at PR103165 comment 2, I note that for the
example there 'clang -E' outputs:
"hello; \"\" _Pragma(\"GCC diagnostic pop\") world;"
that is: While the macros are replaced, the (unknown) _Pragma remains as
_Pragma - such that it is then later only processed when running the compiler.
No idea whether that makes sense or not not - just as observation.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2021-11-10 11:54 ` burnus at gcc dot gnu.org
@ 2023-08-25 20:17 ` lhyatt at gcc dot gnu.org
2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 8+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-08-25 20:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-08-25
CC| |lhyatt at gcc dot gnu.org
Ever confirmed|0 |1
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=103165,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=102409
--- Comment #8 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #7)
> Regarding "-E": Actually, looking at PR103165 comment 2, I note that for the
> example there 'clang -E' outputs:
>
> "hello; \"\" _Pragma(\"GCC diagnostic pop\") world;"
>
> that is: While the macros are replaced, the (unknown) _Pragma remains as
> _Pragma - such that it is then later only processed when running the
> compiler.
>
> No idea whether that makes sense or not not - just as observation.
This issue was indeed fixed by r12-5454, the fix for PR103165.
I will get a testcase added and then close this one. The testcase will be a
tweaked version of the original one from this PR. It needs to use a different
_Pragma, because nowadays, '#pragma GCC diagnostic' is recognized by the
preprocessor. The existing c-c++-common/gomp/pragma-2.c provides coverage for
that case. '#pragma GCC unroll' is a useful new testcase, being another pragma
that is explicitly ignored during preprocess-only modes.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2023-08-25 20:17 ` lhyatt at gcc dot gnu.org
@ 2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
2023-09-20 20:51 ` lhyatt at gcc dot gnu.org
2023-10-02 16:57 ` lhyatt at gcc dot gnu.org
7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-20 20:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhyatt@gcc.gnu.org>:
https://gcc.gnu.org/g:d8e08ba9396b1f7da50011468f260250b7afaab7
commit r14-4186-gd8e08ba9396b1f7da50011468f260250b7afaab7
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Fri Aug 25 15:57:19 2023 -0400
testsuite: Add test for already-fixed issue with _Pragma expansion
[PR90400]
The PR was fixed by r12-5454. Since the fix was somewhat incidental,
although related, add a testcase from PR90400 too before closing it out.
gcc/testsuite/ChangeLog:
PR preprocessor/90400
* c-c++-common/cpp/pr90400.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
@ 2023-09-20 20:51 ` lhyatt at gcc dot gnu.org
2023-10-02 16:57 ` lhyatt at gcc dot gnu.org
7 siblings, 0 replies; 8+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-09-20 20:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Marking it fixed now that the testcase is added.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2023-09-20 20:51 ` lhyatt at gcc dot gnu.org
@ 2023-10-02 16:57 ` lhyatt at gcc dot gnu.org
7 siblings, 0 replies; 8+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-10-02 16:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90400
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paboyle at ph dot ed.ac.uk
--- Comment #11 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
*** Bug 91517 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-02 16:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-90400-4@http.gcc.gnu.org/bugzilla/>
2021-10-29 17:51 ` [Bug preprocessor/90400] _Pragma not always expanded in the right location within macros burnus at gcc dot gnu.org
2021-10-29 22:09 ` burnus at gcc dot gnu.org
2021-10-29 23:26 ` burnus at gcc dot gnu.org
2021-11-10 11:54 ` burnus at gcc dot gnu.org
2023-08-25 20:17 ` lhyatt at gcc dot gnu.org
2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
2023-09-20 20:51 ` lhyatt at gcc dot gnu.org
2023-10-02 16:57 ` 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).