Tobias Burnus:
[…} Additionally, I added the 6.x entries (comment out) -
similar to the current list, which also contains
unimplemented comment-out entries.

... and immediately found a copy'n'paste issue for Fortran's "workdistribute". (Now fixed.)

Any comments? If not, I will commit it later today.

Otherwise, this still applies.

Tobias
OpenMP: Update directive arrays used for 'omp assume(s)' with contains/absent

Both Fortran and C/C++ have an array with classifications of directives;
currently, this array is only used to handle the restrictions of the
contains/absent clauses to the assume/assumes directives.

For C/C++, uncommenting 'declare mapper' was missed. Additionally,
'end ...' is a directive but not a directive name; hence, those
are now rejected as 'unknown directive' instead of as 'invalid'
directive.

Additionally, both lists now list newer entries (commented out) for
OpenMP 6.x - and a note (comment) was added for C/C++'s
'begin metadirective' and for Fortran's 'allocate', respectively.

gcc/c-family/ChangeLog:

	* c-omp.cc (c_omp_directives): Uncomment 'declare mapper',
	add comment to 'begin metadirective', add 6.x unimplemented
	directives as comment-out entries.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_assumption_clauses): Switch to
	'unknown' not 'invalid' directive name for end directives.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_assumption_clauses): Switch to
	'unknown' not 'invalid' directive name for end directives.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_omp_directive): Add comment to 'allocate';
	add 6.x unimplemented directives as comment-out entries.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/assumes-2.c: Change for 'invalid'
	to 'unknown' change for end directives.
	* c-c++-common/gomp/begin-assumes-2.c: Likewise.
	* c-c++-common/gomp/assume-2.c: Likewise. Check 'declare
	mapper'.

 gcc/c-family/c-omp.cc                             | 23 +++++++++++++++++++++--
 gcc/c/c-parser.cc                                 |  1 +
 gcc/cp/parser.cc                                  |  7 ++++---
 gcc/fortran/openmp.cc                             | 10 ++++++++++
 gcc/testsuite/c-c++-common/gomp/assume-2.c        |  4 +++-
 gcc/testsuite/c-c++-common/gomp/assumes-2.c       |  2 +-
 gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c |  2 +-
 7 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc
index fe272888c51..3c2ee9ff1ae 100644
--- a/gcc/c-family/c-omp.cc
+++ b/gcc/c-family/c-omp.cc
@@ -4604,6 +4604,9 @@ const struct c_omp_directive c_omp_directives[] = {
     C_OMP_DIR_DECLARATIVE, false },
   /* { "begin", "declare", "variant", PRAGMA_OMP_BEGIN,
     C_OMP_DIR_DECLARATIVE, false }, */
