aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-11-09 21:49:52 +0000
committerJonathan Wakely <jwakely@redhat.com>2022-11-11 04:00:58 +0000
commitd3fe767c16e7c528e4fc71c8a68ac14b4573d880 (patch)
tree6e2c1d83054da0462c94e21ff347c3ebf813003b /gcc/c-family
parent21de01f5554fa037f59b27525d2eb7342f5649c7 (diff)
downloadgcc-d3fe767c16e7c528e4fc71c8a68ac14b4573d880.zip
gcc-d3fe767c16e7c528e4fc71c8a68ac14b4573d880.tar.gz
gcc-d3fe767c16e7c528e4fc71c8a68ac14b4573d880.tar.bz2
c-family: Support #pragma region/endregion [PR85487]
These pragmas are used by some editors to mark regions of code for grouping and folding. GCC should silently ignore them, rather than giving -Wunknown-pragmas warnings. PR c/85487 gcc/ChangeLog: * doc/cpp/pragmas.rst (Pragmas): Document region pragmas. gcc/c-family/ChangeLog: * c-pragma.cc (handle_pragma_ignore): New function. (init_pragma): Register region and endregion pragmas. gcc/testsuite/ChangeLog: * c-c++-common/pragma-region.c: New test.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/c-pragma.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc
index b5a4b3c..142a464 100644
--- a/gcc/c-family/c-pragma.cc
+++ b/gcc/c-family/c-pragma.cc
@@ -1403,6 +1403,12 @@ handle_pragma_message (cpp_reader *)
TREE_STRING_POINTER (message));
}
+/* Ignore a no-op pragma that GCC recognizes, but which has no effect. */
+static void
+handle_pragma_ignore (cpp_reader *)
+{
+}
+
/* Mark whether the current location is valid for a STDC pragma. */
static bool valid_location_for_stdc_pragma;
@@ -1870,6 +1876,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);