https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113582
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|incorrect warning about |incorrect warning about |unused label with `pragma |unused label with `pragma |GCC diagnostic` inside a |GCC diagnostic` around the |template |unused label --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I originally thought this was due to a template but nope, it is to due with where the warning happens. Which is at the end of the function. That is this does not work: ``` void do_something(){ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-label" start:; #pragma GCC diagnostic pop } ``` But this causes the warning not to happen: ``` void do_something(){ start:; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-label" } #pragma GCC diagnostic pop ``` Note another way to remove the warning is just to mark the lable as unused with an attribute like: ``` [[gnu::unused]]start: ``` Which is slightly shorter than using the pragma too.