Commit 6b37bdaf by Patrick Palka

Fix new -Wparentheses warnings encountered during bootstrap

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.

From-SVN: r234801
parent 64824205
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> 2016-04-06 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/70398 PR rtl-optimization/70398
......
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> 2016-04-06 Jason Merrill <jason@redhat.com>
* class.c (check_abi_tags): Fix function template handling. * class.c (check_abi_tags): Fix function template handling.
......
...@@ -2526,12 +2526,14 @@ struct GTY(()) lang_decl { ...@@ -2526,12 +2526,14 @@ struct GTY(()) lang_decl {
*/ */
#define FOR_EACH_CLONE(CLONE, FN) \ #define FOR_EACH_CLONE(CLONE, FN) \
if (TREE_CODE (FN) == FUNCTION_DECL \ if (!(TREE_CODE (FN) == FUNCTION_DECL \
&& (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \ && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))) \ || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\
for (CLONE = DECL_CHAIN (FN); \ ; \
CLONE && DECL_CLONED_FUNCTION_P (CLONE); \ else \
CLONE = DECL_CHAIN (CLONE)) 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. */ /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
#define DECL_DISCRIMINATOR_P(NODE) \ #define DECL_DISCRIMINATOR_P(NODE) \
......
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> 2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/67538 PR fortran/67538
......
...@@ -175,24 +175,26 @@ gfc_find_omp_udr (gfc_namespace *ns, const char *name, gfc_typespec *ts) ...@@ -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); st = gfc_find_symtree (ns->omp_udr_root, name);
if (st != NULL) if (st != NULL)
for (omp_udr = st->n.omp_udr; omp_udr; omp_udr = omp_udr->next) {
if (ts == NULL) for (omp_udr = st->n.omp_udr; omp_udr; omp_udr = omp_udr->next)
return omp_udr; if (ts == NULL)
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; 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. */ /* Don't escape an interface block. */
if (ns && !ns->has_import_set if (ns && !ns->has_import_set
......
...@@ -9878,64 +9878,66 @@ gimplify_omp_ordered (tree expr, gimple_seq body) ...@@ -9878,64 +9878,66 @@ gimplify_omp_ordered (tree expr, gimple_seq body)
tree sink_c = NULL_TREE; tree sink_c = NULL_TREE;
if (gimplify_omp_ctxp) if (gimplify_omp_ctxp)
for (c = OMP_ORDERED_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c)) {
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND for (c = OMP_ORDERED_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c))
&& gimplify_omp_ctxp->loop_iter_var.is_empty () if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND
&& (OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK && gimplify_omp_ctxp->loop_iter_var.is_empty ()
|| OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SOURCE)) && (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 " error_at (OMP_CLAUSE_LOCATION (c),
"closely nested inside a loop with %<ordered%> clause " "%<ordered%> construct with %<depend%> clause must be "
"with a parameter"); "closely nested inside a loop with %<ordered%> clause "
failures++; "with a parameter");
} failures++;
else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND }
&& OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK) 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; bool fail = false;
decls && TREE_CODE (decls) == TREE_LIST; for (decls = OMP_CLAUSE_DECL (c), i = 0;
decls = TREE_CHAIN (decls), ++i) decls && TREE_CODE (decls) == TREE_LIST;
if (i >= gimplify_omp_ctxp->loop_iter_var.length () / 2) decls = TREE_CHAIN (decls), ++i)
continue; if (i >= gimplify_omp_ctxp->loop_iter_var.length () / 2)
else if (TREE_VALUE (decls) continue;
!= gimplify_omp_ctxp->loop_iter_var[2 * i]) 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), error_at (OMP_CLAUSE_LOCATION (c),
"variable %qE is not an iteration " "more than one %<depend(source)%> clause on an "
"of outermost loop %d, expected %qE", "%<ordered%> construct");
TREE_VALUE (decls), i + 1,
gimplify_omp_ctxp->loop_iter_var[2 * i]);
fail = true;
failures++; failures++;
} }
else else
TREE_VALUE (decls) source_c = c;
= 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;
}
if (source_c && sink_c) if (source_c && sink_c)
{ {
error_at (OMP_CLAUSE_LOCATION (source_c), error_at (OMP_CLAUSE_LOCATION (source_c),
......
...@@ -2379,19 +2379,21 @@ scan_sharing_clauses (tree clauses, omp_context *ctx, ...@@ -2379,19 +2379,21 @@ scan_sharing_clauses (tree clauses, omp_context *ctx,
gcc_checking_assert (!scan_array_reductions gcc_checking_assert (!scan_array_reductions
|| !is_gimple_omp_oacc (ctx->stmt)); || !is_gimple_omp_oacc (ctx->stmt));
if (scan_array_reductions) if (scan_array_reductions)
for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) {
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (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); 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)) else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx); && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx);
&& OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c)) else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
scan_omp (&OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c), ctx); && 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 /* Create a new name for omp child function. Returns an identifier. If
......
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> 2016-04-06 Richard Henderson <rth@redhat.com>
* gcc.dg/pr61817-1.c: New test. * gcc.dg/pr61817-1.c: New test.
......
...@@ -32,14 +32,16 @@ handle_pragma_sayhello (cpp_reader *dummy) ...@@ -32,14 +32,16 @@ handle_pragma_sayhello (cpp_reader *dummy)
return; return;
} }
if (TREE_STRING_LENGTH (message) > 1) if (TREE_STRING_LENGTH (message) > 1)
if (cfun) {
warning (OPT_Wpragmas, if (cfun)
"%<pragma GCCPLUGIN sayhello%> from function %qE: %s", warning (OPT_Wpragmas,
cfun->decl, TREE_STRING_POINTER (message)); "%<pragma GCCPLUGIN sayhello%> from function %qE: %s",
cfun->decl, TREE_STRING_POINTER (message));
else else
warning (OPT_Wpragmas, warning (OPT_Wpragmas,
"%<pragma GCCPLUGIN sayhello%> outside of function: %s", "%<pragma GCCPLUGIN sayhello%> outside of function: %s",
TREE_STRING_POINTER (message)); TREE_STRING_POINTER (message));
}
} }
/* Plugin callback called during pragma registration */ /* Plugin callback called during pragma registration */
......
...@@ -767,14 +767,16 @@ eliminate_local_variables (edge entry, edge exit) ...@@ -767,14 +767,16 @@ eliminate_local_variables (edge entry, edge exit)
FOR_EACH_VEC_ELT (body, i, bb) FOR_EACH_VEC_ELT (body, i, bb)
if (bb != entry_bb && bb != exit_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))) 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; if (gimple_debug_bind_p (gsi_stmt (gsi)))
} has_debug_stmt = true;
else }
eliminate_local_variables_stmt (entry, &gsi, &decl_address); else
eliminate_local_variables_stmt (entry, &gsi, &decl_address);
}
if (has_debug_stmt) if (has_debug_stmt)
FOR_EACH_VEC_ELT (body, i, bb) FOR_EACH_VEC_ELT (body, i, bb)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment