This is the mail archive of the gcc-patches@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]

Clarify PRAGMA_OACC_* and PRAGMA_OMP_*


Hi!

Looking at how OpenMP declare simd is handled in the C++ front end, I ran
into it being parsed for PRAGMA_OMP_DECLARE_REDUCTION, which got me
confused.  OK to commit the following to un-confuse this, in that
PRAGMA_OACC_* and PRAGMA_OMP_* don't describe what *eventually* is to be
parsed (which (nowadays?) is wrong for PRAGMA_OMP_DECLARE_REDUCTION,
anyway), but instead they describe what *so far* has been parsed.

commit fa557f6ad39992052decb413501c713db8ec59f0
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Jun 28 14:12:23 2016 +0200

    Clarify PRAGMA_OACC_* and PRAGMA_OMP_*
    
    	gcc/c-family/
    	* c-pragma.h (enum pragma_kind): Rename PRAGMA_OACC_ENTER_DATA to
    	PRAGMA_OACC_ENTER, PRAGMA_OACC_EXIT_DATA to PRAGMA_OACC_EXIT,
    	PRAGMA_OMP_CANCELLATION_POINT to PRAGMA_OMP_CANCELLATION,
    	PRAGMA_OMP_DECLARE_REDUCTION to PRAGMA_OMP_DECLARE,
    	PRAGMA_OMP_END_DECLARE_TARGET to PRAGMA_OMP_END.  Adjust all
    	users.
