]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cp-tree.h, [...]: Lose DECL_C_STATIC and DECL_PUBLIC.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 29 Sep 1997 16:08:34 +0000 (16:08 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 29 Sep 1997 16:08:34 +0000 (12:08 -0400)
* cp-tree.h, decl.c, decl2.c, pt.c:
  Lose DECL_C_STATIC and DECL_PUBLIC.  Don't pretend statics are public.

* decl2.c (lang_decode_option): Add missing ;.

From-SVN: r15789

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/pt.c

index 89e98083b636eaa6088b3f9ca7a754a483b74802..e7da2dd201f0eabc4738f8775dcc25b0a561b9fc 100644 (file)
@@ -1,3 +1,10 @@
+Mon Sep 29 08:57:53 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * cp-tree.h, decl.c, decl2.c, pt.c:
+       Lose DECL_C_STATIC and DECL_PUBLIC.  Don't pretend statics are public.
+
+       * decl2.c (lang_decode_option): Add missing ;.
+
 Sat Sep 27 16:22:48 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * friend.c (do_friend): Disable injection for all template-derived
index a44447a60d297c8ac55c169fc5c6a2423b7510f2..8d1ccfc4fa617d11796ee2781572483ce6dcb86b 100644 (file)
@@ -936,11 +936,10 @@ struct lang_decl_flags
   unsigned saved_inline : 1;
   unsigned use_template : 2;
 
-  unsigned c_static : 1;
   unsigned nonconverting : 1;
   unsigned declared_inline : 1;
   unsigned not_really_extern : 1;
-  unsigned dummy : 4;
+  unsigned dummy : 5;
 
   tree access;
   tree context;
@@ -1402,11 +1401,6 @@ extern int flag_new_for_scope;
 /* We know what we're doing with this decl now.  */
 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
 
-/* This decl was declared or deduced to have internal linkage.  This is
-   only meaningful if TREE_PUBLIC is set.  */
-#define DECL_C_STATIC(NODE) \
-  (DECL_LANG_SPECIFIC (NODE)->decl_flags.c_static)
-
 /* This function was declared inline.  This flag controls the linkage
    semantics of 'inline'; whether or not the function is inlined is
    controlled by DECL_INLINE.  */
@@ -1422,10 +1416,6 @@ extern int flag_new_for_scope;
 #define DECL_REALLY_EXTERN(NODE) \
   (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
 
-#define DECL_PUBLIC(NODE) \
-  (TREE_CODE (NODE) == FUNCTION_DECL \
-   ? ! DECL_C_STATIC (NODE) : TREE_PUBLIC (NODE))
-
 #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
 
 /* ...and for unexpanded-parameterized-type nodes.  */
index 71c2dbf22c3fc08a7bfd5896848546dd6d445624..40398185eba32bb4f92cc2826e1eb9dc52b276fc 100644 (file)
@@ -2460,7 +2460,7 @@ duplicate_decls (newdecl, olddecl)
       /* If you declare a built-in or predefined function name as static,
         the old definition is overridden, but optionally warn this was a
         bad choice of name.  Ditto for overloads.  */
-      if (! DECL_PUBLIC (newdecl)
+      if (! TREE_PUBLIC (newdecl)
          || (TREE_CODE (newdecl) == FUNCTION_DECL
              && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)))
        {
@@ -2848,9 +2848,6 @@ duplicate_decls (newdecl, olddecl)
   if (! DECL_EXTERNAL (olddecl))
     DECL_EXTERNAL (newdecl) = 0;
 
-  if (TREE_CODE (newdecl) == FUNCTION_DECL)
-    DECL_C_STATIC (newdecl) |= DECL_C_STATIC (olddecl);
-
   if (DECL_LANG_SPECIFIC (newdecl))
     {
       DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
@@ -3214,7 +3211,7 @@ pushdecl (x)
 
          /* If the first global decl has external linkage,
             warn if we later see static one.  */
-         if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && DECL_PUBLIC (x))
+         if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && TREE_PUBLIC (x))
            TREE_PUBLIC (name) = 1;
 
          /* Don't install an artificial TYPE_DECL if we already have
@@ -6640,7 +6637,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
          && current_function_decl
          && DECL_CONTEXT (decl) == current_function_decl
          && DECL_THIS_INLINE (current_function_decl)
-         && DECL_PUBLIC (current_function_decl))
+         && TREE_PUBLIC (current_function_decl))
        {
          if (DECL_INTERFACE_KNOWN (current_function_decl))
            {
@@ -7218,7 +7215,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
   decl = build_lang_decl (FUNCTION_DECL, declarator, type);
   /* propagate volatile out from type to decl */
   if (TYPE_VOLATILE (type))
-      TREE_THIS_VOLATILE (decl) = 1;
+    TREE_THIS_VOLATILE (decl) = 1;
 
   /* Should probably propagate const out from type to decl I bet (mrs).  */
   if (staticp)
@@ -7230,10 +7227,6 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
   if (ctype)
     DECL_CLASS_CONTEXT (decl) = ctype;
 
-  /* All function decls start out public; we'll fix their linkage later (at
-     definition or EOF) if appropriate.  */
-  TREE_PUBLIC (decl) = 1;
-
   if (ctype == NULL_TREE && ! strcmp (IDENTIFIER_POINTER (declarator), "main"))
     {
       if (inlinep)
@@ -7244,8 +7237,12 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
       publicp = 1;
     }
          
+  TREE_PUBLIC (decl) = publicp;
   if (! publicp)
-    DECL_C_STATIC (decl) = 1;
+    {
+      DECL_INTERFACE_KNOWN (decl) = 1;
+      DECL_NOT_REALLY_EXTERN (decl) = 1;
+    }
 
   if (inlinep)
     DECL_THIS_INLINE (decl) = DECL_INLINE (decl) = 1;
@@ -7262,7 +7259,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
     grok_op_properties (decl, virtualp, check < 0);
 
   if (ctype && hack_decl_function_context (decl))
-      DECL_NO_STATIC_CHAIN (decl) = 1;
+    DECL_NO_STATIC_CHAIN (decl) = 1;
 
   for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t))
     if (TREE_PURPOSE (t)
@@ -11425,11 +11422,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
          = (interface_only
             || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines));
       else
