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: [PATCH] Don't issue warning about unused last statements in expression statements


On Fri, Jan 04, 2002 at 04:32:48PM +0100, Gabriel Dos Reis wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> | Hi!
> | 
> | Alex's 2002-01-02 patch introduced lots of statement with no effect
> | warnings in expansion of glibc macros.
> | The thing is that gcc used to suppress this warning inside of ({ }),
> | but after the patch it is issued if the value is not used.
> | E.g. glibc memset expansion uses ({ }) and thus gcc gives warning
> | if nobody uses the return value of memset.
> | The following patch suppresses the warning in this case again, with the
> | difference that it warns about statements with no effect if they are not
> | at the end of statement expression.
> | Ok to commit (or would you prefer to get back the pre-2002-01-02 behaviour,
> | which would simplify the patch (just s/! want_value/expr_stmts_for_value == 0/
> | in the tests around the warning in expand_expr_stmt_value))?
> 
> Apparently, that patch affects not only Glibc but also usual C++
> programs (see a recent report from Gerald).  I would like to see the 
> pre-2002-01-02 behaviour back.

Gerald testcase is fixed both by the patch I posted and by the simpler patch
to revert to pre-2002-01-02 behaviour for warnings.
The thing is whether we want to see warnings for:
({ void *p = q;
   p;  <------------- Here
   (void) p;
   p;
})

(the other 2 places won't get a warning in either patch).

	Jakub


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