---
 gcc/c-family/c-pragma.c | 10 +++++-----
 gcc/c-family/c-pragma.h | 10 +++++-----
 gcc/c/c-parser.c        | 12 ++++++------
 gcc/cp/parser.c         | 16 ++++++++--------
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git gcc/c-family/c-pragma.c gcc/c-family/c-pragma.c
index c73aa82..093b1a1 100644
--- gcc/c-family/c-pragma.c
+++ gcc/c-family/c-pragma.c
@@ -1256,8 +1256,8 @@ static const struct omp_pragma_def oacc_pragmas[] = {
   { "cache", PRAGMA_OACC_CACHE },
   { "data", PRAGMA_OACC_DATA },
   { "declare", PRAGMA_OACC_DECLARE },
-  { "enter", PRAGMA_OACC_ENTER_DATA },
-  { "exit", PRAGMA_OACC_EXIT_DATA },
+  { "enter", PRAGMA_OACC_ENTER },
+  { "exit", PRAGMA_OACC_EXIT },
   { "host_data", PRAGMA_OACC_HOST_DATA },
   { "kernels", PRAGMA_OACC_KERNELS },
   { "loop", PRAGMA_OACC_LOOP },
@@ -1270,9 +1270,9 @@ static const struct omp_pragma_def omp_pragmas[] = {
   { "atomic", PRAGMA_OMP_ATOMIC },
   { "barrier", PRAGMA_OMP_BARRIER },
   { "cancel", PRAGMA_OMP_CANCEL },
-  { "cancellation", PRAGMA_OMP_CANCELLATION_POINT },
+  { "cancellation", PRAGMA_OMP_CANCELLATION },
   { "critical", PRAGMA_OMP_CRITICAL },
-  { "end", PRAGMA_OMP_END_DECLARE_TARGET },
+  { "end", PRAGMA_OMP_END },
   { "flush", PRAGMA_OMP_FLUSH },
   { "master", PRAGMA_OMP_MASTER },
   { "ordered", PRAGMA_OMP_ORDERED },
@@ -1286,7 +1286,7 @@ static const struct omp_pragma_def omp_pragmas[] = {
   { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
 };
 static const struct omp_pragma_def omp_pragmas_simd[] = {
-  { "declare", PRAGMA_OMP_DECLARE_REDUCTION },
+  { "declare", PRAGMA_OMP_DECLARE },
   { "distribute", PRAGMA_OMP_DISTRIBUTE },
   { "for", PRAGMA_OMP_FOR },
   { "parallel", PRAGMA_OMP_PARALLEL },
diff --git gcc/c-family/c-pragma.h gcc/c-family/c-pragma.h
index 65f10db..9f70a3f 100644
--- gcc/c-family/c-pragma.h
+++ gcc/c-family/c-pragma.h
@@ -31,8 +31,8 @@ enum pragma_kind {
   PRAGMA_OACC_CACHE,
   PRAGMA_OACC_DATA,
   PRAGMA_OACC_DECLARE,
-  PRAGMA_OACC_ENTER_DATA,
-  PRAGMA_OACC_EXIT_DATA,
+  PRAGMA_OACC_ENTER,
+  PRAGMA_OACC_EXIT,
   PRAGMA_OACC_HOST_DATA,
   PRAGMA_OACC_KERNELS,
   PRAGMA_OACC_LOOP,
@@ -44,11 +44,11 @@ enum pragma_kind {
   PRAGMA_OMP_ATOMIC,
   PRAGMA_OMP_BARRIER,
   PRAGMA_OMP_CANCEL,
-  PRAGMA_OMP_CANCELLATION_POINT,
+  PRAGMA_OMP_CANCELLATION,
   PRAGMA_OMP_CRITICAL,
-  PRAGMA_OMP_DECLARE_REDUCTION,
+  PRAGMA_OMP_DECLARE,
   PRAGMA_OMP_DISTRIBUTE,
-  PRAGMA_OMP_END_DECLARE_TARGET,
+  PRAGMA_OMP_END,
   PRAGMA_OMP_FLUSH,
   PRAGMA_OMP_FOR,
   PRAGMA_OMP_MASTER,
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index 7f491f1..ccdd043 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -10108,11 +10108,11 @@ c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p)
       c_parser_oacc_declare (parser);
       return false;
 
-    case PRAGMA_OACC_ENTER_DATA:
+    case PRAGMA_OACC_ENTER:
       c_parser_oacc_enter_exit_data (parser, true);
       return false;
 
-    case PRAGMA_OACC_EXIT_DATA:
+    case PRAGMA_OACC_EXIT:
       c_parser_oacc_enter_exit_data (parser, false);
       return false;
 
@@ -10186,7 +10186,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p)
       c_parser_omp_cancel (parser);
       return false;
 
-    case PRAGMA_OMP_CANCELLATION_POINT:
+    case PRAGMA_OMP_CANCELLATION:
       if (context != pragma_compound)
 	{
 	  if (context == pragma_stmt)
@@ -10204,7 +10204,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p)
     case PRAGMA_OMP_TARGET:
       return c_parser_omp_target (parser, context, if_p);
 
-    case PRAGMA_OMP_END_DECLARE_TARGET:
+    case PRAGMA_OMP_END:
       c_parser_omp_end_declare_target (parser);
       return false;
 
@@ -10215,7 +10215,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p)
       c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
       return false;
 
-    case PRAGMA_OMP_DECLARE_REDUCTION:
+    case PRAGMA_OMP_DECLARE:
       c_parser_omp_declare (parser, context);
       return false;
 
@@ -16381,7 +16381,7 @@ c_parser_omp_declare_simd (c_parser *parser, enum pragma_context context)
   while (c_parser_next_token_is (parser, CPP_PRAGMA))
     {
       if (c_parser_peek_token (parser)->pragma_kind
-	  != PRAGMA_OMP_DECLARE_REDUCTION
+	  != PRAGMA_OMP_DECLARE
 	  || c_parser_peek_2nd_token (parser)->type != CPP_NAME
 	  || strcmp (IDENTIFIER_POINTER
 				(c_parser_peek_2nd_token (parser)->value),
diff --git gcc/cp/parser.c gcc/cp/parser.c
index d1f06fd..6a90706 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -36731,10 +36731,10 @@ cp_parser_omp_construct (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
     case PRAGMA_OACC_DATA:
       stmt = cp_parser_oacc_data (parser, pragma_tok, if_p);
       break;
-    case PRAGMA_OACC_ENTER_DATA:
+    case PRAGMA_OACC_ENTER:
       stmt = cp_parser_oacc_enter_exit_data (parser, pragma_tok, true);
       break;
-    case PRAGMA_OACC_EXIT_DATA:
+    case PRAGMA_OACC_EXIT:
       stmt = cp_parser_oacc_enter_exit_data (parser, pragma_tok, false);
       break;
     case PRAGMA_OACC_HOST_DATA:
@@ -37203,7 +37203,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
   parser->lexer->in_pragma = true;
 
   id = cp_parser_pragma_kind (pragma_tok);
-  if (id != PRAGMA_OMP_DECLARE_REDUCTION && id != PRAGMA_OACC_ROUTINE)
+  if (id != PRAGMA_OMP_DECLARE && id != PRAGMA_OACC_ROUTINE)
     cp_ensure_no_omp_declare_simd (parser);
   switch (id)
     {
@@ -37290,7 +37290,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
 	}
       break;
 
-    case PRAGMA_OMP_CANCELLATION_POINT:
+    case PRAGMA_OMP_CANCELLATION:
       switch (context)
 	{
 	case pragma_compound:
@@ -37310,7 +37310,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
       cp_parser_omp_threadprivate (parser, pragma_tok);
       return false;
 
-    case PRAGMA_OMP_DECLARE_REDUCTION:
+    case PRAGMA_OMP_DECLARE:
       cp_parser_omp_declare (parser, pragma_tok, context);
       return false;
 
@@ -37325,8 +37325,8 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
     case PRAGMA_OACC_ATOMIC:
     case PRAGMA_OACC_CACHE:
     case PRAGMA_OACC_DATA:
-    case PRAGMA_OACC_ENTER_DATA:
-    case PRAGMA_OACC_EXIT_DATA:
+    case PRAGMA_OACC_ENTER:
+    case PRAGMA_OACC_EXIT:
     case PRAGMA_OACC_HOST_DATA:
     case PRAGMA_OACC_KERNELS:
     case PRAGMA_OACC_PARALLEL:
@@ -37365,7 +37365,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
       pop_omp_privatization_clauses (stmt);
       return ret;
 
-    case PRAGMA_OMP_END_DECLARE_TARGET:
+    case PRAGMA_OMP_END:
       cp_parser_omp_end_declare_target (parser, pragma_tok);
       return false;
 


GrÃÃe
 Thomas


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