This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2] Fix new -Wparentheses warnings encountered during bootstrap
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: Patrick Palka <patrick at parcs dot ath dot cx>, gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, jason at redhat dot com
- Date: Thu, 31 Mar 2016 17:18:13 -0400 (EDT)
- Subject: Re: [PATCH 1/2] Fix new -Wparentheses warnings encountered during bootstrap
- Authentication-results: sourceware.org; auth=none
- References: <1459457625-20610-1-git-send-email-patrick at parcs dot ath dot cx> <56FD9312 dot 6000107 at redhat dot com>
On Thu, 31 Mar 2016, Bernd Schmidt wrote:
> On 03/31/2016 10:53 PM, 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?
>
> I think this is OK, now or in stage1 depending on whether the warning
> improvements go in now or later.
>
> I see a patch for the C++ side fixing the warning, do you also intend to do C?
>
>
> Bernd
>
>
I hope someone else could do it since I'm not very familiar with the C
parser :) I think Marek said he would take care of it.