[Bug c++/54372] __attribute__((unused)) doesn't work with unused local typedef in template function.
dodji at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 28 13:33:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54372
--- Comment #7 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-09-28 13:32:52 UTC ---
Author: dodji
Date: Fri Sep 28 13:32:41 2012
New Revision: 191830
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191830
Log:
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.
Added:
trunk/gcc/testsuite/c-c++-common/Wunused-local-typedefs-2.c
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-bugs
mailing list