From 249555b0af353de199f224a21a88143e375e8183 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Fri, 5 Dec 1997 00:48:46 +0000 Subject: [PATCH] missing part of Sept 22 change brought over: * decl.c (cp_finish_decl): Mark decls used if type has TREE_USED set,don't clear TREE_USED wholesale. From-SVN: r16953 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c7c56d31099..dfe51214ca0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -788,6 +788,12 @@ Thu Sep 25 11:11:13 1997 Jason Merrill * decl.c (start_function): Up warning of no return type to be a pedwarn. +Mon Sep 22 14:15:34 1997 Benjamin Kosnik + + * init.c (expand_member_init): Don't set TREE_USED. + * decl.c (cp_finish_decl): Mark decls used if type has TREE_USED + set,don't clear TREE_USED wholesale. + Sat Sep 20 15:31:00 1997 Jason Merrill * call.c (build_over_call): Do require_complete_type before diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2a57fa9e4f3..23307e9a906 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6956,6 +6956,10 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) was initialized was ever used. Don't do this if it has a destructor, so we don't complain about the 'resource allocation is initialization' idiom. */ + /* Now set attribute((unused)) on types so decls of + of that type will be marked used. (see TREE_USED, above.) + This avoids the warning problems this particular code + tried to work around. */ if (TYPE_NEEDS_CONSTRUCTING (type) && ! already_used @@ -7797,6 +7801,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) init = TREE_OPERAND (decl, 1); decl = start_decl (declarator, declspecs, 1); + /* Look for __unused__ attribute */ + if (TREE_USED (TREE_TYPE (decl))) + TREE_USED (decl) = 1; finish_decl (decl, init, NULL_TREE); return 0; } -- 2.30.2