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

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
So input_location does not point to foo but to column 1, then the expansion
location of the pragmas is the closing paren because of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61817#c3

In terms of expanded locations, the code looks like this:

foo _Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic ignored
\"-Wdeprecated-declarations\"") static inline void bar (void) { (); } _Pragma
("GCC diagnostic pop")

But if we use input_location, it looks like everything, all pragmas and foo,
are at exactly column 1. This works as long as we do a linear search in the
history. If we ever try to do binary search, we would need to be careful with
duplicates. Also, I guess if we do:

_Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
_Pragma ("GCC diagnostic error \"-Wdeprecated-declarations\"")

then the second one doesn't work. I cannot think a way to make the above work
properly without breaking something else.

To keep the GCC 5 behaviour without using input_location, we would need to have
the location of foo at the time of handling the pragmas, which I don't see how
it is possible.

This seems too much at stage 3. I think your patch with some FIXME note
pointing here is fine for GCC 6. At least, we will get the same behavior as in
GCC 5 and this won't be a regression.

Reply via email to