diff mbox

[3/4] Fix misleading indentation in tree-nested.c

Message ID 1446137381-32748-4-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Oct. 29, 2015, 4:49 p.m. UTC
tree-nested.c has this code:

  2333              for (c = gimple_omp_taskreg_clauses (stmt);
  2334                   c;
  2335                   c = OMP_CLAUSE_CHAIN (c))
  2336                if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
  2337                     || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
  2338                    && OMP_CLAUSE_DECL (c) == decl)
  2339                  break;
  2340                if (c == NULL && gimple_code (stmt) != GIMPLE_OMP_TARGET)
  2341                  {

which leads to this warning from -Wmisleading-indentation
(justifiably, in my opinion):

../../../src/gcc/tree-nested.c: In function ‘tree_node* convert_tramp_reference_stmt(gimple_stmt_iterator*, bool*, walk_stmt_info* ’:
../../../src/gcc/tree-nested.c:2340:8: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
        if (c == NULL && gimple_code (stmt) != GIMPLE_OMP_TARGET)
        ^
../../../src/gcc/tree-nested.c:2333:6: note: ...this ‘for’ clause, but it is not
      for (c = gimple_omp_taskreg_clauses (stmt);
      ^

This patch fixes the indentation of lines 2340-2360 to make it clear
that they're not part of the "for" loop.

gcc/ChangeLog:
	* tree-nested.c (convert_tramp_reference_stmt): Fix indentation.
---
 gcc/tree-nested.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

Comments

Jeff Law Oct. 29, 2015, 5:34 p.m. UTC | #1
On 10/29/2015 10:49 AM, David Malcolm wrote:
> tree-nested.c has this code:
>
>    2333              for (c = gimple_omp_taskreg_clauses (stmt);
>    2334                   c;
>    2335                   c = OMP_CLAUSE_CHAIN (c))
>    2336                if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
>    2337                     || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
>    2338                    && OMP_CLAUSE_DECL (c) == decl)
>    2339                  break;
>    2340                if (c == NULL && gimple_code (stmt) != GIMPLE_OMP_TARGET)
>    2341                  {
>
> which leads to this warning from -Wmisleading-indentation
> (justifiably, in my opinion):
>
> ../../../src/gcc/tree-nested.c: In function ‘tree_node* convert_tramp_reference_stmt(gimple_stmt_iterator*, bool*, walk_stmt_info* ’:
> ../../../src/gcc/tree-nested.c:2340:8: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
>          if (c == NULL && gimple_code (stmt) != GIMPLE_OMP_TARGET)
>          ^
> ../../../src/gcc/tree-nested.c:2333:6: note: ...this ‘for’ clause, but it is not
>        for (c = gimple_omp_taskreg_clauses (stmt);
>        ^
>
> This patch fixes the indentation of lines 2340-2360 to make it clear
> that they're not part of the "for" loop.
>
> gcc/ChangeLog:
> 	* tree-nested.c (convert_tramp_reference_stmt): Fix indentation.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index c04c429..a5435f9 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -2337,27 +2337,27 @@  convert_tramp_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 		   || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
 		  && OMP_CLAUSE_DECL (c) == decl)
 		break;
-	      if (c == NULL && gimple_code (stmt) != GIMPLE_OMP_TARGET)
-		{
-		  c = build_omp_clause (gimple_location (stmt),
-					i ? OMP_CLAUSE_FIRSTPRIVATE
-					  : OMP_CLAUSE_SHARED);
-		  OMP_CLAUSE_DECL (c) = decl;
-		  OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
-		  gimple_omp_taskreg_set_clauses (stmt, c);
-		}
-	      else if (c == NULL)
-		{
-		  c = build_omp_clause (gimple_location (stmt),
-					OMP_CLAUSE_MAP);
-		  OMP_CLAUSE_DECL (c) = decl;
-		  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),
-						 c);
-		}
+	    if (c == NULL && gimple_code (stmt) != GIMPLE_OMP_TARGET)
+	      {
+		c = build_omp_clause (gimple_location (stmt),
+				      i ? OMP_CLAUSE_FIRSTPRIVATE
+				      : OMP_CLAUSE_SHARED);
+		OMP_CLAUSE_DECL (c) = decl;
+		OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
+		gimple_omp_taskreg_set_clauses (stmt, c);
+	      }
+	    else if (c == NULL)
+	      {
+		c = build_omp_clause (gimple_location (stmt),
+				      OMP_CLAUSE_MAP);
+		OMP_CLAUSE_DECL (c) = decl;
+		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),
+					       c);
+	      }
 	  }
 	info->new_local_var_chain = save_local_var_chain;
 	info->static_chain_added |= save_static_chain_added;