cp-tree.h, [...]: Lose DECL_C_STATIC and DECL_PUBLIC.

* 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
This commit is contained in:
Jason Merrill 1997-09-29 16:08:34 +00:00 committed by Jason Merrill
parent 9b16d2c4ef
commit 893de33c13
5 changed files with 22 additions and 46 deletions

View 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

View 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. */

View 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))

View 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

View 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;