public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
       [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
@ 2021-10-29 16:25 ` burnus at gcc dot gnu.org
  2021-10-29 17:40 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 16:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
I note that preprocessing itself is working. That is
  using -save-temps which first preprocesses the file and then runs the result
  on the compiler works
but doing everything in one step doesn't.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
       [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
  2021-10-29 16:25 ` [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't burnus at gcc dot gnu.org
@ 2021-10-29 17:40 ` burnus at gcc dot gnu.org
  2022-09-30 23:00 ` lhyatt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 17:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Comparing the two inside handle_pragma_visibility:
* the no-save-temps version has as 'loc' the line pointing to
_Pragma(#__VA_ARGS__)
* with -save-temps, 'loc' == 'input_location'.

But: control_warning_option is called with input_location and not 'loc', thus
that should not be the reason for the issue.

 * * *

However, if one does a deep dive into update_effective_level_from_pragmas, the
difference seems to be only the column number. There is:

          if (!linemap_location_before_p (line_table, pragloc, loc))
            continue;

Without -save-temps, there is (with warnings + notes added for debugging):

foo.c:29:1: warning: update_effective_level_from_pragmas - pragloc
   29 | BX_retundef(})
      | ^~~~~~~~~~~
foo.c:29:13: note: loc is here
   29 | BX_retundef(})
      |             ^

thus loc > pragloc


But -save-temps, i.e. working on the preprocessed input, there is:

foo.c:29:9: warning: update_effective_level_from_pragmas - pragloc
   29 | BX_retundef(})
      |         ^~~
foo.c:29:2: note: loc is here
   29 | BX_retundef(})
      |  ^

That is:  loc < pragloc

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
       [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
  2021-10-29 16:25 ` [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't burnus at gcc dot gnu.org
  2021-10-29 17:40 ` burnus at gcc dot gnu.org
@ 2022-09-30 23:00 ` lhyatt at gcc dot gnu.org
  2022-10-04  1:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2022-09-30 23:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669

Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lhyatt at gcc dot gnu.org

--- Comment #4 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
This is already fixed on the latest GCC 10, 11, and 12 branches and on trunk
for GCC 13.

There were two separate issues contributing to this problem. The first one was
common to both C and C++, and it was fixed by r10-325 for PR90382. (That PR was
primarily about something else so was not focused on _Pragma locations, but the
fix resolved this PR too.)

The second issue made it stay broken longer for C only, not C++. In that sense
it's partially a dupe of PR97498 and this aspect was fixed by r13-1596. (Issue
was that in C, input_location used to be always the start of the line.) That
fix has been backported to 10, 11, and 12 branches already.

The testcase I added in r13-1596 provides partial coverage for this issue as
well, but it does not quite cover the issue with adhoc locations addressed by
r10-325. Here is a reduced testcase for this PR:

=======================
#define ENDFUNC \
    _Pragma("GCC diagnostic push") \
    _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
     } \
     _Pragma("GCC diagnostic pop")

int f () {
ENDFUNC
=======================

I will submit a patch to add this testcase and then close this one once that's
applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
       [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-09-30 23:00 ` lhyatt at gcc dot gnu.org
@ 2022-10-04  1:29 ` cvs-commit at gcc dot gnu.org
  2022-10-04  1:34 ` lhyatt at gcc dot gnu.org
  2022-10-19 20:29 ` lhyatt at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-04  1:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669

--- Comment #5 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:70e3f71a279856eabf99bbc92c0345c3ad20b615

commit r13-3051-g70e3f71a279856eabf99bbc92c0345c3ad20b615
Author: Lewis Hyatt <lhyatt@gmail.com>
Date:   Sat Oct 1 12:05:13 2022 -0400

    diagnostics: Add test for fixed _Pragma location issue [PR91669]

    This PR related to _Pragma locations and diagnostic pragmas was fixed by a
    combination of r10-325 and r13-1596. Add missing test coverage.

    gcc/testsuite/ChangeLog:

            PR c/91669
            * c-c++-common/pr91669.c: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
       [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-10-04  1:29 ` cvs-commit at gcc dot gnu.org
@ 2022-10-04  1:34 ` lhyatt at gcc dot gnu.org
  2022-10-19 20:29 ` lhyatt at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2022-10-04  1:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669

Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Testcase has been added, resolving fixed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't
       [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-10-04  1:34 ` lhyatt at gcc dot gnu.org
@ 2022-10-19 20:29 ` lhyatt at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2022-10-19 20:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91669

Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |falemagn at gmail dot com

--- Comment #7 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
*** Bug 85153 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-19 20:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91669-4@http.gcc.gnu.org/bugzilla/>
2021-10-29 16:25 ` [Bug c/91669] #pragma's and _Pragma's work but _Pragma's used in an equivalent macro don't burnus at gcc dot gnu.org
2021-10-29 17:40 ` burnus at gcc dot gnu.org
2022-09-30 23:00 ` lhyatt at gcc dot gnu.org
2022-10-04  1:29 ` cvs-commit at gcc dot gnu.org
2022-10-04  1:34 ` lhyatt at gcc dot gnu.org
2022-10-19 20:29 ` 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).