From: Jakub Jelinek Date: Thu, 14 Mar 2002 14:26:56 +0000 (+0100) Subject: call.c (build_over_call): Set TREE_NO_UNUSED_WARNING too. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3f129b340ca8a3b6d67518791ea962db9c3e3f8;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b97a1a44310..40c1e0d61fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-03-14 Jakub Jelinek + + * 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 * mangle.c (write_builtin_type): Handle 128-bit integers even if diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 31b5baaf3fe..6f67e3d7b51 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4305,6 +4305,7 @@ build_over_call (cand, args, flags) Ideally, the notions of having side-effects and of being useless would be orthogonal. */ TREE_SIDE_EFFECTS (val) = 1; + TREE_NO_UNUSED_WARNING (val) = 1; } else val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 1d5dc90955e..cea204e29dc 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -852,6 +852,7 @@ convert_to_void (expr, implicit) tree t = build (COMPOUND_EXPR, TREE_TYPE (new_op1), TREE_OPERAND (expr, 0), new_op1); TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr); + TREE_NO_UNUSED_WARNING (t) = TREE_NO_UNUSED_WARNING (expr); expr = t; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b18306aa6b..c65803b6a43 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-03-14 Jakub Jelinek + + * g++.dg/warn/Wunused-1.C: New test. + 2002-02-13 Richard Sandiford * g++.dg/abi/mangle6.C: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-1.C b/gcc/testsuite/g++.dg/warn/Wunused-1.C new file mode 100644 index 00000000000..60ceb4f076d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-1.C @@ -0,0 +1,15 @@ +// 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; +}