]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix new -Wparentheses warnings encountered during bootstrap
authorppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Apr 2016 23:07:21 +0000 (23:07 +0000)
committerppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Apr 2016 23:07:21 +0000 (23:07 +0000)
gcc/ChangeLog:

PR c/70436
* gimplify.c (gimplify_omp_ordered): Add explicit braces to
resolve a future -Wparentheses warning.
* omp-low.c (scan_sharing_clauses): Likewise.
* tree-parloops.c (eliminate_local_variables): Likewise.

gcc/cp/ChangeLog:

PR c/70436
* cp-tree.h (FOR_EACH_CLONE): Restructure macro to avoid
potentially generating a future -Wparentheses warning in its
callers.

gcc/fortran/ChangeLog:

PR c/70436
* openmp.c (gfc_find_omp_udr): Add explicit braces to resolve a
future -Wparentheses warning.

gcc/testsuite/ChangeLog:

PR c/70436
* g++.dg/plugin/pragma_plugin.c (handle_pragma_sayhello): Add
explicit braces to resolve a future -Wparentheses warning.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234801 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/fortran/ChangeLog
gcc/fortran/openmp.c
gcc/gimplify.c
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/plugin/pragma_plugin.c
gcc/tree-parloops.c

index ecbac2e7dc71361d40253eecfd0fcc86a263299b..e51a523563776d6fa59c0468b786c6e0dd0d10b1 100644 (file)
@@ -1,3 +1,11 @@
+2016-04-06  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       PR c/70436
+       * gimplify.c (gimplify_omp_ordered): Add explicit braces to
+       resolve a future -Wparentheses warning.
+       * omp-low.c (scan_sharing_clauses): Likewise.
+       * tree-parloops.c (eliminate_local_variables): Likewise.
+
 2016-04-06  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/70398
index 2cf989ba825de1a6b45775081962b6028c09221d..db7cb9bd9b09280d55efc44084616590e2e1a32d 100644 (file)
@@ -1,3 +1,10 @@
+2016-04-06  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       PR c/70436
+       * cp-tree.h (FOR_EACH_CLONE): Restructure macro to avoid
+       potentially generating a future -Wparentheses warning in its
+       callers.
+
 2016-04-06  Jason Merrill  <jason@redhat.com>
 
        * class.c (check_abi_tags): Fix function template handling.
