[gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h)

Thomas Schwinge thomas@codesourcery.com
Tue Jan 13 11:15:00 GMT 2015


Hi!

On Mon, 12 Jan 2015 17:39:16 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Jan 12, 2015 at 05:32:14PM +0100, Thomas Schwinge wrote:
> > I have now committed the patch to gomp-4_0-branch in the following form.
> > The issues raised above remain to be resolved.

(I'll try to address those later on.)


> > In spirit against the tree.h header flattening, I had to keep the
> > #include "include/gomp-constants.h" in gcc/tree-core.h, because otherwise
> > I'd have to add it to a ton of *.c files, just for the enum gomp_map_kind
> > definition.
> > 
> > I found that in the C++ dialect used by GCC, it is not possible to
> > declare an enum without giving the list of enumerators.  N2764 (from
> > 2008) resolved this by adding appropriate syntax for declaring enums,
> > however: "warning: scoped enums only available with -std=c++11 or
> > -std=gnu++11".  If it were possible to use this, we could add to
> > gcc/tree-core.h:
> > 
> >     enum gomp_map_kind : char;
> > 
> > ... (or similar), and this way decouple the declaration (gcc/tree-core.h)
> > From the actual "population of it" (include/gomp-constants.h).
> > Alternatively, in gcc/tree-core.h:struct tree_omp_clause, we could switch
> > the map_kind member from enum gomp_map_kind to a char -- but that would
> > defeat the usage of an enum (easy pretty-printing of its enumerators in
> > GDB, and so on.).
> 
> Or just don't do this and duplicate the constants and just assert somewhere
> (in omp-low.c) at compile time that all the values match.
> Either using char and casting the value only in the OMP_* macros
> or duplicating the values sound preferrable over including
> include/gomp-constants.h from tree-core.h.

Indeed I've found precedent in gcc/tree.h: there already are a few
*_SET_* functions, also used for casting to/from enum types.  Committed
to gomp-4_0-branch in r219524:

commit 7dbb7ec6c08d604926fca30e105d2b6411cf73cb
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Jan 13 10:50:01 2015 +0000

    Avoid inclusion of "gomp-constants.h" in gcc/tree-core.h.
    
    N2764 (from 2008) added syntax for declaring enums, however: "warning: scoped
    enums only available with -std=c++11 or -std=gnu++11": in the C++ dialect
    currently used by GCC, it is not possible to declare an enum without giving the
    full list of enumerators.  If it were possible to use this, we could add to
    gcc/tree-core.h:
    
        enum gomp_map_kind : unsigned char;
    
    ..., and keep using enum gomp_map_kind for gcc/tree-core.h's struct
    tree_omp_clause's map_kind member, and this way decouple the declaration
    (gcc/tree-core.h) from the actual "population of it"
    (include/gomp-constants.h).  Until switching GCC to C++11, we'll have to do as
    follows:
    
    	gcc/
    	* tree-core.h: Don't include "gomp-constants.h".
    	(struct tree_omp_clause): Change type of map_kind member from enum
    	gomp_map_kind to unsigned char.
    	* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
    	(OMP_CLAUSE_SET_MAP_KIND): New macro.
    	* gimplify.c (gimplify_adjust_omp_clauses_1)
    	(gimplify_adjust_omp_clauses): Use OMP_CLAUSE_SET_MAP_KIND.
    	* omp-low.c (oacc_initialize_reduction_data): Likewise.
    	* tree-nested.c (convert_nonlocal_reference_stmt)
    	(convert_local_reference_stmt, convert_gimple_call): Likewise.
    	* tree-streamer-in.c (unpack_ts_omp_clause_value_fields):
    	Likewise.
    	gcc/c/
    	* c-parser.c (c_parser_oacc_data_clause)
    	(c_parser_oacc_data_clause_deviceptr, c_parser_omp_clause_map):
    	Use OMP_CLAUSE_SET_MAP_KIND.
    	* c-typeck.c (handle_omp_array_sections): Likewise.
    	gcc/cp/
    	* parser.c (cp_parser_oacc_data_clause)
    	(cp_parser_oacc_data_clause_deviceptr, cp_parser_omp_clause_map):
    	Use OMP_CLAUSE_SET_MAP_KIND.
    	* semantics.c (handle_omp_array_sections): Likewise.
    	gcc/fortran/
    	* trans-openmp.c (gfc_omp_finish_clause, gfc_trans_omp_clauses):
    	Use OMP_CLAUSE_SET_MAP_KIND.
    
    	gcc/
    	* lto-streamer-out.c: Include "gomp-constants.h".
    	* tree-streamer-in.c: Likewise.
    	* tree-streamer-out.c: Likewise.
    	gcc/lto/
    	* lto.c: Include "gomp-constants.h".
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219524 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp         | 19 +++++++++++++++++++
 gcc/c/ChangeLog.gomp       |  7 +++++++
 gcc/c/c-parser.c           |  6 +++---
 gcc/c/c-typeck.c           |  2 +-
 gcc/cp/ChangeLog.gomp      |  7 +++++++
 gcc/cp/parser.c            |  6 +++---
 gcc/cp/semantics.c         |  4 ++--
 gcc/fortran/trans-openmp.c | 46 +++++++++++++++++++++++-----------------------
 gcc/gimplify.c             | 11 ++++++-----
 gcc/lto-streamer-out.c     |  1 +
 gcc/lto/ChangeLog.gomp     |  4 ++++
 gcc/lto/lto.c              |  1 +
 gcc/omp-low.c              |  2 +-
 gcc/tree-core.h            |  5 ++---
 gcc/tree-nested.c          |  6 +++---
 gcc/tree-streamer-in.c     |  6 ++++--
 gcc/tree-streamer-out.c    |  2 ++
 gcc/tree.h                 |  5 ++++-
 18 files changed, 93 insertions(+), 47 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index c627871..6ed6962 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,22 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* tree-core.h: Don't include "gomp-constants.h".
+	(struct tree_omp_clause): Change type of map_kind member from enum
+	gomp_map_kind to unsigned char.
+	* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
+	(OMP_CLAUSE_SET_MAP_KIND): New macro.
+	* gimplify.c (gimplify_adjust_omp_clauses_1)
+	(gimplify_adjust_omp_clauses): Use OMP_CLAUSE_SET_MAP_KIND.
+	* omp-low.c (oacc_initialize_reduction_data): Likewise.
+	* tree-nested.c (convert_nonlocal_reference_stmt)
+	(convert_local_reference_stmt, convert_gimple_call): Likewise.
+	* tree-streamer-in.c (unpack_ts_omp_clause_value_fields):
+	Likewise.
+
+	* lto-streamer-out.c: Include "gomp-constants.h".
+	* tree-streamer-in.c: Likewise.
+	* tree-streamer-out.c: Likewise.
+
 2015-01-12  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* tree-core.h (OMP_CLAUSE_MAP_ALLOC, OMP_CLAUSE_MAP_TO)
diff --git gcc/c/ChangeLog.gomp gcc/c/ChangeLog.gomp
index 84fd4ff..5a261a9 100644
--- gcc/c/ChangeLog.gomp
+++ gcc/c/ChangeLog.gomp
@@ -1,3 +1,10 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c-parser.c (c_parser_oacc_data_clause)
+	(c_parser_oacc_data_clause_deviceptr, c_parser_omp_clause_map):
+	Use OMP_CLAUSE_SET_MAP_KIND.
+	* c-typeck.c (handle_omp_array_sections): Likewise.
+
 2014-12-19  Jakub Jelinek  <jakub@redhat.com>
 
 	* c-parser.c (c_parser_omp_clause_name): Use PRAGMA_OACC_CLAUSE_*
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index b0c0280..fc6661b 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -10305,7 +10305,7 @@ c_parser_oacc_data_clause (c_parser *parser, pragma_omp_clause c_kind,
   nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   return nl;
 }
@@ -10341,7 +10341,7 @@ c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_SET_MAP_KIND (u, GOMP_MAP_FORCE_DEVICEPTR);
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -11414,7 +11414,7 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
   nl = c_parser_omp_variable_list (parser, clause_loc, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
   return nl;
diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
index 747e322..f39dfdd 100644
--- gcc/c/c-typeck.c
+++ gcc/c/c-typeck.c
@@ -11943,7 +11943,7 @@ handle_omp_array_sections (tree c)
 	return false;
       gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR);
       tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
+      OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_POINTER);
       if (!c_mark_addressable (t))
 	return false;
       OMP_CLAUSE_DECL (c2) = t;
diff --git gcc/cp/ChangeLog.gomp gcc/cp/ChangeLog.gomp
index dc7f30a..d4cd7a9 100644
--- gcc/cp/ChangeLog.gomp
+++ gcc/cp/ChangeLog.gomp
@@ -1,3 +1,10 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* parser.c (cp_parser_oacc_data_clause)
+	(cp_parser_oacc_data_clause_deviceptr, cp_parser_omp_clause_map):
+	Use OMP_CLAUSE_SET_MAP_KIND.
+	* semantics.c (handle_omp_array_sections): Likewise.
+
 2014-12-19  Jakub Jelinek  <jakub@redhat.com>
 
 	* parser.c (cp_parser_omp_clause_name): Use PRAGMA_OACC_CLAUSE_*
diff --git gcc/cp/parser.c gcc/cp/parser.c
index eaa6eee..1ce7de7 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -27962,7 +27962,7 @@ cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind,
   nl = cp_parser_omp_var_list (parser, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   return nl;
 }
@@ -27998,7 +27998,7 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_SET_MAP_KIND (u, GOMP_MAP_FORCE_DEVICEPTR);
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -28959,7 +28959,7 @@ cp_parser_omp_clause_map (cp_parser *parser, tree list)
 					  NULL);
 
   for (c = nlist; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   return nlist;
 }
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index fd37954..915048d 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -4671,7 +4671,7 @@ handle_omp_array_sections (tree c)
 	    return false;
 	  tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 				      OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
