Patch: Prune unused DECL_STMTs from saved tree structure

Jason Merrill jason@redhat.com
Tue Aug 29 10:38:00 GMT 2000


>>>>> Jeffrey A Law <law@cygnus.com> writes:

 >   In message < 20000828101008.V17776@wolery.cumb.org >you write:
 >> 
 >> I started out trying to discard all DECL_STMTs and VAR_DECLS that
 >> didn't have their used bit set.  However, it turns out that there are
 >> several cases where a variable is referenced but TREE_USED(decl) is
 >> false.  For instance, anything with an initialization expression and
 >> no further use; anything with a constructor or destructor (however
 >> trivial); and then there were these mysterious unnamed variables
 >> introduced by __builtin_va_arg, which is when I gave up trying to
 >> account for all the cases.

 > We should attack this separately.  It sounds rather lame to me that we have
 > things which are used, but which don't have TREE_USED set.

The latter case is probably a bug, but the former is by design.  We still
want to get -Wunused warnings for objects with constructors that are
declared but never used, so we clear TREE_USED.  Perhaps that is a mistake.

Jason


More information about the Gcc-patches mailing list