+  /* 'begin metadirective' is not yet implemented; however,
+     it is only applicable if an end-directive exists, but
+     metadirectives are of limited use for declarative directives.  */
   /* { "begin", "metadirective", nullptr, PRAGMA_OMP_BEGIN,
     C_OMP_DIR_META, false },  */
   { "cancel", nullptr, nullptr, PRAGMA_OMP_CANCEL,
@@ -4612,8 +4615,10 @@ const struct c_omp_directive c_omp_directives[] = {
     C_OMP_DIR_STANDALONE, false },
   { "critical", nullptr, nullptr, PRAGMA_OMP_CRITICAL,
     C_OMP_DIR_CONSTRUCT, false },
-  /* { "declare", "mapper", nullptr, PRAGMA_OMP_DECLARE,
-    C_OMP_DIR_DECLARATIVE, false },  */
+  /* { "declare", "induction", nullptr, PRAGMA_OMP_DECLARE,
+    C_OMP_DIR_DECLARATIVE, true }, */
+  { "declare", "mapper", nullptr, PRAGMA_OMP_DECLARE,
+    C_OMP_DIR_DECLARATIVE, false },
   { "declare", "reduction", nullptr, PRAGMA_OMP_DECLARE,
     C_OMP_DIR_DECLARATIVE, true },
   { "declare", "simd", nullptr, PRAGMA_OMP_DECLARE,
@@ -4639,12 +4644,18 @@ const struct c_omp_directive c_omp_directives[] = {
   /* error with at(execution) is C_OMP_DIR_STANDALONE.  */
   { "error", nullptr, nullptr, PRAGMA_OMP_ERROR,
     C_OMP_DIR_UTILITY, false },
+  /* { "flatten", nullptr, nullptr, PRAGMA_OMP_FLATTEN,
+    C_OMP_DIR_CONSTRUCT, true },  */
   { "flush", nullptr, nullptr, PRAGMA_OMP_FLUSH,
     C_OMP_DIR_STANDALONE, false },
   { "for", nullptr, nullptr, PRAGMA_OMP_FOR,
     C_OMP_DIR_CONSTRUCT, true },
+  /* { "fuse", nullptr, nullptr, PRAGMA_OMP_FUSE,
+    C_OMP_DIR_CONSTRUCT, true },  */
   /* { "groupprivate", nullptr, nullptr, PRAGMA_OMP_GROUPPRIVATE,
     C_OMP_DIR_DECLARATIVE, false },  */
+  /* { "interchange", nullptr, nullptr, PRAGMA_OMP_INTERCHANGE,
+    C_OMP_DIR_CONSTRUCT, true },  */
   { "interop", nullptr, nullptr, PRAGMA_OMP_INTEROP,
     C_OMP_DIR_STANDALONE, false },
   { "loop", nullptr, nullptr, PRAGMA_OMP_LOOP,
@@ -4676,6 +4687,10 @@ const struct c_omp_directive c_omp_directives[] = {
     C_OMP_DIR_CONSTRUCT, true },
   { "single", nullptr, nullptr, PRAGMA_OMP_SINGLE,
     C_OMP_DIR_CONSTRUCT, false },
+  /* { "split", nullptr, nullptr, PRAGMA_OMP_SPLIT,
+    C_OMP_DIR_CONSTRUCT, true },  */
+  /* { "stripe", nullptr, nullptr, PRAGMA_OMP_STRIPE,
+    C_OMP_DIR_CONSTRUCT, true },  */
   { "target", "data", nullptr, PRAGMA_OMP_TARGET,
     C_OMP_DIR_CONSTRUCT, false },
   { "target", "enter", "data", PRAGMA_OMP_TARGET,
@@ -4688,6 +4703,10 @@ const struct c_omp_directive c_omp_directives[] = {
     C_OMP_DIR_CONSTRUCT, true },
   { "task", nullptr, nullptr, PRAGMA_OMP_TASK,
     C_OMP_DIR_CONSTRUCT, false },
+  /* { "task", "iteration", nullptr, PRAGMA_OMP_TASK_ITERATION,
+    C_OMP_DIR_STANDALONE, false },  */
+  /* { "taskgraph", nullptr, nullptr, PRAGMA_OMP_TASKGRAPH,
+    C_OMP_DIR_CONSTRUCT, false },  */
   { "taskgroup", nullptr, nullptr, PRAGMA_OMP_TASKGROUP,
     C_OMP_DIR_CONSTRUCT, false },
   { "taskloop", nullptr, nullptr, PRAGMA_OMP_TASKLOOP,
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index ea0294f0738..dfee421165a 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -29480,6 +29480,7 @@ c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume)
 						      directive[1],
 						      directive[2]);
 		      if (dir
+			  && dir->id != PRAGMA_OMP_END
 			  && (dir->kind == C_OMP_DIR_DECLARATIVE
 			      || dir->kind == C_OMP_DIR_INFORMATIONAL
 			      || dir->kind == C_OMP_DIR_META))
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 9280632d47b..e5d5d92cb8e 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -51233,6 +51233,7 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
 						      directive[1],
 						      directive[2]);
 		      if (dir
+			  && dir->id != PRAGMA_OMP_END
 			  && (dir->kind == C_OMP_DIR_DECLARATIVE
 			      || dir->kind == C_OMP_DIR_INFORMATIONAL
 			      || dir->kind == C_OMP_DIR_META))
@@ -51241,9 +51242,9 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
 					"informational, and meta directives "
 					"not permitted", p);
 		      else if (dir == NULL
-			  || dir->id == PRAGMA_OMP_END
-			  || (!dir->second && directive[1])
-			  || (!dir->third && directive[2]))
+			       || dir->id == PRAGMA_OMP_END
+			       || (!dir->second && directive[1])
+			       || (!dir->third && directive[2]))
 			error_at (dloc, "unknown OpenMP directive name in "
 					"%qs clause argument", p);
 		      else
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 9e282c7b9f1..6c6ffdaf343 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -59,6 +59,7 @@ struct gfc_omp_directive {
    and "nothing".  */
 
 static const struct gfc_omp_directive gfc_omp_directives[] = {
+  /* allocate as alias for allocators is also executive. */
   {"allocate", GFC_OMP_DIR_DECLARATIVE, ST_OMP_ALLOCATE},
   {"allocators", GFC_OMP_DIR_EXECUTABLE, ST_OMP_ALLOCATORS},
   {"assumes", GFC_OMP_DIR_INFORMATIONAL, ST_OMP_ASSUMES},
@@ -68,6 +69,7 @@ static const struct gfc_omp_directive gfc_omp_directives[] = {
   {"cancellation point", GFC_OMP_DIR_EXECUTABLE, ST_OMP_CANCELLATION_POINT},
   {"cancel", GFC_OMP_DIR_EXECUTABLE, ST_OMP_CANCEL},
   {"critical", GFC_OMP_DIR_EXECUTABLE, ST_OMP_CRITICAL},
+  /* {"declare induction", GFC_OMP_DIR_DECLARATIVE, ST_OMP_DECLARE_INDUCTION}, */
   /* {"declare mapper", GFC_OMP_DIR_DECLARATIVE, ST_OMP_DECLARE_MAPPER}, */
   {"declare reduction", GFC_OMP_DIR_DECLARATIVE, ST_OMP_DECLARE_REDUCTION},
   {"declare simd", GFC_OMP_DIR_DECLARATIVE, ST_OMP_DECLARE_SIMD},
@@ -79,7 +81,10 @@ static const struct gfc_omp_directive gfc_omp_directives[] = {
   {"do", GFC_OMP_DIR_EXECUTABLE, ST_OMP_DO},
   /* "error" becomes GFC_OMP_DIR_EXECUTABLE with at(execution) */
   {"error", GFC_OMP_DIR_UTILITY, ST_OMP_ERROR},
+  /* {"flatten", GFC_OMP_DIR_EXECUTABLE, ST_OMP_FLATTEN}, */
   {"flush", GFC_OMP_DIR_EXECUTABLE, ST_OMP_FLUSH},
+  /* {"fuse", GFC_OMP_DIR_EXECUTABLE, ST_OMP_FLUSE}, */
+  /* {"interchange", GFC_OMP_DIR_EXECUTABLE, ST_OMP_INTERCHANGE}, */
   {"interop", GFC_OMP_DIR_EXECUTABLE, ST_OMP_INTEROP},
   {"loop", GFC_OMP_DIR_EXECUTABLE, ST_OMP_LOOP},
   {"masked", GFC_OMP_DIR_EXECUTABLE, ST_OMP_MASKED},
@@ -98,11 +103,15 @@ static const struct gfc_omp_directive gfc_omp_directives[] = {
   {"section", GFC_OMP_DIR_SUBSIDIARY, ST_OMP_SECTION},
   {"simd", GFC_OMP_DIR_EXECUTABLE, ST_OMP_SIMD},
   {"single", GFC_OMP_DIR_EXECUTABLE, ST_OMP_SINGLE},
+  /* {"split", GFC_OMP_DIR_EXECUTABLE, ST_OMP_SPLIT}, */
+  /* {"strip", GFC_OMP_DIR_EXECUTABLE, ST_OMP_STRIP}, */
   {"target data", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TARGET_DATA},
   {"target enter data", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TARGET_ENTER_DATA},
   {"target exit data", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TARGET_EXIT_DATA},
   {"target update", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TARGET_UPDATE},
   {"target", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TARGET},
+  /* {"taskgraph", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TASKGRAPH}, */
+  /* {"task iteration", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TASK_ITERATION}, */
   {"taskloop", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TASKLOOP},
   {"taskwait", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TASKWAIT},
   {"taskyield", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TASKYIELD},
@@ -111,6 +120,7 @@ static const struct gfc_omp_directive gfc_omp_directives[] = {
   {"threadprivate", GFC_OMP_DIR_DECLARATIVE, ST_OMP_THREADPRIVATE},
   {"tile", GFC_OMP_DIR_EXECUTABLE, ST_OMP_TILE},
   {"unroll", GFC_OMP_DIR_EXECUTABLE, ST_OMP_UNROLL},
+  /* {"workdistribute", GFC_OMP_DIR_EXECUTABLE, ST_OMP_WORKDISTRIBUTE}, */
   {"workshare", GFC_OMP_DIR_EXECUTABLE, ST_OMP_WORKSHARE},
 };
 
diff --git a/gcc/testsuite/c-c++-common/gomp/assume-2.c b/gcc/testsuite/c-c++-common/gomp/assume-2.c
index 95a65fd06ce..2cc066f4604 100644
--- a/gcc/testsuite/c-c++-common/gomp/assume-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/assume-2.c
@@ -31,12 +31,14 @@ foo (int i, int *a)
   ;
   #pragma omp assume contains (begin assumes)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
   ;
-  #pragma omp assume contains (end assumes)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
+  #pragma omp assume contains (end assumes)			/* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
   ;
   #pragma omp assume contains (foo)				/* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
   ;
   #pragma omp assume absent (target enter something)		/* { dg-error "unknown OpenMP directive name in 'absent' clause argument" } */
   ;
+  #pragma omp assume contains (declare mapper)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument: declarative, informational, and meta directives not permitted" } */
+  ;
   #pragma omp assume foobar					/* { dg-error "expected assumption clause" } */
   ;
   #pragma omp assume ext_GCC_foobarbaz, ext_GCC_baz (1, 12, 1 < 17), no_parallelism	/* { dg-warning "unknown assumption clause 'ext_GCC_foobarbaz'" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/assumes-2.c b/gcc/testsuite/c-c++-common/gomp/assumes-2.c
index 68b88bed9e4..ee03b09df1d 100644
--- a/gcc/testsuite/c-c++-common/gomp/assumes-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/assumes-2.c
@@ -13,7 +13,7 @@
 #pragma omp assumes absent (assume)				/* { dg-error "invalid OpenMP directive name in 'absent' clause argument" } */
 #pragma omp assumes absent (assumes)				/* { dg-error "invalid OpenMP directive name in 'absent' clause argument" } */
 #pragma omp assumes contains (begin assumes)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
-#pragma omp assumes contains (end assumes)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
+#pragma omp assumes contains (end assumes)			/* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
 #pragma omp assumes contains (foo)				/* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
 #pragma omp assumes absent (target enter something)		/* { dg-error "unknown OpenMP directive name in 'absent' clause argument" } */
 #pragma omp assumes foobar					/* { dg-error "expected assumption clause" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c b/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c
index 66b91807808..189026d0237 100644
--- a/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c
@@ -43,7 +43,7 @@ void f14 (void) {}
 #pragma omp begin assumes contains (begin assumes)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
 void f15 (void) {}
 #pragma omp end assumes
-#pragma omp begin assumes contains (end assumes)			/* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
+#pragma omp begin assumes contains (end assumes)			/* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
 void f16 (void) {}
 #pragma omp end assumes
 #pragma omp begin assumes contains (foo)				/* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */

Reply via email to