https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85487
--- Comment #5 from Austin Morton <austinpmorton at gmail dot com> --- (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. https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553182.html I sent a patch to do exactly that in 2020 and it was not accepted. This seems like a very easy win. Both major competitors to GCC (clang and MSVC) implement this pragma exactly like in my patch (by completely ignoring it). As it stands today, this is plainly a deficiency in GCC when compared to its competition.