index d2bf717ae63bcf87a5ac506735ac3f936c1ecef5..0f7e08ffe73c174f13d6294b8dcf26a2fb155290 100644 (file)
@@ -2526,12 +2526,14 @@ struct GTY(()) lang_decl {
 
   */
 #define FOR_EACH_CLONE(CLONE, FN)                      \
-  if (TREE_CODE (FN) == FUNCTION_DECL                  \
-      && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN)      \
-         || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN)))   \
-     for (CLONE = DECL_CHAIN (FN);                     \
-         CLONE && DECL_CLONED_FUNCTION_P (CLONE);      \
-         CLONE = DECL_CHAIN (CLONE))
+  if (!(TREE_CODE (FN) == FUNCTION_DECL                        \
+       && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN)     \
+           || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\
+    ;                                                  \
+  else                                                 \
+    for (CLONE = DECL_CHAIN (FN);                      \
+        CLONE && DECL_CLONED_FUNCTION_P (CLONE);       \
+        CLONE = DECL_CHAIN (CLONE))
 
 /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS.  */
 #define DECL_DISCRIMINATOR_P(NODE)     \
index 4ad92c0fb2dc7139ac4ab55b7e5df886c4e2d002..c300145af478100703f2a560b629ce34b6641403 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-06  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       PR c/70436
+       * openmp.c (gfc_find_omp_udr): Add explicit braces to resolve a
+       future -Wparentheses warning.
+
 2016-04-04  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        PR fortran/67538
index a6c39cda6942614e4a6f5d2d464d196797380291..0dd1a9213705d6c3b3381d3d924f9c8dcb905de6 100644 (file)
@@ -175,24 +175,26 @@ gfc_find_omp_udr (gfc_namespace *ns, const char *name, gfc_typespec *ts)
 
       st = gfc_find_symtree (ns->omp_udr_root, name);
       if (st != NULL)
-       for (omp_udr = st->n.omp_udr; omp_udr; omp_udr = omp_udr->next)
-         if (ts == NULL)
-           return omp_udr;
-         else if (gfc_compare_types (&omp_udr->ts, ts))
-           {
-             if (ts->type == BT_CHARACTER)
-               {
-                 if (omp_udr->ts.u.cl->length == NULL)
-                   return omp_udr;
-                 if (ts->u.cl->length == NULL)
-                   continue;
-                 if (gfc_compare_expr (omp_udr->ts.u.cl->length,
-                                       ts->u.cl->length,
-                                       INTRINSIC_EQ) != 0)
-                   continue;
-               }
+       {
+         for (omp_udr = st->n.omp_udr; omp_udr; omp_udr = omp_udr->next)
+           if (ts == NULL)
              return omp_udr;
-           }
+           else if (gfc_compare_types (&omp_udr->ts, ts))
+             {
+               if (ts->type == BT_CHARACTER)
+                 {
+                   if (omp_udr->ts.u.cl->length == NULL)
+                     return omp_udr;
+                   if (ts->u.cl->length == NULL)
+                     continue;
+                   if (gfc_compare_expr (omp_udr->ts.u.cl->length,
+                                         ts->u.cl->length,
+                                         INTRINSIC_EQ) != 0)
+                     continue;
+                 }
+               return omp_udr;
+             }
+       }
 
       /* Don't escape an interface block.  */
       if (ns && !ns->has_import_set
index f29d608f5eb9ea45ec56c30f08111ff2c390b8cf..9c0119e0794a52b1a73944fae841e05886f7d725 100644 (file)
@@ -9878,64 +9878,66 @@ gimplify_omp_ordered (tree expr, gimple_seq body)
   tree sink_c = NULL_TREE;
 
   if (gimplify_omp_ctxp)
-    for (c = OMP_ORDERED_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c))
-      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
-         && gimplify_omp_ctxp->loop_iter_var.is_empty ()
-         && (OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK
-             || OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SOURCE))
-       {
-         error_at (OMP_CLAUSE_LOCATION (c),
-                   "%<ordered%> construct with %<depend%> clause must be "
-                   "closely nested inside a loop with %<ordered%> clause "
-                   "with a parameter");
-         failures++;
-       }
-      else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
-              && OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK)
-       {
-         bool fail = false;
-         for (decls = OMP_CLAUSE_DECL (c), i = 0;
-              decls && TREE_CODE (decls) == TREE_LIST;
-              decls = TREE_CHAIN (decls), ++i)
-           if (i >= gimplify_omp_ctxp->loop_iter_var.length () / 2)
-             continue;
-           else if (TREE_VALUE (decls)
-                    != gimplify_omp_ctxp->loop_iter_var[2 * i])
+    {
+      for (c = OMP_ORDERED_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c))
+       if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
+           && gimplify_omp_ctxp->loop_iter_var.is_empty ()
+           && (OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK
+               || OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SOURCE))
+         {
+           error_at (OMP_CLAUSE_LOCATION (c),
+                     "%<ordered%> construct with %<depend%> clause must be "
+                     "closely nested inside a loop with %<ordered%> clause "
+                     "with a parameter");
+           failures++;
+         }
+       else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
+                && OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK)
+         {
+           bool fail = false;
+           for (decls = OMP_CLAUSE_DECL (c), i = 0;
+                decls && TREE_CODE (decls) == TREE_LIST;
+                decls = TREE_CHAIN (decls), ++i)
+             if (i >= gimplify_omp_ctxp->loop_iter_var.length () / 2)
+               continue;
+             else if (TREE_VALUE (decls)
+                      != gimplify_omp_ctxp->loop_iter_var[2 * i])
+               {
+                 error_at (OMP_CLAUSE_LOCATION (c),
+                           "variable %qE is not an iteration "
+                           "of outermost loop %d, expected %qE",
+                           TREE_VALUE (decls), i + 1,
+                           gimplify_omp_ctxp->loop_iter_var[2 * i]);
+                 fail = true;
+                 failures++;
+               }
+             else
+               TREE_VALUE (decls)
+                 = gimplify_omp_ctxp->loop_iter_var[2 * i + 1];
+           if (!fail && i != gimplify_omp_ctxp->loop_iter_var.length () / 2)
+             {
+               error_at (OMP_CLAUSE_LOCATION (c),
+                         "number of variables in %<depend(sink)%> "
+                         "clause does not match number of "
+                         "iteration variables");
+               failures++;
+             }
+           sink_c = c;
+         }
+       else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
+                && OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SOURCE)
+         {
+           if (source_c)
              {
                error_at (OMP_CLAUSE_LOCATION (c),
-                         "variable %qE is not an iteration "
-                         "of outermost loop %d, expected %qE",
-                         TREE_VALUE (decls), i + 1,
-                         gimplify_omp_ctxp->loop_iter_var[2 * i]);
-               fail = true;
+                         "more than one %<depend(source)%> clause on an "
+                         "%<ordered%> construct");
                failures++;
              }
            else
