aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2019-05-17 21:13:15 +0200
committerThomas Schwinge <tschwinge@gcc.gnu.org>2019-05-17 21:13:15 +0200
commit5bf04509f437ff175c001a1c84a13b3a845174eb (patch)
tree05c7809fb44b3510da14c00b79c3d9443f04d7d7 /gcc/c
parente03436e7ac2ddbbf397a6d64309b01ad37cfcadf (diff)
downloadgcc-5bf04509f437ff175c001a1c84a13b3a845174eb.zip
gcc-5bf04509f437ff175c001a1c84a13b3a845174eb.tar.gz
gcc-5bf04509f437ff175c001a1c84a13b3a845174eb.tar.bz2
[PR89433] Use 'oacc_verify_routine_clauses' for C/C++ OpenACC 'routine' directives
gcc/ PR middle-end/89433 * omp-general.c (oacc_build_routine_dims): Move some of its processing into... (oacc_verify_routine_clauses): ... this new function. * omp-general.h (oacc_verify_routine_clauses): New prototype. gcc/c/ PR c/89433 * c-parser.c (c_parser_oacc_routine): Normalize order of clauses. (c_finish_oacc_routine): Call oacc_verify_routine_clauses. gcc/cp/ PR c++/89433 * parser.c (cp_parser_oacc_routine) (cp_parser_late_parsing_oacc_routine): Normalize order of clauses. (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses. gcc/testsuite/ PR testsuite/89433 * c-c++-common/goacc/routine-2.c: Update, and move some test into... * c-c++-common/goacc/routine-level-of-parallelism-1.c: ... this new file. From-SVN: r271344
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-parser.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index f0cab2e..1393e8f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,6 +1,10 @@
2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
PR c/89433
+ * c-parser.c (c_parser_oacc_routine): Normalize order of clauses.
+ (c_finish_oacc_routine): Call oacc_verify_routine_clauses.
+
+ PR c/89433
* c-parser.c (c_finish_oacc_routine): Refer to OpenACC 'routine'
clauses from "omp declare target" attribute.
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 3cbbb19..8337f1c 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -15801,6 +15801,9 @@ c_parser_oacc_routine (c_parser *parser, enum pragma_context context)
data.clauses
= c_parser_oacc_all_clauses (parser, OACC_ROUTINE_CLAUSE_MASK,
"#pragma acc routine");
+ /* The clauses are in reverse order; fix that to make later diagnostic
+ emission easier. */
+ data.clauses = nreverse (data.clauses);
if (TREE_CODE (decl) != FUNCTION_DECL)
{
@@ -15815,6 +15818,9 @@ c_parser_oacc_routine (c_parser *parser, enum pragma_context context)
data.clauses
= c_parser_oacc_all_clauses (parser, OACC_ROUTINE_CLAUSE_MASK,
"#pragma acc routine");
+ /* The clauses are in reverse order; fix that to make later diagnostic
+ emission easier. */
+ data.clauses = nreverse (data.clauses);
/* Emit a helpful diagnostic if there's another pragma following this
one. Also don't allow a static assertion declaration, as in the
@@ -15878,6 +15884,8 @@ c_finish_oacc_routine (struct oacc_routine_data *data, tree fndecl,
return;
}
+ oacc_verify_routine_clauses (&data->clauses, data->loc);
+
if (oacc_get_fn_attrib (fndecl))
{
error_at (data->loc,