This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH]: Fix 11512
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: Mark Mitchell <mitchell at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: 15 Aug 2003 09:40:28 -0700
- Subject: Re: [C++ PATCH]: Fix 11512
- Organization: CodeSourcery, LLC
- References: <3F3CBDAE.5030102@codesourcery.com>
On Fri, 2003-08-15 at 04:02, Nathan Sidwell wrote:
> Hi,
> this patch fixes 11512, and removes a long standing FIXME from the compiler.
>
> The C++ changes are straight forward. The C change was necessary as otherwise
> you get duplicate warnings on statements of the form 'a ? B : C', as C++
> puts the void cast in each arm of the conditional, and not at the outer
> level.
>
> booted & tested C & C++ on i686-pc-linux-gnu, ok?
Yes, with minor comments below.
! if (!warn_unused_value)
! /*NOP*/;
! else if (TREE_SIDE_EFFECTS (exp))
warn_if_unused_value (exp);
+ else if (!VOID_TYPE_P (TREE_TYPE (exp)))
+ warning ("%Hstatement with no effect", &emit_locus);
Let's fold the first line into the surrouding test:
&& exp != error_mark_node
&& warn_unused_value)
{
if (TREE_SIDE_EFFECTS (exp))
...
! ? "true operand of conditional" : NULL));
That puzzled me at first; I was thinking "true operand" as opposed to
"fake operand". Would "second operand to `?:'" and "third operand to
`?:'" be clearer?
Thanks,
--
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC