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
This commit is contained in:
Patrick Palka 2016-04-06 23:07:21 +00:00
parent 64824205cc
commit 6b37bdaff1
10 changed files with 143 additions and 104 deletions

View 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

View 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.

View 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) \

View 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

View 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

View 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),
"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;
"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
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),

View 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

View 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.

View 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 */

View 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)