Hi,

that's based on https://users.suse.com/~mliska/clang-warnings.txt
which has for omp-grid.c:

/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang/build/gcc/omp-grid.c:1070:7:
 warning: comparison of two values with different enumeration types in switch 
statement ('enum tree_code' and 'omp_clause_code') [-Wenum-compare-switch]
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang/build/gcc/omp-grid.c:1081:7:
 warning: comparison of two values with different enumeration types in switch 
statement ('enum tree_code' and 'omp_clause_code') [-Wenum-compare-switch]
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang/build/gcc/omp-grid.c:1082:7:
 warning: comparison of two values with different enumeration types in switch 
statement ('enum tree_code' and 'omp_clause_code') [-Wenum-compare-switch]
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang/build/gcc/omp-grid.c:1083:7:
 warning: comparison of two values with different enumeration types in switch 
statement ('enum tree_code' and 'omp_clause_code') [-Wenum-compare-switch]

Those are all for the same switch statement;

gomp_for contains 'tree clauses' and this clauses's '->code' is used
to handle store 'enum omp_clauses_code' values in in gimple.{h,c}.

I think adding this cast (and only this one) makes sense and it
also silences a (clang) compiler warning.

OK?

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
omp-grid.c – add cast to silence different enumeration types warning

	* omp-grid.c (grid_eliminate_combined_simd_part): Add cast
	to omp_clause_code to silence compiler warning.

diff --git a/gcc/omp-grid.c b/gcc/omp-grid.c
index b98e45de6a0..878977da2f9 100644
--- a/gcc/omp-grid.c
+++ b/gcc/omp-grid.c
@@ -1058,21 +1058,21 @@ grid_eliminate_combined_simd_part (gomp_for *parloop)
   while (*tgt)
     tgt = &OMP_CLAUSE_CHAIN (*tgt);
 
   /* Copy over all clauses, except for linear clauses, which are turned into
      private clauses, and all other simd-specific clauses, which are
      ignored.  */
   tree *pc = gimple_omp_for_clauses_ptr (simd);
   while (*pc)
     {
       tree c = *pc;
-      switch (TREE_CODE (c))
+      switch ((omp_clause_code) TREE_CODE (c))
 	{
 	case OMP_CLAUSE_LINEAR:
 	  {
 	    tree priv = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE_PRIVATE);
 	    OMP_CLAUSE_DECL (priv) = OMP_CLAUSE_DECL (c);
 	    OMP_CLAUSE_CHAIN (priv) = NULL;
 	    *tgt = priv;
 	    tgt = &OMP_CLAUSE_CHAIN (priv);
 	    pc = &OMP_CLAUSE_CHAIN (c);
 	    break;

Reply via email to