Commit 249555b0 by Benjamin Kosnik Committed by Brendan Kehoe

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
parent e7757d69
...@@ -788,6 +788,12 @@ Thu Sep 25 11:11:13 1997 Jason Merrill <jason@yorick.cygnus.com> ...@@ -788,6 +788,12 @@ Thu Sep 25 11:11:13 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (start_function): Up warning of no return type to be a * decl.c (start_function): Up warning of no return type to be a
pedwarn. pedwarn.
Mon Sep 22 14:15:34 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
* 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 <jason@yorick.cygnus.com> Sat Sep 20 15:31:00 1997 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_over_call): Do require_complete_type before * call.c (build_over_call): Do require_complete_type before
......
...@@ -6956,6 +6956,10 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) ...@@ -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 was initialized was ever used. Don't do this if it has a
destructor, so we don't complain about the 'resource destructor, so we don't complain about the 'resource
allocation is initialization' idiom. */ 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) if (TYPE_NEEDS_CONSTRUCTING (type)
&& ! already_used && ! already_used
...@@ -7797,6 +7801,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -7797,6 +7801,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
init = TREE_OPERAND (decl, 1); init = TREE_OPERAND (decl, 1);
decl = start_decl (declarator, declspecs, 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); finish_decl (decl, init, NULL_TREE);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment