Commit d3f129b3 by Jakub Jelinek Committed by Jakub Jelinek

call.c (build_over_call): Set TREE_NO_UNUSED_WARNING too.

	* call.c (build_over_call): Set TREE_NO_UNUSED_WARNING too.
	* cvt.c (convert_to_void): Preserve TREE_NO_UNUSED_WARNING.

	* g++.dg/warn/Wunused-1.C: New test.

From-SVN: r50770
parent 6cbcc541
2002-03-14 Jakub Jelinek <jakub@redhat.com>
* call.c (build_over_call): Set TREE_NO_UNUSED_WARNING too.
* cvt.c (convert_to_void): Preserve TREE_NO_UNUSED_WARNING.
2002-03-12 Richard Sandiford <rsandifo@redhat.com> 2002-03-12 Richard Sandiford <rsandifo@redhat.com>
* mangle.c (write_builtin_type): Handle 128-bit integers even if * mangle.c (write_builtin_type): Handle 128-bit integers even if
......
...@@ -4305,6 +4305,7 @@ build_over_call (cand, args, flags) ...@@ -4305,6 +4305,7 @@ build_over_call (cand, args, flags)
Ideally, the notions of having side-effects and of being Ideally, the notions of having side-effects and of being
useless would be orthogonal. */ useless would be orthogonal. */
TREE_SIDE_EFFECTS (val) = 1; TREE_SIDE_EFFECTS (val) = 1;
TREE_NO_UNUSED_WARNING (val) = 1;
} }
else else
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg); val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
......
...@@ -852,6 +852,7 @@ convert_to_void (expr, implicit) ...@@ -852,6 +852,7 @@ convert_to_void (expr, implicit)
tree t = build (COMPOUND_EXPR, TREE_TYPE (new_op1), tree t = build (COMPOUND_EXPR, TREE_TYPE (new_op1),
TREE_OPERAND (expr, 0), new_op1); TREE_OPERAND (expr, 0), new_op1);
TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr); TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr);
TREE_NO_UNUSED_WARNING (t) = TREE_NO_UNUSED_WARNING (expr);
expr = t; expr = t;
} }
......
2002-03-14 Jakub Jelinek <jakub@redhat.com>
* g++.dg/warn/Wunused-1.C: New test.
2002-02-13 Richard Sandiford <rsandifo@redhat.com> 2002-02-13 Richard Sandiford <rsandifo@redhat.com>
* g++.dg/abi/mangle6.C: New test. * g++.dg/abi/mangle6.C: New test.
......
// Test whether -Wunused handles empty classes the same as non-empty.
// { dg-do compile }
// { dg-options "-Wunused" }
struct A {};
struct B { char c; };
void foo ()
{
struct A a0, a1;
struct B b0, b1 = { 25 };
a0 = a1; // { dg-bogus "value computed is not used" }
b0 = b1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment