This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH]: Fix 11512


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]