From: Patrick Palka <patrick@parcs.ath.cx>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org, jason@redhat.com
Subject: Re: [PATCH 1/2] Fix new -Wparentheses warnings encountered during bootstrap
Date: Thu, 31 Mar 2016 21:10:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.11.1603311709000.1308@idea> (raw)
In-Reply-To: <1459457625-20610-1-git-send-email-patrick@parcs.ath.cx>
[-- Attachment #1: Type: text/plain, Size: 4384 bytes --]
On Thu, 31 Mar 2016, Patrick Palka wrote:
> This patch fixes the new -Wparentheses warnings (implemented by the
> subsequent patch) that are encountered during bootstrap:
>
> /home/patrick/code/gcc/gcc/omp-low.c: In function âvoid scan_sharing_clauses(tree, omp_context*, bool)â:
> /home/patrick/code/gcc/gcc/omp-low.c:2381:6: error: suggest explicit braces to avoid ambiguous âelseâ [-Werror=parentheses]
> if (scan_array_reductions)
> ^
> /home/patrick/code/gcc/gcc/gimplify.c: In function âgimple* gimplify_omp_ordered(tree, gimple_seq)â:
> /home/patrick/code/gcc/gcc/gimplify.c:9880:6: error: suggest explicit braces to avoid ambiguous âelseâ [-Werror=parentheses]
> if (gimplify_omp_ctxp)
> ^
> In file included from /home/patrick/code/gcc/gcc/cp/optimize.c:25:0:
> /home/patrick/code/gcc/gcc/cp/optimize.c: In function âvoid populate_clone_array(tree, tree_node**)â:
> /home/patrick/code/gcc/gcc/cp/cp-tree.h:2529:6: error: suggest explicit braces to avoid ambiguous âelseâ [-Werror=parentheses]
> if (TREE_CODE (FN) == FUNCTION_DECL \
> ^
> /home/patrick/code/gcc/gcc/cp/optimize.c:222:3: note: in expansion of macro âFOR_EACH_CLONEâ
> FOR_EACH_CLONE (clone, fn)
> ^~~~~~~~~~~~~~
> /home/patrick/code/gcc/gcc/fortran/openmp.c: In function âgfc_omp_udr* gfc_find_omp_udr(gfc_namespace*, const char*, gfc_typespec*)â:
> /home/patrick/code/gcc/gcc/fortran/openmp.c:177:10: error: suggest explicit braces to avoid ambiguous âelseâ [-Werror=parentheses]
> if (st != NULL)
> ^
>
> In each case I think the warning is harmless since the indentation of
> the code in question corresponds to how the "else" is actually parsed
> so I fixed each case simply by enclosing the entire body of the outer
> "if" in braces.
>
> The FOR_EACH_CLONE change resolves the cp/optimize.c warning. It
> adjusts the layout of the macro from
>
> if (p)
> for (...)
>
> to
>
> if (!p)
> ;
> else for (...)
>
> so that an "else" encountered in the body of the for-statement can no
> longer possibly bind to the outer "if (p)" conditional.
>
> Is this OK to commit after bootstrap + regtesting?
>
> 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/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.
Forgot about a tree-parloops.c change:
diff:
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index e498e5b..2e55b79 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)
diff -w:
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index e498e5b..2e55b79 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -767,6 +767,7 @@ 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)))
{
@@ -775,6 +776,7 @@ eliminate_local_variables (edge entry, edge exit)
}
else
eliminate_local_variables_stmt (entry, &gsi, &decl_address);
+ }
if (has_debug_stmt)
FOR_EACH_VEC_ELT (body, i, bb)
next prev parent reply other threads:[~2016-03-31 21:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 20:54 Patrick Palka
2016-03-31 20:57 ` Patrick Palka
2016-03-31 21:10 ` Patrick Palka [this message]
2016-03-31 21:14 ` Bernd Schmidt
2016-03-31 21:18 ` Patrick Palka
2016-04-01 11:46 ` Marek Polacek
2016-03-31 21:30 ` Jakub Jelinek
2016-03-31 22:38 ` Trevor Saunders
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.11.1603311709000.1308@idea \
--to=patrick@parcs.ath.cx \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).