+	  OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_POINTER);
 	  if (!cxx_mark_addressable (t))
 	    return false;
 	  OMP_CLAUSE_DECL (c2) = t;
@@ -4695,7 +4695,7 @@ handle_omp_array_sections (tree c)
 	    {
 	      tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 					  OMP_CLAUSE_MAP);
-	      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
+	      OMP_CLAUSE_SET_MAP_KIND (c3, GOMP_MAP_POINTER);
 	      OMP_CLAUSE_DECL (c3) = ptr;
 	      OMP_CLAUSE_DECL (c2) = convert_from_reference (ptr);
 	      OMP_CLAUSE_SIZE (c3) = size_zero_node;
diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c
index c230f73..fe47a96 100644
--- gcc/fortran/trans-openmp.c
+++ gcc/fortran/trans-openmp.c
@@ -1046,7 +1046,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	return;
       tree orig_decl = decl;
       c4 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c4) = GOMP_MAP_POINTER;
+      OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_POINTER);
       OMP_CLAUSE_DECL (c4) = decl;
       OMP_CLAUSE_SIZE (c4) = size_int (0);
       decl = build_fold_indirect_ref (decl);
@@ -1057,7 +1057,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	      || GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl)))
 	{
 	  c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
+	  OMP_CLAUSE_SET_MAP_KIND (c3, GOMP_MAP_POINTER);
 	  OMP_CLAUSE_DECL (c3) = unshare_expr (decl);
 	  OMP_CLAUSE_SIZE (c3) = size_int (0);
 	  decl = build_fold_indirect_ref (decl);
@@ -1074,11 +1074,11 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
       ptr = build_fold_indirect_ref (ptr);
       OMP_CLAUSE_DECL (c) = ptr;
       c2 = build_omp_clause (input_location, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_TO_PSET;
+      OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_TO_PSET);
       OMP_CLAUSE_DECL (c2) = decl;
       OMP_CLAUSE_SIZE (c2) = TYPE_SIZE_UNIT (type);
       c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
+      OMP_CLAUSE_SET_MAP_KIND (c3, GOMP_MAP_POINTER);
       OMP_CLAUSE_DECL (c3) = gfc_conv_descriptor_data_get (decl);
       OMP_CLAUSE_SIZE (c3) = size_int (0);
       tree size = create_tmp_var (gfc_array_index_type);
@@ -1954,7 +1954,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      tree orig_decl = decl;
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node4, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -1964,7 +1964,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			{
 			  node3 = build_omp_clause (input_location,
 						    OMP_CLAUSE_MAP);
-			  OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+			  OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 			  OMP_CLAUSE_DECL (node3) = decl;
 			  OMP_CLAUSE_SIZE (node3) = size_int (0);
 			  decl = build_fold_indirect_ref (decl);
@@ -1980,12 +1980,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      OMP_CLAUSE_DECL (node) = ptr;
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
+		      OMP_CLAUSE_SET_MAP_KIND (node2, GOMP_MAP_TO_PSET);
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		      OMP_CLAUSE_SIZE (node3) = size_int (0);
@@ -2071,7 +2071,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		    {
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node4, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -2083,12 +2083,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      ptr2 = gfc_conv_descriptor_data_get (decl);
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
+		      OMP_CLAUSE_SET_MAP_KIND (node2, GOMP_MAP_TO_PSET);
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		    }
@@ -2103,7 +2103,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			}
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node3) = decl;
 		    }
 		  ptr2 = fold_convert (sizetype, ptr2);
