+2002-02-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/4697:
+ * stmt.c (warn_if_unused_value): Move side effects test once more.
+
2002-02-20 Torbjorn Granlund <tege@swox.com>
* config/avr/avr.md: Add more patterns for mized-mode add and subtract
if (VOID_TYPE_P (TREE_TYPE (exp)))
return 0;
- /* If this is an expression with side effects, don't warn. */
- if (TREE_SIDE_EFFECTS (exp))
- return 0;
-
switch (TREE_CODE (exp))
{
case PREINCREMENT_EXPR:
|| TREE_CODE (tem) == CALL_EXPR)
return 0;
}
- goto warn;
+ goto maybe_warn;
case INDIRECT_REF:
/* Don't warn about automatic dereferencing of references, since
&& TREE_CODE_LENGTH (TREE_CODE (exp)) == 0)
return 0;
- warn:
+ maybe_warn:
+ /* If this is an expression with side effects, don't warn. */
+ if (TREE_SIDE_EFFECTS (exp))
+ return 0;
+
warning_with_file_and_line (emit_filename, emit_lineno,
"value computed is not used");
return 1;
+2002-02-21 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20020220-2.c: New test.
+
2002-02-20 Alexandre Oliva <aoliva@redhat.com>
* gcc.c-torture/compile/20020110.c: New test.
--- /dev/null
+/* PR c/4697
+ Test whether value computed not used warning is given for compound
+ expression. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused" } */
+
+int b;
+int foo (int a)
+{
+ a = a + 1, 5 * b; /* { dg-warning "value computed is not used" } */
+ return a;
+}