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]

[gomp4] Fix bootstrap


Hi!

Got a warning turned into error during bootstrap that name might be used
uninitialized.  Fixed by not using it at all, there is no point to duplicate
the clause names when we have omp_clause_code_name array.

2013-10-08  Jakub Jelinek  <jakub@redhat.com>

	* c-typeck.c (c_finish_omp_clauses): Remove name variable, use
	omp_clause_code_name[OMP_CLAUSE_CODE (c)] instead.

	* semantics.c (finish_omp_clauses): Remove name variable, use
	omp_clause_code_name[OMP_CLAUSE_CODE (c)] instead.

--- gcc/c/c-typeck.c.jj	2013-09-25 09:51:45.000000000 +0200
+++ gcc/c/c-typeck.c	2013-10-08 08:45:30.653081155 +0200
@@ -11233,7 +11233,6 @@ c_finish_omp_clauses (tree clauses)
   bitmap_head generic_head, firstprivate_head, lastprivate_head;
   bitmap_head aligned_head;
   tree c, t, *pc = &clauses;
-  const char *name;
   bool branch_seen = false;
   bool copyprivate_seen = false;
   tree *nowait_clause = NULL;
@@ -11253,18 +11252,15 @@ c_finish_omp_clauses (tree clauses)
       switch (OMP_CLAUSE_CODE (c))
 	{
 	case OMP_CLAUSE_SHARED:
-	  name = "shared";
 	  need_implicitly_determined = true;
 	  goto check_dup_generic;
 
 	case OMP_CLAUSE_PRIVATE:
-	  name = "private";
 	  need_complete = true;
 	  need_implicitly_determined = true;
 	  goto check_dup_generic;
 
 	case OMP_CLAUSE_REDUCTION:
-	  name = "reduction";
 	  need_implicitly_determined = true;
 	  t = OMP_CLAUSE_DECL (c);
 	  if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) == NULL_TREE
@@ -11377,7 +11373,6 @@ c_finish_omp_clauses (tree clauses)
 	  goto check_dup_generic;
 
 	case OMP_CLAUSE_COPYPRIVATE:
-	  name = "copyprivate";
 	  copyprivate_seen = true;
 	  if (nowait_clause)
 	    {
@@ -11390,7 +11385,6 @@ c_finish_omp_clauses (tree clauses)
 	  goto check_dup_generic;
 
 	case OMP_CLAUSE_COPYIN:
-	  name = "copyin";
 	  t = OMP_CLAUSE_DECL (c);
 	  if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t))
 	    {
@@ -11401,7 +11395,6 @@ c_finish_omp_clauses (tree clauses)
 	  goto check_dup_generic;
 
 	case OMP_CLAUSE_LINEAR:
-	  name = "linear";
 	  t = OMP_CLAUSE_DECL (c);
 	  if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
 	      && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE)
@@ -11429,7 +11422,8 @@ c_finish_omp_clauses (tree clauses)
 	  if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
 	    {
 	      error_at (OMP_CLAUSE_LOCATION (c),
-			"%qE is not a variable in clause %qs", t, name);
+			"%qE is not a variable in clause %qs", t,
+			omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
 	      remove = true;
 	    }
 	  else if (bitmap_bit_p (&generic_head, DECL_UID (t))
@@ -11445,7 +11439,6 @@ c_finish_omp_clauses (tree clauses)
 	  break;
 
 	case OMP_CLAUSE_FIRSTPRIVATE:
-	  name = "firstprivate";
 	  t = OMP_CLAUSE_DECL (c);
 	  need_complete = true;
 	  need_implicitly_determined = true;
@@ -11467,7 +11460,6 @@ c_finish_omp_clauses (tree clauses)
 	  break;
 
 	case OMP_CLAUSE_LASTPRIVATE:
-	  name = "lastprivate";
 	  t = OMP_CLAUSE_DECL (c);
 	  need_complete = true;
 	  need_implicitly_determined = true;
@@ -11694,7 +11686,8 @@ c_finish_omp_clauses (tree clauses)
 		{
 		  error_at (OMP_CLAUSE_LOCATION (c),
 			    "%qE is predetermined %qs for %qs",
-			    t, share_name, name);
+			    t, share_name,
+			    omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
 		  remove = true;
 		}
 	    }
