This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/63326] whether a #pragma is a statement depends on the type of pragma


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

--- Comment #17 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
I guess the diff below should be OK, I shall give a make check test.

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 7b10764..2666657 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -5170,7 +5170,9 @@ c_parser_statement_after_labels (c_parser *parser,
vec<tree> *chain)
       c_parser_consume_token (parser);
       break;
     case CPP_PRAGMA:
-      c_parser_pragma (parser, pragma_stmt);
+      c_parser_error (parser,
+                     "don't allow if, while, do, swith, or label"
+                    );
       break;
     default:
     expr_stmt:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]