diff mbox series

C/C++: Fix unused set var warning with omp_clause_affinity [PR100913]

Message ID bb457116-bbde-d8b9-1bce-d7aaeebc125c@codesourcery.com
State New
Headers show
Series C/C++: Fix unused set var warning with omp_clause_affinity [PR100913] | expand

Commit Message

Tobias Burnus June 14, 2021, 12:34 p.m. UTC
Rather obvious fix for a warning found by David via cppcheck.

OK?

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

Comments

Jakub Jelinek June 14, 2021, 12:36 p.m. UTC | #1
On Mon, Jun 14, 2021 at 02:34:53PM +0200, Tobias Burnus wrote:
> Rather obvious fix for a warning found by David via cppcheck.
> 
> OK?
> 
> Tobias
> 
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

> C/C++: Fix unused set var warning with omp_clause_affinity [PR100913]
> 
> 	PR c/100913
> gcc/c/ChangeLog:
> 
> 	* c-parser.c (c_parser_omp_clause_affinity): No need to set iterator
> 	var in the error case.
> 
> gcc/cp/ChangeLog:
> 
> 	* parser.c (cp_parser_omp_clause_affinity): No need to set iterator
> 	var in the error case.

Ok.

	Jakub
diff mbox series

Patch

C/C++: Fix unused set var warning with omp_clause_affinity [PR100913]

	PR c/100913
gcc/c/ChangeLog:

	* c-parser.c (c_parser_omp_clause_affinity): No need to set iterator
	var in the error case.

gcc/cp/ChangeLog:

	* parser.c (cp_parser_omp_clause_affinity): No need to set iterator
	var in the error case.

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index add33532a60..b90710cba2f 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -15590,21 +15590,19 @@  c_parser_omp_clause_affinity (c_parser *parser, tree list)
 	      return list;
 	    }
 	}
     }
   nl = c_parser_omp_variable_list (parser, clause_loc, OMP_CLAUSE_AFFINITY,
 				   list);
   if (iterators)
     {
       tree block = pop_scope ();
-      if (iterators == error_mark_node)
-	iterators = NULL_TREE;
-      else
+      if (iterators != error_mark_node)
 	{
 	  TREE_VEC_ELT (iterators, 5) = block;
 	  for (tree c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
 	    OMP_CLAUSE_DECL (c) = build_tree_list (iterators,
 						   OMP_CLAUSE_DECL (c));
 	}
     }
 
   parens.skip_until_found_close (parser);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b5af3877e48..d57ddc4560d 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -37922,21 +37922,19 @@  cp_parser_omp_clause_affinity (cp_parser *parser, tree list)
 	      return list;
 	    }
 	}
     }
   nlist = cp_parser_omp_var_list_no_open (parser, OMP_CLAUSE_AFFINITY,
 					  list, NULL);
   if (iterators)
     {
       tree block = poplevel (1, 1, 0);
-      if (iterators == error_mark_node)
-	iterators = NULL_TREE;
-      else
+      if (iterators != error_mark_node)
 	{
 	  TREE_VEC_ELT (iterators, 5) = block;
 	  for (c = nlist; c != list; c = OMP_CLAUSE_CHAIN (c))
 	    OMP_CLAUSE_DECL (c) = build_tree_list (iterators,
 						   OMP_CLAUSE_DECL (c));
 	}
     }
   return nlist;
 }