OSDN Git Service

missing part of Sept 22 change brought over:
authorbrendan <brendan@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Dec 1997 00:48:46 +0000 (00:48 +0000)
committerbrendan <brendan@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Dec 1997 00:48:46 +0000 (00:48 +0000)
* decl.c (cp_finish_decl): Mark decls used if type has TREE_USED
set,don't clear TREE_USED wholesale.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16953 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c

index c7c56d3..dfe5121 100644 (file)
@@ -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
        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>
 
        * call.c (build_over_call): Do require_complete_type before
index 2a57fa9..23307e9 100644 (file)
@@ -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;
              }