diff options
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 14 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/openmp.c | 36 | ||||
-rw-r--r-- | gcc/gimplify.c | 108 | ||||
-rw-r--r-- | gcc/omp-low.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/plugin/pragma_plugin.c | 16 | ||||
-rw-r--r-- | gcc/tree-parloops.c | 18 |
10 files changed, 143 insertions, 104 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ecbac2e7dc7..e51a5235637 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2cf989ba825..db7cb9bd9b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d2bf717ae63..0f7e08ffe73 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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) \ diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4ad92c0fb2d..c300145af47 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index a6c39cda694..0dd1a921370 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -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 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f29d608f5eb..9c0119e0794 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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), diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 52a80059ef3..6b7941d0ef4 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ecced82448..2a785506710 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c index 940c302df7d..6f4739868d3 100644 --- a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c @@ -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 */ diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index e498e5b62b7..2e55b7961d8 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -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) |