@@ -2113,37 +2113,37 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 	      switch (n->u.map_op)
 		{
 		case OMP_MAP_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_ALLOC;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_ALLOC);
 		  break;
 		case OMP_MAP_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TO;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_TO);
 		  break;
 		case OMP_MAP_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FROM);
 		  break;
 		case OMP_MAP_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TOFROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_TOFROM);
 		  break;
 		case OMP_MAP_FORCE_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_ALLOC;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_ALLOC);
 		  break;
 		case OMP_MAP_FORCE_DEALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEALLOC;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_DEALLOC);
 		  break;
 		case OMP_MAP_FORCE_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TO;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_TO);
 		  break;
 		case OMP_MAP_FORCE_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_FROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_FROM);
 		  break;
 		case OMP_MAP_FORCE_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TOFROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_TOFROM);
 		  break;
 		case OMP_MAP_FORCE_PRESENT:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_PRESENT;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_PRESENT);
 		  break;
 		case OMP_MAP_FORCE_DEVICEPTR:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEVICEPTR;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_DEVICEPTR);
 		  break;
 		default:
 		  gcc_unreachable ();
diff --git gcc/gimplify.c gcc/gimplify.c
index cbbb9a7..da5f4da 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -6442,9 +6442,10 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
     OMP_CLAUSE_PRIVATE_OUTER_REF (clause) = 1;
   else if (code == OMP_CLAUSE_MAP)
     {
-      OMP_CLAUSE_MAP_KIND (clause) = flags & GOVD_MAP_TO_ONLY
-				     ? GOMP_MAP_TO
-				     : GOMP_MAP_TOFROM;
+      OMP_CLAUSE_SET_MAP_KIND (clause,
+			       flags & GOVD_MAP_TO_ONLY
+			       ? GOMP_MAP_TO
+			       : GOMP_MAP_TOFROM);
       if (DECL_SIZE (decl)
 	  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 	{
@@ -6465,7 +6466,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
 				      OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (nc) = decl;
 	  OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	  OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
+	  OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER);
 	  OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (clause);
 	  OMP_CLAUSE_CHAIN (clause) = nc;
 	}
@@ -6639,7 +6640,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
 					  OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (nc) = decl;
 	      OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	      OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
+	      OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER);
 	      OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (c);
 	      OMP_CLAUSE_CHAIN (c) = nc;
 	      c = nc;
diff --git gcc/lto-streamer-out.c gcc/lto-streamer-out.c
index 21a78bb..f06bd26 100644
--- gcc/lto-streamer-out.c
+++ gcc/lto-streamer-out.c
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "streamer-hooks.h"
 #include "cfgloop.h"
 #include "builtins.h"
+#include "gomp-constants.h"
 
 
 static void lto_write_tree (struct output_block*, tree, bool);
diff --git gcc/lto/ChangeLog.gomp gcc/lto/ChangeLog.gomp
index a738a26..758419d 100644
--- gcc/lto/ChangeLog.gomp
+++ gcc/lto/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* lto.c: Include "gomp-constants.h".
+
 2014-03-20  Bernd Schmidt  <bernds@codesourcery.com>
 
 	From Michael Zolotukhin.
diff --git gcc/lto/lto.c gcc/lto/lto.c
index 96e5fd1..15d3f10 100644
--- gcc/lto/lto.c
+++ gcc/lto/lto.c
@@ -77,6 +77,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-inline.h"
 #include "params.h"
 #include "ipa-utils.h"
+#include "gomp-constants.h"
 
 
 /* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver.  */
