https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85487
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=61593 CC| |egallager at gcc dot gnu.org --- Comment #10 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #3) > The docs raise some questions. > > They say that a #pragma region must be ended by a #pragma endregion. Should > the compiler check that and issue a diagnostic otherwise? > > What is the form of the optional "name" that follows #pragma region? > > What if #pragma endregion is followed by preprocessor tokens, not just a > comment? > > If we don't care about validating anything, it's easy to make GCC completely > ignore those pragmas: > > --- a/gcc/c-family/c-pragma.cc > +++ b/gcc/c-family/c-pragma.cc > @@ -1218,6 +1218,15 @@ handle_pragma_message (cpp_reader *ARG_UNUSED(dummy)) > TREE_STRING_POINTER (message)); > } > > +/* Ignore a no-op pragma that GCC recognizes, but which has no effect. */ > +static void > +handle_pragma_ignore (cpp_reader *) > +{ > + tree x; > + while (pragma_lex (&x) != CPP_EOF) > + /* Ignore the rest of the line. */; > +} > + > /* Mark whether the current location is valid for a STDC pragma. */ > > static bool valid_location_for_stdc_pragma; > @@ -1633,6 +1642,9 @@ init_pragma (void) > c_register_pragma ("GCC", "pop_options", handle_pragma_pop_options); > c_register_pragma ("GCC", "reset_options", handle_pragma_reset_options); > > + c_register_pragma (0, "region", handle_pragma_ignore); > + c_register_pragma (0, "endregion", handle_pragma_ignore); > + > c_register_pragma ("STDC", "FLOAT_CONST_DECIMAL64", > handle_pragma_float_const_decimal64); > > > > This needs tests though. so, this seems relevant to bug 61593 too...