-       {
-         DECL_EXTERNAL (decl1) = 0;
-         if (DECL_C_STATIC (decl1))
-           TREE_PUBLIC (decl1) = 0;
-       }         
+       DECL_EXTERNAL (decl1) = 0;
       DECL_NOT_REALLY_EXTERN (decl1) = 0;
       DECL_INTERFACE_KNOWN (decl1) = 1;
     }
@@ -11445,11 +11438,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
          && ! hack_decl_function_context (decl1))
        DECL_DEFER_OUTPUT (decl1) = 1;
       else
-       {
-         DECL_INTERFACE_KNOWN (decl1) = 1;
-         if (DECL_C_STATIC (decl1))
-           TREE_PUBLIC (decl1) = 0;
-       }
+       DECL_INTERFACE_KNOWN (decl1) = 1;
     }
 
   if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1))
index 5b40e2704acc2392069e81877b91b20f9fb028da..9125783b26305d5e2a32e7e93f07fc97a2a7b22e 100644 (file)
@@ -575,7 +575,7 @@ lang_decode_option (p)
                }
            }
          name_mangling_version = atoi (p + 22);
-       mangling_version_lose:
+       mangling_version_lose: ;
        }
       else for (j = 0;
                !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]);
@@ -2806,8 +2806,6 @@ import_export_decl (decl)
       else
        comdat_linkage (decl);
     } 
-  else if (DECL_C_STATIC (decl))
-    TREE_PUBLIC (decl) = 0;
   else
     comdat_linkage (decl);
 
@@ -3284,14 +3282,6 @@ finish_file ()
   walk_vtables ((void (*) PROTO((tree, tree))) 0,
                prune_vtable_vardecl);
 
-  for (vars = getdecls (); vars; vars = TREE_CHAIN (vars))
-    {
-      if (TREE_CODE (vars) == FUNCTION_DECL
-         && ! DECL_INTERFACE_KNOWN (vars)
-         && DECL_C_STATIC (vars))
-       TREE_PUBLIC (vars) = 0;
-    }
-
   if (write_virtuals == 2)
     {
       /* Now complain about an virtual function tables promised
index 7ac69c29d078bc60eb37d24befdcf53b198aee50..3f6a5789f9281785a62f1ca1153246419cd90420 100644 (file)
@@ -1115,7 +1115,7 @@ coerce_template_parms (parms, arglist, in_decl)
                  else if (TREE_CODE (a) != VAR_DECL
                           && TREE_CODE (a) != FUNCTION_DECL)
                    goto bad;
-                 else if (! DECL_PUBLIC (a))
+                 else if (! TREE_PUBLIC (a))
                    {
                      cp_error ("address of non-extern `%E' cannot be used as template argument", a);
                      val = error_mark_node;