-             TREE_VALUE (decls)
-               = gimplify_omp_ctxp->loop_iter_var[2 * i + 1];
-         if (!fail && i != gimplify_omp_ctxp->loop_iter_var.length () / 2)
-           {
-             error_at (OMP_CLAUSE_LOCATION (c),
-                       "number of variables in %<depend(sink)%> "
-                       "clause does not match number of "
-                       "iteration variables");
-             failures++;
-           }
-         sink_c = c;
-       }
-      else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
-              && OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SOURCE)
-       {
-         if (source_c)
-           {
-             error_at (OMP_CLAUSE_LOCATION (c),
-                       "more than one %<depend(source)%> clause on an "
-                       "%<ordered%> construct");
-             failures++;
-           }
-         else
-           source_c = c;
-       }
+             source_c = c;
+         }
+    }
   if (source_c && sink_c)
     {
       error_at (OMP_CLAUSE_LOCATION (source_c),
index 52a80059ef344b685977fc7fc30dc8bd8a911a62..6b7941d0ef414b454d0227015296ca18fec37187 100644 (file)
@@ -2379,19 +2379,21 @@ scan_sharing_clauses (tree clauses, omp_context *ctx,
   gcc_checking_assert (!scan_array_reductions
                       || !is_gimple_omp_oacc (ctx->stmt));
   if (scan_array_reductions)
-    for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
-      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
-         && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
-       {
-         scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx);
-         scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx);
-       }
-      else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
-              && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
-       scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx);
-      else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
-              && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c))
-       scan_omp (&OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c), ctx);
+    {
+      for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+       if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
+           && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+         {
+           scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx);
+           scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx);
+         }
+       else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
+                && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
+         scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx);
+       else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
+                && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c))
+         scan_omp (&OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c), ctx);
+    }
 }
 
 /* Create a new name for omp child function.  Returns an identifier.  If
index 0ecced8244895fa12eca79764aba0f65933d8dc9..2a785506710d54e1bbea058096f99d5232bd3772 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-06  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       PR c/70436
+       * g++.dg/plugin/pragma_plugin.c (handle_pragma_sayhello): Add
+       explicit braces to resolve a future -Wparentheses warning.
+
 2016-04-06  Richard Henderson  <rth@redhat.com>
 
        * gcc.dg/pr61817-1.c: New test.
index 940c302df7dfdca384b0939b05effcfb0de72387..6f4739868d3fff4fb63641366c92861b0d6e9a8b 100644 (file)
@@ -32,14 +32,16 @@ handle_pragma_sayhello (cpp_reader *dummy)
       return;
     }
   if (TREE_STRING_LENGTH (message) > 1)
-    if (cfun)
-      warning (OPT_Wpragmas, 
-             "%<pragma GCCPLUGIN sayhello%> from function %qE: %s",
-             cfun->decl, TREE_STRING_POINTER (message));
+    {
+      if (cfun)
+        warning (OPT_Wpragmas, 
+               "%<pragma GCCPLUGIN sayhello%> from function %qE: %s",
+               cfun->decl, TREE_STRING_POINTER (message));
       else
-       warning (OPT_Wpragmas, 
-           "%<pragma GCCPLUGIN sayhello%> outside of function: %s",
-           TREE_STRING_POINTER (message));
+        warning (OPT_Wpragmas, 
+                "%<pragma GCCPLUGIN sayhello%> outside of function: %s",
+                TREE_STRING_POINTER (message));
+    }
 }
 
 /* Plugin callback called during pragma registration */
index e498e5b62b7b7d2af1ea768e1b428c0e8960d3b2..2e55b7961d845f630d4fb3e242b4308bd00235da 100644 (file)
@@ -767,14 +767,16 @@ eliminate_local_variables (edge entry, edge exit)
 
   FOR_EACH_VEC_ELT (body, i, bb)
     if (bb != entry_bb && bb != exit_bb)
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-       if (is_gimple_debug (gsi_stmt (gsi)))
-         {
-           if (gimple_debug_bind_p (gsi_stmt (gsi)))
-             has_debug_stmt = true;
-         }
-       else
-         eliminate_local_variables_stmt (entry, &gsi, &decl_address);
+      {
+        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+         if (is_gimple_debug (gsi_stmt (gsi)))
+           {
+             if (gimple_debug_bind_p (gsi_stmt (gsi)))
+               has_debug_stmt = true;
+           }
+         else
+           eliminate_local_variables_stmt (entry, &gsi, &decl_address);
+      }
 
   if (has_debug_stmt)
     FOR_EACH_VEC_ELT (body, i, bb)