This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't issue warning about unused last statements in expression statements
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Gabriel Dos Reis <gdr at codesourcery dot com>
- Cc: rth at redhat dot com, aoliva at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Jan 2002 10:54:30 -0500
- Subject: Re: [PATCH] Don't issue warning about unused last statements in expression statements
- References: <20020104143246.A531@sunsite.ms.mff.cuni.cz> <fl3d1mku73.fsf@riz.cmla.ens-cachan.fr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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