diff --git gcc/omp-low.c gcc/omp-low.c
index 703816a..063bd52 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -9713,7 +9713,7 @@ oacc_initialize_reduction_data (tree clauses, tree nthreads,
       /* Add the reduction array to the list of clauses.  */
       tree x = array;
       t = build_omp_clause (gimple_location (ctx->stmt), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (t) = GOMP_MAP_FORCE_FROM;
+      OMP_CLAUSE_SET_MAP_KIND (t, GOMP_MAP_FORCE_FROM);
       OMP_CLAUSE_DECL (t) = x;
       OMP_CLAUSE_CHAIN (t) = NULL;
       if (oc)
diff --git gcc/tree-core.h gcc/tree-core.h
index 9d3c386..735ce5c 100644
--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -20,8 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TREE_CORE_H
 #define GCC_TREE_CORE_H
 
-#include "gomp-constants.h"
-
 /* This file contains all the data structures that define the 'tree' type.
    There are no accessor macros nor functions in this file. Only the
    basic data structures, extern declarations and type definitions.  */
@@ -1298,7 +1296,8 @@ struct GTY(()) tree_omp_clause {
     enum omp_clause_default_kind   default_kind;
     enum omp_clause_schedule_kind  schedule_kind;
     enum omp_clause_depend_kind    depend_kind;
-    enum gomp_map_kind		   map_kind;
+    /* See include/gomp-constants.h for enum gomp_map_kind's values.  */
+    unsigned char		   map_kind;
     enum omp_clause_proc_bind_kind proc_bind_kind;
     enum tree_code                 reduction_code;
   } GTY ((skip)) subcode;
diff --git gcc/tree-nested.c gcc/tree-nested.c
index 29326ed..6509af8 100644
--- gcc/tree-nested.c
+++ gcc/tree-nested.c
@@ -1406,7 +1406,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  decl = get_chain_decl (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = decl;
-	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TO;
+	  OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TO);
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -1972,7 +1972,7 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  (void) get_frame_type (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = info->frame_decl;
-	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TOFROM;
+	  OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM);
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (info->frame_decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -2413,7 +2413,7 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	    {
 	      c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (c) = decl;
-	      OMP_CLAUSE_MAP_KIND (c) = i ? GOMP_MAP_TO : GOMP_MAP_TOFROM;
+	      OMP_CLAUSE_SET_MAP_KIND (c, i ? GOMP_MAP_TO : GOMP_MAP_TOFROM);
 	      OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	      OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	      gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt),
diff --git gcc/tree-streamer-in.c gcc/tree-streamer-in.c
index c3090fb..67d33ed 100644
--- gcc/tree-streamer-in.c
+++ gcc/tree-streamer-in.c
@@ -59,6 +59,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "lto-streamer.h"
 #include "builtins.h"
 #include "ipa-chkp.h"
+#include "gomp-constants.h"
+
 
 /* Read a STRING_CST from the string table in DATA_IN using input
    block IB.  */
@@ -435,8 +437,8 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in,
 	= bp_unpack_enum (bp, omp_clause_depend_kind, OMP_CLAUSE_DEPEND_LAST);
       break;
     case OMP_CLAUSE_MAP:
-      OMP_CLAUSE_MAP_KIND (expr)
-	= bp_unpack_enum (bp, gomp_map_kind, GOMP_MAP_LAST);
+      OMP_CLAUSE_SET_MAP_KIND (expr, bp_unpack_enum (bp, gomp_map_kind,
+						     GOMP_MAP_LAST));
       break;
     case OMP_CLAUSE_PROC_BIND:
       OMP_CLAUSE_PROC_BIND_KIND (expr)
diff --git gcc/tree-streamer-out.c gcc/tree-streamer-out.c
index de59d92..3669680 100644
--- gcc/tree-streamer-out.c
+++ gcc/tree-streamer-out.c
@@ -55,6 +55,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-streamer.h"
 #include "data-streamer.h"
 #include "streamer-hooks.h"
+#include "gomp-constants.h"
+
 
 /* Output the STRING constant to the string
    table in OB.  Then put the index onto the INDEX_STREAM.  */
diff --git gcc/tree.h gcc/tree.h
index fd731e8..51c9429 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -1390,7 +1390,10 @@ extern void protected_set_expr_location (tree, location_t);
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEPEND)->omp_clause.subcode.depend_kind)
 
 #define OMP_CLAUSE_MAP_KIND(NODE) \
-  (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
+  ((enum gomp_map_kind) OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
+#define OMP_CLAUSE_SET_MAP_KIND(NODE, MAP_KIND) \
+  (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind \
+   = (unsigned char) (MAP_KIND))
 
 /* Nonzero if this map clause is for array (rather than pointer) based array
    section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and corresponding


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150113/f67bc332/attachment.sig>


More information about the Gcc-patches mailing list