[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 gcc-bugzilla@gcc.gnu.org
Fri Oct 29 17:40:33 GMT 2021


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


More information about the Gcc-bugs mailing list