]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR c++/54372 - unused attribute inactive on dependant entities
authorDodji Seketeli <dodji@redhat.com>
Fri, 28 Sep 2012 13:32:41 +0000 (13:32 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Fri, 28 Sep 2012 13:32:41 +0000 (15:32 +0200)
commitd10402b413dfbc968d7edf21415c659db1646345
tree7928841298b3d0e441ba635912fde0644eea753a
parent3b4441db79de403b90038af98f8641c19ff0953b
PR c++/54372 - unused attribute inactive on dependant entities

In the example of this patch, gcc/g++ invoked with
-Wunused-local-typedefs warns on dependant entities even when those
are decorated with the 'unused' attribute.

This is because in cplus_decl_attributes, save_template_attributes
makes so that the 'unused' attribute is applied to its appertaining
entity only at instantiation time.  But then at parsing time
maybe_warn_unused_local_typedefs checks for TREE_USED before warning.

This patch applies the 'unused' attribute at compilation time.

Tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp/

* decl2.c (is_late_template_attribute): "unused" attribute is to
be applied at compile time.

gcc/testsuite/

* c-c++-common/Wunused-local-typedefs-2.c: New test.

From-SVN: r191830
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wunused-local-typedefs-2.c [new file with mode: 0644]