summaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authortschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-24 14:00:39 +0000
committertschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-24 14:00:39 +0000
commitc9d624bd2672463771546e73bf3d6446d64e43c0 (patch)
treeb2e6b36f6d180f94e905249d21e046a58742d204 /gcc/c
parentdb2faf44643c3331647dd17993aa5c92b191c5eb (diff)
downloadgcc-c9d624bd2672463771546e73bf3d6446d64e43c0.tar.gz
Tighten syntax checking for OpenACC routine construct in C
gcc/c/ * c-parser.c (c_parser_oacc_routine): Tighten syntax checks. gcc/testsuite/ * c-c++-common/goacc/routine-5.c: Add tests. * g++.dg/goacc/routine-2.C: Remove duplicate tests. * gfortran.dg/goacc/routine-6.f90: Add tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236639 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-parser.c19
2 files changed, 13 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 9bb5ec1dfce..3d69cd57949 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,7 @@
+2016-05-24 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-parser.c (c_parser_oacc_routine): Tighten syntax checks.
+
2016-05-24 Richard Biener <rguenther@suse.de>
PR middle-end/70434
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c2c83143c05..1bc5eed7f55 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -13983,25 +13983,24 @@ c_parser_oacc_routine (c_parser *parser, enum pragma_context context)
c_parser_consume_token (parser);
c_token *token = c_parser_peek_token (parser);
-
if (token->type == CPP_NAME && (token->id_kind == C_ID_ID
|| token->id_kind == C_ID_TYPENAME))
{
decl = lookup_name (token->value);
if (!decl)
- {
- error_at (token->location, "%qE has not been declared",
- token->value);
- decl = error_mark_node;
- }
+ error_at (token->location, "%qE has not been declared",
+ token->value);
+ c_parser_consume_token (parser);
}
else
c_parser_error (parser, "expected function name");
- if (token->type != CPP_CLOSE_PAREN)
- c_parser_consume_token (parser);
-
- c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, 0);
+ if (!decl
+ || !c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
+ {
+ c_parser_skip_to_pragma_eol (parser, false);
+ return;
+ }
}
/* Build a chain of clauses. */