Hi Martin,
On 28.10.21 18:28, Martin Sebor wrote:
There are a number of bug reports of _Pragma not working right
in macros, including (and especially) to control diagnostics:
https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=_Pragma%20macro&list_id=328003
Just by the description this change seems like it could also
fix some of them.
I think it does not help with them – or only partially.
I believe there currently still two issues:
* _Pragma("GCC foo") – when "foo" or "GCC foo" are
not registered is immediately processed, leading
to wrong placement in the output with "-E".
A probably not fully correct draft patch is attached to
https://gcc.gnu.org/PR90400 which fixes the issue
(misses a location before the #pragma).
* With _Pragma("GCC diagnostic") in macros the problem is:
The macro is replaced by all the macro code including the
#pragma and all other code in there.
By construction, all those have the same line. But if
else { b--;
#pragma GCC diagnostic push
;
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
; a--;
#pragma GCC diagnostic pop
; }
the location is the input_location of the expanded macro,
i.e. all code is in the same line. As the 'pop' check checks
whether the loc is before the pragma, it might pop too early
and the 'ignored' is already ignored for the 'a--' in this
example. Cf. https://gcc.gnu.org/PR91669
@Martin: As you seem to have spare cycles, how about spending
some time fixing either issue?
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht
München, HRB 106955