On 02/17/2017 05:07 PM, Martin Sebor wrote:
* decl.c (poplevel): Avoid diagnosing entities declared with attribute unused.
This change is OK.
(initialize_local_var): Do not consider the type of a variable when determining whether or not it's used.
This is not; the documentation for attribute unused says, When attached to a type (including a @code{union} or a @code{struct}), this attribute means that variables of that type are meant to appear possibly unused. GCC does not produce a warning for any variables of that type, even if the variable appears to do nothing. This is often the case with lock or thread classes, which are usually defined and then not referenced, but contain constructors and destructors that have nontrivial bookkeeping functions. So a TREE_USED type should imply TREE_USED on variables of that type. Jason