diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-13 23:16:18 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-13 23:16:18 +0000 |
commit | a96c3cc137bf0b63e19601371c082f0ed963dc25 (patch) | |
tree | 0170fc55d95b627aec9918256ba3cf861f269fd3 /gcc/cp/decl.c | |
parent | 84fcb947302a8da0d1c0c5dd0d130cc82ea10c06 (diff) | |
download | gcc-a96c3cc137bf0b63e19601371c082f0ed963dc25.tar.gz |
PR c++/55203
c-family/
* c-common.c (c_common_attribute_table): Add warn_unused.
(handle_warn_unused_attribute): New.
cp/
* init.c (build_aggr_init): Check for warn_unused attribute.
* decl.c (poplevel): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200941 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 54bede00bb1..c97134c5c40 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -630,7 +630,9 @@ poplevel (int keep, int reverse, int functionbody) && DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl) && type != error_mark_node && (!CLASS_TYPE_P (type) - || !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))) + || !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) + || lookup_attribute ("warn_unused", + TYPE_ATTRIBUTES (TREE_TYPE (decl))))) { if (! TREE_USED (decl)) warning (OPT_Wunused_variable, "unused variable %q+D", decl); |