This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: value computed is not used warnings
- To: rth at cygnus dot com
- Subject: Re: value computed is not used warnings
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 19 Sep 2000 02:02:37 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <20000919014511.A11282@cygnus.com>
>>>>> "Richard" == Richard Henderson <rth@cygnus.com> writes:
Richard> void f() { ({ (void) 0; }); }
Richard> We'll currently give a warning for this function with
Richard> -Wall. Given that this ocurrs rather a lot during a
Richard> bootstrap, I'd like to fix it.
That looks pretty sane. You could also do that only if the TREE_TYPE
of the STMT_EXPR is `void'. That way, a statement-expression like:
({ 3; })
would still trigger the warning, which seems OK, but your example
wouldn't cause the warning.
Does the STMT_EXPR in your example have `void' type? If not, that's
probably a bug.
Actually, I think maybe the right fix is to have warn_if_unused_value
ignore `void' expressions. It already tries hard to avoid things that
are explicitly cast to `void' and functions that return `void', but it
doesn't deal with values that are magically `void' like a `void'
STMT_EXPR. Does that sound like a better fix?
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com