diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2016-05-24 16:00:39 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2016-05-24 16:00:39 +0200 |
commit | a04e69c0b12712bb90762dd20d7ffcd6f04e1da6 (patch) | |
tree | b2e6b36f6d180f94e905249d21e046a58742d204 /gcc/c/c-parser.c | |
parent | d4b5c77d36f4a0957fa6053eaa0cb42a8af650e9 (diff) | |
download | gcc-a04e69c0b12712bb90762dd20d7ffcd6f04e1da6.zip gcc-a04e69c0b12712bb90762dd20d7ffcd6f04e1da6.tar.gz gcc-a04e69c0b12712bb90762dd20d7ffcd6f04e1da6.tar.bz2 |
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.
From-SVN: r236639
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index c2c8314..1bc5eed 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. */ |