decl.c (pushdecl): Do create a binding for extern "C" functions...
authorMark Mitchell <mark@codesourcery.com>
Thu, 23 Sep 1999 02:04:33 +0000 (02:04 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 23 Sep 1999 02:04:33 +0000 (02:04 +0000)
* decl.c (pushdecl): Do create a binding for extern "C" functions,
but not for their DECL_ASSEMBLER_NAMEs.
(lookup_name_current_level): Fix formatting.
(xref_tag): Likewise.
* decl2.c (start_objects): Mark static constructors and
destructors as used.

From-SVN: r29609

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

index 25f9057dbcce7ff4fcf625894210338f36e52778..350a92777eea967a92983408e00529e5ff7e8795 100644 (file)
@@ -1,3 +1,12 @@
+1999-09-22  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (pushdecl): Do create a binding for extern "C" functions,
+       but not for their DECL_ASSEMBLER_NAMEs.
+       (lookup_name_current_level): Fix formatting.
+       (xref_tag): Likewise.
+       * decl2.c (start_objects): Mark static constructors and
+       destructors as used.
+
 1999-09-22  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl.c (define_case_label): Don't crash if we're not in a switch.
index a6706b53928410acf4a1e394e373b2ee9ed12296..1e63523cdaede8b382896aa3c2f175169dab24b7 100644 (file)
@@ -3806,7 +3806,7 @@ pushdecl (x)
       if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_FUNCTION_MEMBER_P (x))
        {
          t = push_overloaded_decl (x, PUSH_LOCAL);
-         if (t != x || DECL_LANGUAGE (x) == lang_c)
+         if (t != x)
            return t;
          if (!namespace_bindings_p ())
            /* We do not need to create a binding for this name;
@@ -3898,7 +3898,13 @@ pushdecl (x)
            TREE_PUBLIC (name) = 1;
 
          if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
-               && t != NULL_TREE))
+               && t != NULL_TREE)
+             /* For an ordinary function, we create a binding from
+                the mangled name (i.e., NAME) to the DECL.  But, for
+                an `extern "C"' function, the mangled name and the
+                ordinary name are the same so we need not do this.  */
+             && !(TREE_CODE (x) == FUNCTION_DECL && 
+                  DECL_LANGUAGE (x) == lang_c))
            {
              if (TREE_CODE (x) == FUNCTION_DECL)
                my_friendly_assert 
@@ -5766,7 +5772,7 @@ lookup_name_current_level (name)
 
   if (b->namespace_p)
     {
-      t =  IDENTIFIER_NAMESPACE_VALUE (name);
+      t = IDENTIFIER_NAMESPACE_VALUE (name);
 
       /* extern "C" function() */
       if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST)
@@ -12138,11 +12144,9 @@ xref_tag (code_type_node, name, globalize)
         in global scope.  
          If it is not an IDENTIFIER, this is not a declaration */
       if (b->namespace_p && !class_binding_level
-         && TREE_CODE (name) == IDENTIFIER_NODE)
-       {
-         if (IDENTIFIER_NAMESPACE_VALUE (name) == NULL_TREE)
-           SET_IDENTIFIER_NAMESPACE_VALUE (name, TYPE_NAME (ref));
-       }
+         && TREE_CODE (name) == IDENTIFIER_NODE
+         && IDENTIFIER_NAMESPACE_VALUE (name) == NULL_TREE)
+       SET_IDENTIFIER_NAMESPACE_VALUE (name, TYPE_NAME (ref));
 
       if (!globalize && processing_template_decl && IS_AGGR_TYPE (ref))
        redeclare_class_template (ref, current_template_parms);
index 262d6a1ed9259fd5fe0d6dc5fc2183a0ea362ae5..0b8083aac6154d8d74e15ea31b024834d1a53878 100644 (file)
@@ -2789,6 +2789,9 @@ start_objects (method_type, initp)
   TREE_PUBLIC (current_function_decl) = 0;
 #endif
 
+  /* Mark this declaration as used to avoid spurious warnings.  */
+  TREE_USED (current_function_decl) = 1;
+
   store_parm_decls ();
   pushlevel (0);
   clear_last_expr ();