--- gcc/cp/semantics.c.jj	2013-10-07 23:29:44.000000000 +0200
+++ gcc/cp/semantics.c	2013-10-08 08:44:15.766475978 +0200
@@ -5085,7 +5085,6 @@ finish_omp_clauses (tree clauses)
   bitmap_head generic_head, firstprivate_head, lastprivate_head;
   bitmap_head aligned_head;
   tree c, t, *pc = &clauses;
-  const char *name;
   bool branch_seen = false;
   bool copyprivate_seen = false;
 
@@ -5102,23 +5101,17 @@ finish_omp_clauses (tree clauses)
       switch (OMP_CLAUSE_CODE (c))
 	{
 	case OMP_CLAUSE_SHARED:
-	  name = "shared";
 	  goto check_dup_generic;
 	case OMP_CLAUSE_PRIVATE:
-	  name = "private";
 	  goto check_dup_generic;
 	case OMP_CLAUSE_REDUCTION:
-	  name = "reduction";
 	  goto check_dup_generic;
 	case OMP_CLAUSE_COPYPRIVATE:
-	  name = "copyprivate";
 	  copyprivate_seen = true;
 	  goto check_dup_generic;
 	case OMP_CLAUSE_COPYIN:
-	  name = "copyin";
 	  goto check_dup_generic;
 	case OMP_CLAUSE_LINEAR:
-	  name = "linear";
 	  t = OMP_CLAUSE_DECL (c);
 	  if (!type_dependent_expression_p (t)
 	      && !INTEGRAL_TYPE_P (TREE_TYPE (t))
@@ -5167,9 +5160,11 @@ finish_omp_clauses (tree clauses)
 	      if (processing_template_decl)
 		break;
 	      if (DECL_P (t))
-		error ("%qD is not a variable in clause %qs", t, name);
+		error ("%qD is not a variable in clause %qs", t,
+		       omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
 	      else
-		error ("%qE is not a variable in clause %qs", t, name);
+		error ("%qE is not a variable in clause %qs", t,
+		       omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
 	      remove = true;
 	    }
 	  else if (bitmap_bit_p (&generic_head, DECL_UID (t))
@@ -5607,39 +5602,32 @@ finish_omp_clauses (tree clauses)
       switch (c_kind)
 	{
 	case OMP_CLAUSE_SHARED:
-	  name = "shared";
 	  need_implicitly_determined = true;
 	  break;
 	case OMP_CLAUSE_PRIVATE:
-	  name = "private";
 	  need_complete_non_reference = true;
 	  need_default_ctor = true;
 	  need_dtor = true;
 	  need_implicitly_determined = true;
 	  break;
 	case OMP_CLAUSE_FIRSTPRIVATE:
-	  name = "firstprivate";
 	  need_complete_non_reference = true;
 	  need_copy_ctor = true;
 	  need_dtor = true;
 	  need_implicitly_determined = true;
 	  break;
 	case OMP_CLAUSE_LASTPRIVATE:
-	  name = "lastprivate";
 	  need_complete_non_reference = true;
 	  need_copy_assignment = true;
 	  need_implicitly_determined = true;
 	  break;
 	case OMP_CLAUSE_REDUCTION:
-	  name = "reduction";
 	  need_implicitly_determined = true;
 	  break;
 	case OMP_CLAUSE_COPYPRIVATE:
-	  name = "copyprivate";
 	  need_copy_assignment = true;
 	  break;
 	case OMP_CLAUSE_COPYIN:
-	  name = "copyin";
 	  need_copy_assignment = true;
 	  break;
 	case OMP_CLAUSE_NOWAIT:
@@ -5703,7 +5691,8 @@ finish_omp_clauses (tree clauses)
 	  else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
 		   && need_complete_non_reference)
 	    {
-	      error ("%qE has reference type for %qs", t, name);
+	      error ("%qE has reference type for %qs", t,
+		     omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
 	      remove = true;
 	    }
 	}
@@ -5733,7 +5722,7 @@ finish_omp_clauses (tree clauses)
 	  if (share_name)
 	    {
 	      error ("%qE is predetermined %qs for %qs",
-		     t, share_name, name);
+		     t, share_name, omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
 	      remove = true;
 	    }
 	}

	Jakub


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