This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Shut up endless "value computed is not used" warnings
- To: gcc-patches at gcc dot gnu dot org
- Subject: Shut up endless "value computed is not used" warnings
- From: "Zack Weinberg" <zackw at stanford dot edu>
- Date: Wed, 29 Nov 2000 23:48:23 -0800
This is a naive patch for the floods of "value computed is not used"
warnings you get in a current Linux bootstrap. This _appears_ to
happen on most calls to memset (which is one of glibc's disgusting
macros), but I can't produce a small test case unfortunately.
Anyhow, the idea is pretty straightforward - don't generate the
warning for anything with side effects. I am not certain that this
patch doesn't break the warning in cases where it should trigger,
though.
Comments?
zw
* stmt.c (warn_if_unused_value): Add test of TREE_SIDE_EFFECTS
to conversion case.
===================================================================
Index: stmt.c
--- stmt.c 2000/11/17 17:31:08 1.178
+++ stmt.c 2000/11/30 07:47:41
@@ -2028,6 +2028,11 @@ warn_if_unused_value (exp)
/* Don't warn about conversions not explicit in the user's program. */
if (TREE_NO_UNUSED_WARNING (exp))
return 0;
+
+ /* Don't warn if there are side effects. */
+ if (TREE_SIDE_EFFECTS (exp))
+ return 0;
+
/* Assignment to a cast usually results in a cast of a modify.
Don't complain about that. There can be an arbitrary number of
casts before the modify, so we must loop until we find the first