Commit 9e9ff709 by Mike Stump

80th Cygnus<->FSF merge

From-SVN: r11150
parent 96bb8ed3
Thu Feb 1 09:27:01 1996 Mike Stump <mrs@cygnus.com>
* class.c (finish_struct_anon): Switch around code to not move anon
union elements around, nor mess up their contexts, nor offsets,
instead we now build up the right number of COMPONENT_REFs for all
the anon unions that may be present at build_component_ref time.
* typeck.c (lookup_anon_field): New routine to handle field lookup
on fields without names. We find them, based upon their unique type
instead.
* typeck.c (build_component_ref): Allow FIELD_DECL components.
Handle finding components in anonymous unions, and ensure that a
COMPONENT_REF is built for each level as necessary.
Tue Jan 30 18:18:23 1996 Mike Stump <mrs@cygnus.com>
* cvt.c (build_up_reference): Make the INDIRECT_BIND case come after
code that ensures that copy ctors are used if appropriate.
Tue Jan 30 17:35:14 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* init.c (build_vec_delete): Only give an error if base isn't an
error_mark_node.
Mon Jan 29 17:09:06 1996 Mike Stump <mrs@cygnus.com>
* spew.c (do_aggr): `new struct S;' isn't a forward declaration.
(yylex): If we see `new', keep slurping.
Thu Jan 25 18:31:36 1996 Mike Stump <mrs@cygnus.com>
* class.c (finish_struct_1): Move code for handling anon unions...
(finish_struct_anon): to here. Fixup so that we do the offset
calculations right, and so that the fields are physically moved to
the containers's chain.
Thu Jan 25 18:27:37 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* decl.c (grokdeclarator): Avoid trying to get an operand off an
identifier node.
Wed Jan 24 11:25:30 1996 Jim Wilson <wilson@chestnut.cygnus.com>
* typeck.c (pointer_int_sum): Use TYPE_PRECISION (sizetype) not
POINTER_SIZE to agree with expr.c.
Thu Jan 25 13:01:23 1996 Mike Stump <mrs@cygnus.com>
* search.c (lookup_field): Don't report ambiguities if protect is 0,
instead return NULL_TREE.
Wed Jan 24 13:01:26 1996 Mike Stump <mrs@cygnus.com>
* class.c (finish_struct_1): Call warn_hidden if we want warnings
about overloaded virtual functions.
(warn_hidden): New routine to warn of virtual functions that are
hidden by other virtual functions, that are not overridden.
(get_basefndecls): New routine, used by warn_hidden.
(mark_overriders): New routine, used by warn_hidden.
* search.c (get_matching_virtual): Remove old warning that just
isn't very useful.
Tue Jan 23 12:26:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* decl.c (output_builtin_tdesc_entries): #if 0 the function definition.
* typeck.c (null_ptr_cst_p): Delete unused fn.
(build_function_call_maybe): Delete unused fn.
* expr.c (extract_init): #if 0 the code after unconditional return 0
for now.
Delete old cadillac code.
* edsel.c: Remove file.
* Make-lang.in (CXX_SRCS): Take edsel.c off the list.
* Makefile.in (CXX_OBJS): Delete edsel.o.
(edsel.o): Delete rule.
* cp-tree.h (flag_cadillac): Delete var decl.
* lang-options.h: Delete "-fcadillac" and "-fno-cadillac".
* decl2.c (flag_cadillac): Delete var definition.
(lang_decode_option): Delete handling of -fcadillac and -fno-cadillac.
(grokfield): Delete code depending on flag_cadillac.
(finish_anon_union): Likewise.
* class.c (finish_struct_1): Likewise.
(pushclass): Likewise.
(popclass): Likewise.
(push_lang_context): Likewise.
(pop_lang_context): Likewise.
* decl.c (init_decl_processing): Likewise.
(start_decl): Likewise.
(cp_finish_decl): Likewise.
(xref_tag): Likewise.
(finish_enum): Likewise.
(start_function): Likewise.
(finish_function): Likewise.
(finish_stmt): Likewise.
* lex.c (lang_init): Likewise.
(check_newline): Likewise.
* lex.c (do_pending_inlines): Delete synthesized method kludge.
Delete defunct, ancient garbage collection implementation.
* rtti.c: New file with the RTTI stuff from gc.c.
* gc.c: Removed file (moved the remaining stuff into rtti.c).
* Makefile.in (CXX_OBJS): Replace gc.o with rtti.o.
(rtti.o): New rule, replacing gc.o.
* Make-lang.in (CXX_SRCS): Replace gc.c with rtti.c.
* cp-tree.h: Delete gc-related fn decls.
(DECL_GC_OFFSET): Delete macro.
(flag_gc): Delete extern decl.
* decl.c (current_function_obstack_index): Delete var decl.
(current_function_obstack_usage): Delete var decl.
(start_function): Delete clearing of current_function_obstack_index
and current_function_obstack_usage.
(init_decl_processing): Delete code relying on -fgc.
Delete call to init_gc_processing.
(cp_finish_decl): Delete calls to build_static_gc_entry and
type_needs_gc_entry. Delete gc code setting DECL_GC_OFFSET.
(store_parm_decls): Delete -fgc calls to cp_expand_decl_cleanup
and to expand_expr of a __gc_main call.
(maybe_gc_cleanup): Delete var decl.
(finish_function): Delete call to expand_gc_prologue_and_epilogue.
* decl2.c (flag_gc): Delete var decl.
(lang_f_options): Delete offering of -fgc.
(lang_decode_option): Delete -fgc and -fno-gc handling.
(get_temp_regvar): Delete gc code.
* init.c (build_new): Delete gc code.
* lex.c (init_lex): Delete checking of flag_gc.
* typeck.c (convert_arguments): Delete gc code.
(build_component_addr): Delete -fgc warning.
(build_modify_expr): Delete gc code.
* decl2.c (build_push_scope): Delete fn.
* cp-tree.h (build_push_scope): Delete decl.
* search.c (clear_search_slots): Delete fn.
* cp-tree.h (clear_search_slots): Delete decl.
* search.c (tree_needs_constructor_p): Delete fn.
* cp-tree.h (tree_needs_constructor_p): Delete decl.
* tree.c (id_cmp): Delete fn.
* tree.c (set_fnaddr_from_vtable_entry): Delete fn.
* cp-tree.h (set_fnaddr_from_vtable_entry): Delete decl.
* tree.c (decl_value_member): Delete fn.
* cp-tree.h (decl_value_member): Delete decl.
* tree.c (list_hash_lookup_or_cons): Delete fn.
* cp-tree.h (list_hash_lookup_or_cons): Delete decl.
* method.c (cplus_exception_name): Delete fn.
(EXCEPTION_NAME_{PREFIX, LENGTH}): Delete macros.
* spew.c (shift_tokens): Delete fn.
Mon Jan 22 17:49:33 1996 Jason Merrill <jason@yorick.cygnus.com>
* except.c (init_exception_processing): Pass 1 to needs_pop in calls
to cp_finish_decl.
* parse.y: Ditto.
Mon Jan 22 17:34:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* tree.c (build_cplus_staticfn_type): Delete function definition;
never used.
* cp-tree.h (build_cplus_staticfn_type): Delete decl.
* tree.c (virtual_member): Delete function definition; never used.
* cp-tree.h (virtual_member): Delete decl.
Fri Jan 19 18:03:14 1996 Mike Stump <mrs@cygnus.com>
* typeck.c (build_component_ref): Handle getting vbase pointers
......@@ -16,8 +188,8 @@ Fri Jan 19 16:01:47 1996 Mike Stump <mrs@cygnus.com>
Fri Jan 19 14:09:44 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (store_bindings): Split out from push_to_top_level.
(push_to_top_level): Call it for b->type_shadowed on class binding
levels.
(push_to_top_level): Call it for b->type_shadowed on class binding
levels.
Fri Jan 19 13:53:14 1996 Mike Stump <mrs@cygnus.com>
......@@ -86,7 +258,7 @@ Tue Jan 16 00:25:33 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (constructor_name_full): Handle TEMPLATE_TYPE_PARMs.
* decl.c (grokdeclarator): Also accept TEMPLATE_TYPE_PARM as a
scope.
scope.
Mon Jan 15 16:19:32 1996 Jason Merrill <jason@yorick.cygnus.com>
......@@ -96,8 +268,8 @@ Mon Jan 15 16:19:32 1996 Jason Merrill <jason@yorick.cygnus.com>
(nested_type): Ditto.
Take types directly instead of as identifiers.
* call.c (build_scoped_method_call): Take types directly instead of
as identifiers.
* decl.c (xref_basetypes): Ditto.
as identifiers.
* decl.c (xref_basetypes): Ditto.
* init.c (expand_member_init): Ditto.
(build_member_call): Ditto.
(build_offset_ref): Ditto.
......@@ -128,7 +300,7 @@ Thu Jan 11 14:55:07 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
Mon Jan 8 17:35:12 1996 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (build_modify_expr): Use a COMPOUND_EXPR instead of
expand_target_expr.
expand_target_expr.
Thu Jan 4 12:30:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
......@@ -225,7 +397,7 @@ Tue Dec 19 22:36:56 1995 Jason Merrill <jason@yorick.cygnus.com>
Mon Dec 18 15:51:33 1995 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.h, decl2.c (flag_weak): New flag to control the use of
weak symbols.
weak symbols.
* lang-options.h: Add -f{no-,}weak.
* decl.c (init_decl_processing): If the target does not support weak
symbols, don't use them.
......@@ -253,7 +425,7 @@ Thu Dec 14 16:05:58 1995 Mike Stump <mrs@cygnus.com>
Thu Dec 14 14:16:26 1995 Mike Stump <mrs@cygnus.com>
* init.c (expand_aggr_init_1): Use expand_aggr_init_1 instead of
expand_assignment, as the later doesn't handle things that have
expand_assignment, as the later doesn't handle things that have
copy constructors well. The compiler would do bitwise copying,
instead of ctor calling in some cases.
......@@ -325,7 +497,7 @@ Wed Dec 6 11:48:21 1995 Mike Stump <mrs@cygnus.com>
changes.
(push_eh_cleanup): New routine to register a cleanup for an
exception object.
(empty_fndecl): Used to default cleanup actions to
(empty_fndecl): Used to default cleanup actions to
nothing.
(init_exception_processing): Setup empty_fndecl. Setup
saved_cleanup.
......@@ -390,7 +562,7 @@ Wed Nov 22 14:19:22 1995 Mike Stump <mrs@cygnus.com>
Wed Nov 22 11:52:19 1995 Paul Russell <Rusty.Russell@adelaide.maptek.com.au>
* typeck.c (build_unary_op): Set TREE_NO_UNUSED_WARNING to avoid
warnings.
warnings.
Tue Nov 21 17:15:23 1995 Mike Stump <mrs@cygnus.com>
......@@ -408,7 +580,7 @@ Tue Nov 21 13:32:03 1995 Mike Stump <mrs@cygnus.com>
Thu Nov 9 13:35:30 1995 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (do_function_instantiation): Don't try to find a file-scope
template for a member function.
template for a member function.
Tue Nov 14 06:20:35 1995 Mike Stump <mrs@cygnus.com>
......@@ -537,7 +709,7 @@ Thu Oct 19 14:26:10 1995 Mike Stump <mrs@cygnus.com>
Thu Oct 19 10:36:30 1995 Jason Merrill <jason@yorick.cygnus.com>
* class.c (finish_struct_bits): Check aggregate_value_p instead of
RETURN_IN_MEMORY.
RETURN_IN_MEMORY.
Wed Oct 18 18:12:32 1995 Jason Merrill <jason@yorick.cygnus.com>
......@@ -740,7 +912,7 @@ Wed Sep 13 18:32:24 1995 Mike Stump <mrs@cygnus.com>
Wed Sep 13 16:52:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* typeck.c (comptypes): Tighten up comparisons of template type
parms.
parms.
* decl.c (duplicate_decls): Turn off whining about virtual functions
redeclared inline for now.
......@@ -9656,7 +9828,7 @@ Tue Dec 7 16:09:34 1993 Jason Merrill (jason@deneb.cygnus.com)
* toplev.c (lang_options): Ditto.
Mon Oct 4 12:50:02 1993 Chip Salzenberg (chip@fin.uucp)
Mon Oct 4 12:50:02 1993 Chip Salzenberg (chip@fin.uucp)
[changes propagated from 930810 snapshot]
* cp-decl.c (init_decl_processing): Make long long available for use
......
......@@ -86,9 +86,9 @@ $(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
$(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
$(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
$(srcdir)/cp/edsel.c $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
$(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
$(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
$(srcdir)/cp/errfn.c $(srcdir)/cp/gc.c $(srcdir)/cp/method.c \
$(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
$(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
$(srcdir)/cp/error.c $(srcdir)/cp/init.c $(srcdir)/cp/parse.y \
$(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/repo.c
......
......@@ -159,8 +159,8 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config
# Language-specific object files for g++
CXX_OBJS = call.o decl.o errfn.o expr.o pt.o sig.o typeck2.o \
class.o decl2.o error.o gc.o lex.o parse.o ptree.o spew.o typeck.o cvt.o \
edsel.o except.o init.o method.o search.o tree.o xref.o repo.o
class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \
except.o init.o method.o search.o tree.o xref.o repo.o
# Language-independent object files.
OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o
......@@ -238,11 +238,10 @@ cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) class.h
search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h $(srcdir)/../flags.h
tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H)
gc.o : gc.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
rtti.o : rtti.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
except.o : except.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H)
expr.o : expr.c $(CONFIG_H) $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
$(srcdir)/../expr.h ../insn-codes.h
edsel.o : edsel.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h $(srcdir)/../flags.h
xref.o : xref.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../input.h
pt.o : pt.c $(CONFIG_H) $(CXX_TREE_H) decl.h $(PARSE_H)
error.o : error.c $(CONFIG_H) $(CXX_TREE_H)
......
......@@ -2697,6 +2697,167 @@ merge_overrides (binfo, old, do_self, t)
}
}
/* Get the base virtual function declarations in T that are either
overridden or hidden by FNDECL as a list. We set TREE_PURPOSE with
the overrider/hider. */
tree
get_basefndecls (fndecl, t)
tree fndecl, t;
{
tree methods = TYPE_METHODS (t);
tree base_fndecls = NULL_TREE;
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
while (methods)
{
tree purpose = NULL_TREE;
if (TREE_CODE (methods) == FUNCTION_DECL
&& DECL_VINDEX (methods) != NULL_TREE
&& DECL_NAME (fndecl) == DECL_NAME (methods))
base_fndecls = temp_tree_cons (fndecl, methods, base_fndecls);
methods = TREE_CHAIN (methods);
}
if (base_fndecls)
return base_fndecls;
for (i = 0; i < n_baseclasses; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
tree basetype = BINFO_TYPE (base_binfo);
tree methods = TYPE_METHODS (basetype);
base_fndecls = chainon (get_basefndecls (fndecl, basetype),
base_fndecls);
}
return base_fndecls;
}
/* Mark the functions that have been hidden with their overriders.
Since we start out with all functions already marked with a hider,
no need to mark functions that are just hidden. */
void
mark_overriders (fndecl, base_fndecls)
tree fndecl, base_fndecls;
{
while (base_fndecls)
{
if (overrides (TREE_VALUE (base_fndecls), fndecl))
TREE_PURPOSE (base_fndecls) = fndecl;
base_fndecls = TREE_CHAIN (base_fndecls);
}
}
/* Warn about hidden virtual functions that are not overridden in t. */
void
warn_hidden (t)
tree t;
{
tree method_vec = CLASSTYPE_METHOD_VEC (t);
int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
int i;
/* We go through each separately named virtual function. */
for (i = 1; i < n_methods; ++i)
{
tree fndecl = TREE_VEC_ELT (method_vec, i);
tree base_fndecls = NULL_TREE;
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
if (DECL_VINDEX (fndecl) == NULL_TREE)
continue;
/* First we get a list of all possible functions that might be
hidden from each base class. */
for (i = 0; i < n_baseclasses; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
tree basetype = BINFO_TYPE (base_binfo);
base_fndecls = chainon (get_basefndecls (fndecl, basetype),
base_fndecls);
}
if (TREE_CHAIN (fndecl)
&& DECL_NAME (TREE_CHAIN (fndecl)) == DECL_NAME (fndecl))
fndecl = TREE_CHAIN (fndecl);
else
fndecl = NULL_TREE;
/* ...then mark up all the base functions with overriders, preferring
overriders to hiders. */
if (base_fndecls)
while (fndecl)
{
mark_overriders (fndecl, base_fndecls);
if (TREE_CHAIN (fndecl)
&& DECL_NAME (TREE_CHAIN (fndecl)) == DECL_NAME (fndecl))
fndecl = TREE_CHAIN (fndecl);
else
fndecl = NULL_TREE;
}
/* Now give a warning for all base functions without overriders,
as they are hidden. */
while (base_fndecls)
{
if (! overrides (TREE_VALUE (base_fndecls),
TREE_PURPOSE (base_fndecls)))
{
/* Here we know it is a hider, and no overrider exists. */
cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
cp_warning_at (" by `%D'", TREE_PURPOSE (base_fndecls));
}
base_fndecls = TREE_CHAIN (base_fndecls);
}
}
}
/* Check for things that are invalid. There are probably plenty of other
things we should check for also. */
static void
finish_struct_anon (t)
tree t;
{
tree field;
for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
{
if (TREE_STATIC (field))
continue;
if (TREE_CODE (field) != FIELD_DECL)
continue;
if (DECL_NAME (field) == NULL_TREE
&& TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{
tree* uelt = &TYPE_FIELDS (TREE_TYPE (field));
for (; *uelt; uelt = &TREE_CHAIN (*uelt))
{
tree offset, x;
if (TREE_CODE (*uelt) != FIELD_DECL)
continue;
if (TREE_PRIVATE (*uelt))
cp_pedwarn_at ("private member `%#D' in anonymous union",
*uelt);
else if (TREE_PROTECTED (*uelt))
cp_pedwarn_at ("protected member `%#D' in anonymous union",
*uelt);
}
}
}
}
extern int interface_only, interface_unknown;
/* Create a RECORD_TYPE or UNION_TYPE node for a C struct or union declaration
......@@ -3577,52 +3738,7 @@ finish_struct_1 (t, warn_anon)
layout_type (t);
{
tree field;
for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
{
if (TREE_STATIC (field))
continue;
if (TREE_CODE (field) != FIELD_DECL)
continue;
/* If this field is an anonymous union,
give each union-member the same position as the union has.
??? This is a real kludge because it makes the structure
of the types look strange. This feature is only used by
C++, which should have build_component_ref build two
COMPONENT_REF operations, one for the union and one for
the inner field. We set the offset of this field to zero
so that either the old or the correct method will work.
Setting DECL_FIELD_CONTEXT is wrong unless the inner fields are
moved into the type of this field, but nothing seems to break
by doing this. */
if (DECL_NAME (field) == NULL_TREE
&& TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{
tree uelt = TYPE_FIELDS (TREE_TYPE (field));
for (; uelt; uelt = TREE_CHAIN (uelt))
{
if (TREE_CODE (uelt) != FIELD_DECL)
continue;
if (TREE_PRIVATE (uelt))
cp_pedwarn_at ("private member `%#D' in anonymous union",
uelt);
else if (TREE_PROTECTED (uelt))
cp_pedwarn_at ("protected member `%#D' in anonymous union",
uelt);
DECL_FIELD_CONTEXT (uelt) = DECL_FIELD_CONTEXT (field);
DECL_FIELD_BITPOS (uelt) = DECL_FIELD_BITPOS (field);
}
DECL_FIELD_BITPOS (field) = integer_zero_node;
}
}
}
finish_struct_anon (t);
if (n_baseclasses)
TYPE_FIELDS (t) = TREE_CHAIN (TYPE_FIELDS (t));
......@@ -4001,8 +4117,8 @@ finish_struct_1 (t, warn_anon)
resume_momentary (old);
if (flag_cadillac)
cadillac_finish_struct (t);
if (warn_overloaded_virtual)
warn_hidden (t);
#if 0
/* This has to be done after we have sorted out what to do with
......@@ -4453,9 +4569,6 @@ pushclass (type, modify)
current_function_decl = this_fndecl;
}
if (flag_cadillac)
cadillac_push_class (type);
}
/* Get out of the current class scope. If we were in a class scope
......@@ -4466,9 +4579,6 @@ void
popclass (modify)
int modify;
{
if (flag_cadillac)
cadillac_pop_class ();
if (modify < 0)
{
/* Back this old class out completely. */
......@@ -4589,18 +4699,12 @@ push_lang_context (name)
}
else
error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name));
if (flag_cadillac)
cadillac_push_lang (name);
}
/* Get out of the current language scope. */
void
pop_lang_context ()
{
if (flag_cadillac)
cadillac_pop_lang ();
current_lang_name = *--current_lang_stack;
if (current_lang_name == lang_name_cplusplus)
strict_prototype = strict_prototypes_lang_cplusplus;
......
......@@ -298,10 +298,6 @@ extern int flag_handle_signatures;
inline by default. */
extern int flag_default_inline;
/* Nonzero means emit cadillac protocol. */
extern int flag_cadillac;
/* C++ language-specific tree codes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
......@@ -1318,9 +1314,6 @@ extern int flag_new_for_scope;
#define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
#define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
/* For local VAR_DECLs, holds index into gc-protected obstack. */
#define DECL_GC_OFFSET(NODE) ((NODE)->decl.result)
/* Accessor macros for C++ template decl nodes. */
#define DECL_TEMPLATE_IS_CLASS(NODE) (DECL_RESULT(NODE) == NULL_TREE)
#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
......@@ -1779,10 +1772,6 @@ extern int flag_this_is_variable;
extern int flag_int_enum_equivalence;
/* Nonzero means layout structures so that we can do garbage collection. */
extern int flag_gc;
/* Nonzero means generate 'rtti' that give run-time type information. */
extern int flag_rtti;
......@@ -1810,14 +1799,6 @@ extern int flag_implicit_templates;
extern int flag_weak;
/* Current end of entries in the gc obstack for stack pointer variables. */
extern int current_function_obstack_index;
/* Flag saying whether we have used the obstack in this function or not. */
extern int current_function_obstack_usage;
enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
extern tree current_class_decl, C_C_D; /* PARM_DECL: the class instance variable */
......@@ -2082,7 +2063,6 @@ extern tree grokfield PROTO((tree, tree, tree, tree, tree, tree));
extern tree grokbitfield PROTO((tree, tree, tree));
extern tree groktypefield PROTO((tree, tree));
extern tree grokoptypename PROTO((tree, tree));
extern tree build_push_scope PROTO((tree, tree));
extern void cplus_decl_attributes PROTO((tree, tree, tree));
extern tree constructor_name_full PROTO((tree));
extern tree constructor_name PROTO((tree));
......@@ -2113,8 +2093,6 @@ extern tree current_namespace_id PROTO((tree));
extern tree get_namespace_id PROTO((void));
extern void check_default_args PROTO((tree));
/* in edsel.c */
/* in except.c */
extern tree protect_list;
extern void start_protect PROTO((void));
......@@ -2145,19 +2123,12 @@ extern void fixup_result_decl PROTO((tree, struct rtx_def *));
extern int decl_in_memory_p PROTO((tree));
extern tree unsave_expr_now PROTO((tree));
/* in gc.c */
extern int type_needs_gc_entry PROTO((tree));
extern int value_safe_from_gc PROTO((tree, tree));
extern void build_static_gc_entry PROTO((tree, tree));
extern tree protect_value_from_gc PROTO((tree, tree));
/* in rtti.c */
extern tree build_headof PROTO((tree));
extern tree build_classof PROTO((tree));
extern tree build_t_desc PROTO((tree, int));
extern tree build_i_desc PROTO((tree));
extern tree build_m_desc PROTO((tree));
extern void expand_gc_prologue_and_epilogue PROTO((void));
extern void lang_expand_end_bindings PROTO((struct rtx_def *, struct rtx_def *));
extern void init_gc_processing PROTO((void));
extern tree build_typeid PROTO((tree));
extern tree get_typeid PROTO((tree));
extern tree build_dynamic_cast PROTO((tree, tree));
......@@ -2174,7 +2145,6 @@ extern tree get_aggr_from_typedef PROTO((tree, int));
extern tree get_type_value PROTO((tree));
extern tree build_member_call PROTO((tree, tree, tree));
extern tree build_offset_ref PROTO((tree, tree));
extern tree get_member_function PROTO((tree *, tree, tree));
extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
extern tree resolve_offset_ref PROTO((tree));
extern tree decl_constant_value PROTO((tree));
......@@ -2316,14 +2286,13 @@ extern tree lookup_nested_field PROTO((tree, int));
extern tree lookup_fnfields PROTO((tree, tree, int));
extern tree lookup_nested_tag PROTO((tree, tree));
extern HOST_WIDE_INT breadth_first_search PROTO((tree, int (*)(), int (*)()));
extern int tree_needs_constructor_p PROTO((tree, int));
extern int tree_has_any_destructor_p PROTO((tree, int));
extern tree get_matching_virtual PROTO((tree, tree, int));
extern tree get_abstract_virtuals PROTO((tree));
extern tree get_baselinks PROTO((tree, tree, tree));
extern tree next_baselink PROTO((tree));
extern tree init_vbase_pointers PROTO((tree, tree));
extern void expand_indirect_vtbls_init PROTO((tree, tree, tree, int));
extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
extern void clear_search_slots PROTO((tree));
extern tree get_vbase_types PROTO((tree));
extern void build_mi_matrix PROTO((tree));
......@@ -2375,19 +2344,15 @@ extern tree hash_tree_cons PROTO((int, int, int, tree, tree, tree));
extern tree hash_tree_chain PROTO((tree, tree));
extern tree hash_chainon PROTO((tree, tree));
extern tree get_decl_list PROTO((tree));
extern tree list_hash_lookup_or_cons PROTO((tree));
extern tree make_binfo PROTO((tree, tree, tree, tree, tree));
extern tree binfo_value PROTO((tree, tree));
extern tree reverse_path PROTO((tree));
extern tree virtual_member PROTO((tree, tree));
extern void debug_binfo PROTO((tree));
extern int decl_list_length PROTO((tree));
extern int count_functions PROTO((tree));
extern tree decl_value_member PROTO((tree, tree));
extern int is_overloaded_fn PROTO((tree));
extern tree get_first_fn PROTO((tree));
extern tree fnaddr_from_vtable_entry PROTO((tree));
extern void set_fnaddr_from_vtable_entry PROTO((tree, tree));
extern tree function_arg_chain PROTO((tree));
extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
extern int is_aggr_type_2 PROTO((tree, tree));
......
......@@ -590,15 +590,7 @@ build_up_reference (type, arg, flags, checkconst)
{
tree temp;
if (flags&INDIRECT_BIND)
{
tree slot = build (VAR_DECL, argtype);
layout_decl (slot, 0);
rval = build (TARGET_EXPR, argtype, slot, arg, 0);
rval = build1 (ADDR_EXPR, type, rval);
goto done;
}
else if (TREE_CODE (targ) == CALL_EXPR && IS_AGGR_TYPE (argtype))
if (TREE_CODE (targ) == CALL_EXPR && IS_AGGR_TYPE (argtype))
{
temp = build_cplus_new (argtype, targ, 1);
if (TREE_CODE (temp) == WITH_CLEANUP_EXPR)
......@@ -609,6 +601,17 @@ build_up_reference (type, arg, flags, checkconst)
rval = build1 (ADDR_EXPR, type, temp);
goto done;
}
else if (flags&INDIRECT_BIND)
{
/* This should be the default, not the below code. */
/* All callers except grok_reference_init should probably
use INDIRECT_BIND. */
tree slot = build (VAR_DECL, argtype);
layout_decl (slot, 0);
rval = build (TARGET_EXPR, argtype, slot, arg, 0);
rval = build1 (ADDR_EXPR, type, rval);
goto done;
}
else
{
temp = get_temp_name (argtype, 0);
......
......@@ -260,7 +260,6 @@ tree class_type_node, record_type_node, union_type_node, enum_type_node;
tree unknown_type_node;
tree opaque_type_node, signature_type_node;
tree sigtable_entry_type;
tree maybe_gc_cleanup;
/* Array type `vtable_entry_type[]' */
tree vtbl_type_node;
......@@ -383,13 +382,6 @@ static tree named_labels;
static tree shadowed_labels;
#if 0 /* Not needed by C++ */
/* Nonzero when store_parm_decls is called indicates a varargs function.
Value not meaningful after store_parm_decls. */
static int c_function_varargs;
#endif
/* The FUNCTION_DECL for the function currently being compiled,
or 0 if between functions. */
tree current_function_decl;
......@@ -461,14 +453,6 @@ int current_function_just_assigned_this;
if this flag is non-zero! */
int current_function_parms_stored;
/* Current end of entries in the gc obstack for stack pointer variables. */
int current_function_obstack_index;
/* Flag saying whether we have used the obstack in this function or not. */
int current_function_obstack_usage;
/* Flag used when debugging spew.c */
extern int spew_debug;
......@@ -707,14 +691,10 @@ pop_binding_level ()
(is_class_level) ? "class" : "block",
current_binding_level, lineno);
if (is_class_level != (current_binding_level == class_binding_level))
#if 0 /* XXX Don't abort when we're watching how things are being managed. */
abort ();
#else
{
indent ();
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
}
#endif
{
indent ();
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
}
is_class_level = 0;
#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
{
......@@ -755,14 +735,10 @@ suspend_binding_level ()
(is_class_level) ? "class" : "block",
current_binding_level, lineno);
if (is_class_level != (current_binding_level == class_binding_level))
#if 0 /* XXX Don't abort when we're watching how things are being managed. */
abort ();
#else
{
indent ();
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
}
#endif
{
indent ();
fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
}
is_class_level = 0;
#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
{
......@@ -1026,35 +1002,6 @@ poplevel (keep, reverse, functionbody)
if (current_binding_level->keep == 1)
keep = 1;
/* This warning is turned off because it causes warnings for
declarations like `extern struct foo *x'. */
#if 0
/* Warn about incomplete structure types in this level. */
for (link = tags; link; link = TREE_CHAIN (link))
if (TYPE_SIZE (TREE_VALUE (link)) == NULL_TREE)
{
tree type = TREE_VALUE (link);
char *errmsg;
switch (TREE_CODE (type))
{
case RECORD_TYPE:
errmsg = "`struct %s' incomplete in scope ending here";
break;
case UNION_TYPE:
errmsg = "`union %s' incomplete in scope ending here";
break;
case ENUMERAL_TYPE:
errmsg = "`enum %s' incomplete in scope ending here";
break;
}
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
error (errmsg, IDENTIFIER_POINTER (TYPE_NAME (type)));
else
/* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */
error (errmsg, TYPE_NAME_STRING (type));
}
#endif /* 0 */
/* Get the decls in the order they were written.
Usually current_binding_level->names is in reverse order.
But parameter decls were previously put in forward order. */
......@@ -1305,11 +1252,6 @@ poplevel (keep, reverse, functionbody)
/* Take care of compiler's internal binding structures. */
if (tmp == 2)
{
#if 0
/* We did not call push_momentary for this
binding contour, so there is nothing to pop. */
pop_momentary ();
#endif
expand_end_bindings (getdecls (), keep, 1);
/* Each and every BLOCK node created here in `poplevel' is important
(e.g. for proper debugging information) so if we created one
......@@ -1613,17 +1555,7 @@ print_binding_level (lvl)
fprintf (stderr, " type-shadowed:");
for (t = lvl->type_shadowed; t; t = TREE_CHAIN (t))
{
#if 0
fprintf (stderr, "\n\t");
print_node_brief (stderr, "<", TREE_PURPOSE (t), 0);
if (TREE_VALUE (t))
print_node_brief (stderr, " ", TREE_VALUE (t), 0);
else
fprintf (stderr, " (none)");
fprintf (stderr, ">");
#else
fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
#endif
}
fprintf (stderr, "\n");
}
......@@ -1700,11 +1632,6 @@ get_unique_name ()
{
for (p = buf+11; *p; p++)
if (! ((*p >= '0' && *p <= '9')
#if 0 /* we always want labels, which are valid C++ identifiers (+ `$') */
#ifndef ASM_IDENTIFY_GCC /* this is required if `.' is invalid -- k. raeburn */
|| *p == '.'
#endif
#endif
#ifndef NO_DOLLAR_IN_LABEL /* this for `$'; unlikely, but... -- kr */
|| *p == '$'
#endif
......@@ -2093,37 +2020,6 @@ pop_everything ()
#endif
}
#if 0 /* not yet, should get fixed properly later */
/* Create a TYPE_DECL node with the correct DECL_ASSEMBLER_NAME.
Other routines shouldn't use build_decl directly; they'll produce
incorrect results with `-g' unless they duplicate this code.
This is currently needed mainly for dbxout.c, but we can make
use of it in method.c later as well. */
tree
make_type_decl (name, type)
tree name, type;
{
tree decl, id;
decl = build_decl (TYPE_DECL, name, type);
if (TYPE_NAME (type) == name)
/* Class/union/enum definition, or a redundant typedef for same. */
{
id = get_identifier (build_overload_name (type, 1, 1));
DECL_ASSEMBLER_NAME (decl) = id;
}
else if (TYPE_NAME (type) != NULL_TREE)
/* Explicit typedef, or implicit typedef for template expansion. */
DECL_ASSEMBLER_NAME (decl) = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
else
{
/* XXX: Typedef for unnamed struct; some other situations.
TYPE_NAME is null; what's right here? */
}
return decl;
}
#endif
/* Push a tag name NAME for struct/class/union/enum type TYPE.
Normally put into into the inner-most non-tag-transparent scope,
but if GLOBALIZE is true, put it in the inner-most non-class scope.
......@@ -2157,12 +2053,6 @@ pushtag (name, type, globalize)
c_decl = TREE_CODE (context) == FUNCTION_DECL
? context : TYPE_MAIN_DECL (context);
#if 0
/* Record the identifier as the type's name if it has none. */
if (TYPE_NAME (type) == NULL_TREE)
TYPE_NAME (type) = name;
#endif
/* Do C++ gratuitous typedefing. */
if (IDENTIFIER_TYPE_VALUE (name) != type)
{
......@@ -2177,12 +2067,8 @@ pushtag (name, type, globalize)
if (d == NULL_TREE)
{
newdecl = 1;
#if 0 /* not yet, should get fixed properly later */
d = make_type_decl (name, type);
#else
d = build_decl (TYPE_DECL, name, type);
DECL_ASSEMBLER_NAME (d) = current_namespace_id (DECL_ASSEMBLER_NAME (d));
#endif
SET_DECL_ARTIFICIAL (d);
#ifdef DWARF_DEBUGGING_INFO
if (write_symbols == DWARF_DEBUG)
......@@ -2287,11 +2173,7 @@ pushtag (name, type, globalize)
convenient place to record the "scope start" address for
the tagged type. */
#if 0 /* not yet, should get fixed properly later */
tree d = make_type_decl (NULL_TREE, type);
#else
tree d = build_decl (TYPE_DECL, NULL_TREE, type);
#endif
TYPE_STUB_DECL (type) = pushdecl_with_scope (d, b);
}
}
......@@ -2799,18 +2681,6 @@ duplicate_decls (newdecl, olddecl)
CLASSTYPE_FRIEND_CLASSES (newtype)
= CLASSTYPE_FRIEND_CLASSES (oldtype);
}
#if 0
/* why assert here? Just because debugging information is
messed up? (mrs) */
/* it happens on something like:
typedef struct Thing {
Thing();
int x;
} Thing;
*/
my_friendly_assert (DECL_IGNORED_P (olddecl) == DECL_IGNORED_P (newdecl),
139);
#endif
}
/* Special handling ensues if new decl is a function definition. */
......@@ -3098,23 +2968,9 @@ pushdecl (x)
tree x;
{
register tree t;
#if 0 /* not yet, should get fixed properly later */
register tree name;
#else
register tree name = DECL_ASSEMBLER_NAME (x);
#endif
register struct binding_level *b = current_binding_level;
#if 0
static int nglobals; int len;
len = list_length (global_binding_level->names);
if (len < nglobals)
my_friendly_abort (8);
else if (len > nglobals)
nglobals = len;
#endif
if (x != current_function_decl
/* Don't change DECL_CONTEXT of virtual methods. */
&& (TREE_CODE (x) != FUNCTION_DECL || !DECL_VIRTUAL_P (x))
......@@ -3124,21 +2980,11 @@ pushdecl (x)
if (TREE_CODE (x) == FUNCTION_DECL && DECL_INITIAL (x) == 0)
DECL_CONTEXT (x) = 0;
#if 0 /* not yet, should get fixed properly later */
/* For functions and class static data, we currently look up the encoded
form of the name. For types, we want the real name. The former will
probably be changed soon, according to MDT. */
if (TREE_CODE (x) == FUNCTION_DECL || TREE_CODE (x) == VAR_DECL)
name = DECL_ASSEMBLER_NAME (x);
else
name = DECL_NAME (x);
#else
/* Type are looked up using the DECL_NAME, as that is what the rest of the
compiler wants to use. */
if (TREE_CODE (x) == TYPE_DECL || TREE_CODE (x) == VAR_DECL
|| TREE_CODE (x) == NAMESPACE_DECL)
name = DECL_NAME (x);
#endif
if (name)
{
......@@ -3544,13 +3390,6 @@ pushdecl_top_level (x)
}
else
{
#if 0
/* Disabled this 11/10/92, since there are many cases which
behave just fine when *ptr doesn't satisfy either of these.
For example, nested classes declared as friends of their enclosing
class will not meet this criteria. (bpk) */
my_friendly_assert (*ptr == NULL_TREE || *ptr == newval, 141);
#endif
*ptr = newval;
}
}
......@@ -3626,14 +3465,7 @@ pushdecl_nonclass_level (x)
{
struct binding_level *b = current_binding_level;
#if 0
/* Get out of class scope -- this isn't necessary, because class scope
doesn't make it into current_binding_level. */
while (b->parm_flag == 2)
b = b->level_chain;
#else
my_friendly_assert (b->parm_flag != 2, 180);
#endif
/* Get out of template binding levels */
while (b->pseudo_global)
......@@ -3728,14 +3560,6 @@ push_overloaded_decl (decl, forgettable)
if (old)
{
#if 0
/* We cache the value of builtin functions as ADDR_EXPRs
in the name space. Convert it to some kind of _DECL after
remembering what to forget. */
if (TREE_CODE (old) == ADDR_EXPR)
old = TREE_OPERAND (old, 0);
else
#endif
if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
{
tree t = TREE_TYPE (old);
......@@ -4664,11 +4488,7 @@ record_builtin_type (rid_index, name, type)
if (tname)
{
#if 0 /* not yet, should get fixed properly later */
tdecl = pushdecl (make_type_decl (tname, type));
#else
tdecl = pushdecl (build_decl (TYPE_DECL, tname, type));
#endif
set_identifier_type_value (tname, NULL_TREE);
if ((int) rid_index < (int) RID_MAX)
IDENTIFIER_GLOBAL_VALUE (tname) = tdecl;
......@@ -4682,11 +4502,7 @@ record_builtin_type (rid_index, name, type)
}
else
{
#if 0 /* not yet, should get fixed properly later */
tdecl = pushdecl (make_type_decl (rname, type));
#else
tdecl = pushdecl (build_decl (TYPE_DECL, rname, type));
#endif
set_identifier_type_value (rname, NULL_TREE);
}
}
......@@ -4718,28 +4534,6 @@ record_builtin_type (rid_index, name, type)
}
}
static void
output_builtin_tdesc_entries ()
{
extern struct obstack permanent_obstack;
/* If there's more than one main in this file, don't crash. */
if (builtin_type_tdescs_arr == 0)
return;
push_obstacks (&permanent_obstack, &permanent_obstack);
while (builtin_type_tdescs_len > 0)
{
tree type = builtin_type_tdescs_arr[--builtin_type_tdescs_len];
tree tdesc = build_t_desc (type, 0);
TREE_ASM_WRITTEN (tdesc) = 0;
build_t_desc (type, 2);
}
free (builtin_type_tdescs_arr);
builtin_type_tdescs_arr = 0;
pop_obstacks ();
}
/* Push overloaded decl, in global scope, with one argument so it
can be used as a callback from define_function. */
static void
......@@ -4777,10 +4571,6 @@ init_decl_processing ()
tree traditional_ptr_type_node;
/* Data type of memcpy. */
tree memcpy_ftype;
#if 0 /* Not yet. */
/* Data type of strncpy. */
tree strncpy_ftype;
#endif
int wchar_type_size;
tree temp;
tree array_domain_type;
......@@ -5078,17 +4868,6 @@ init_decl_processing ()
const_string_type_node,
endlink)));
#if 0
/* Not yet. */
strncpy_ftype /* strncpy prototype */
= build_function_type (string_type_node,
tree_cons (NULL_TREE, string_type_node,
tree_cons (NULL_TREE, const_string_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
#endif
int_ftype_string_string /* strcmp prototype */
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_string_type_node,
......@@ -5183,15 +4962,6 @@ init_decl_processing ()
builtin_function ("__builtin_saveregs",
build_function_type (ptr_type_node, NULL_TREE),
BUILT_IN_SAVEREGS, NULL_PTR);
/* EXPAND_BUILTIN_VARARGS is obsolete. */
#if 0
builtin_function ("__builtin_varargs",
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink)),
BUILT_IN_VARARGS, NULL_PTR);
#endif
builtin_function ("__builtin_classify_type", default_function_type,
BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
builtin_function ("__builtin_next_arg",
......@@ -5236,11 +5006,6 @@ init_decl_processing ()
BUILT_IN_STRCMP, "strcmp");
builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
BUILT_IN_STRCPY, "strcpy");
#if 0
/* Not yet. */
builtin_function ("__builtin_strncpy", strncpy_ftype,
BUILT_IN_STRNCPY, "strncpy");
#endif
builtin_function ("__builtin_strlen", sizet_ftype_string,
BUILT_IN_STRLEN, "strlen");
......@@ -5257,10 +5022,6 @@ init_decl_processing ()
builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP, NULL_PTR);
builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
NULL_PTR);
#if 0
/* Not yet. */
builtin_function ("strncpy", strncpy_ftype, BUILT_IN_STRNCPY, NULL_PTR);
#endif
builtin_function ("strlen", sizet_ftype_string, BUILT_IN_STRLEN, NULL_PTR);
builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
......@@ -5306,16 +5067,11 @@ init_decl_processing ()
/* C++ extensions */
unknown_type_node = make_node (UNKNOWN_TYPE);
#if 0 /* not yet, should get fixed properly later */
pushdecl (make_type_decl (get_identifier ("unknown type"),
unknown_type_node));
#else
decl = pushdecl (build_decl (TYPE_DECL, get_identifier ("unknown type"),
unknown_type_node));
/* Make sure the "unknown type" typedecl gets ignored for debug info. */
DECL_IGNORED_P (decl) = 1;
TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
#endif
TYPE_SIZE (unknown_type_node) = TYPE_SIZE (void_type_node);
TYPE_ALIGN (unknown_type_node) = 1;
TYPE_MODE (unknown_type_node) = TYPE_MODE (void_type_node);
......@@ -5351,14 +5107,6 @@ init_decl_processing ()
wchar_array_type_node
= build_array_type (wchar_type_node, array_domain_type);
/* This is a hack that should go away when we deliver the
real gc code. */
if (flag_gc)
{
builtin_function ("__gc_main", default_function_type, NOT_BUILT_IN, NULL_PTR);
pushdecl (lookup_name (get_identifier ("__gc_main"), 0));
}
if (flag_vtable_thunks)
{
/* Make sure we get a unique function type, so we can give
......@@ -5597,18 +5345,11 @@ init_decl_processing ()
if (flag_handle_exceptions)
init_exception_processing ();
if (flag_gc)
init_gc_processing ();
if (flag_no_inline)
{
flag_inline_functions = 0;
#if 0
/* This causes unnecessary emission of inline functions. */
flag_default_inline = 0;
#endif
}
if (flag_cadillac)
init_cadillac ();
if (! SUPPORTS_WEAK)
flag_weak = 0;
......@@ -6090,23 +5831,6 @@ start_decl (declarator, declspecs, initialized, raises)
save some disk space. */
DECL_COMMON (tem) = flag_conserve_space || ! TREE_PUBLIC (tem);
#if 0
/* We don't do this yet for GNU C++. */
/* For a local variable, define the RTL now. */
if (! toplevel_bindings_p ()
/* But not if this is a duplicate decl
and we preserved the rtl from the previous one
(which may or may not happen). */
&& DECL_RTL (tem) == NULL_RTX)
{
if (TYPE_SIZE (TREE_TYPE (tem)) != NULL_TREE)
expand_decl (tem);
else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
&& DECL_INITIAL (tem) != NULL_TREE)
expand_decl (tem);
}
#endif
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
tree result = DECL_TEMPLATE_RESULT (decl);
......@@ -6126,21 +5850,8 @@ start_decl (declarator, declspecs, initialized, raises)
return tem;
else if (TREE_CODE (result) == VAR_DECL)
{
#if 0
tree tmpl = UPT_TEMPLATE (type);
fprintf (stderr, "%s:%d: adding ", __FILE__, __LINE__);
print_node_brief (stderr, "", DECL_NAME (tem), 0);
fprintf (stderr, " to class %s\n",
IDENTIFIER_POINTER (DECL_NAME (tmpl)));
DECL_TEMPLATE_MEMBERS (tmpl)
= perm_tree_cons (DECL_NAME (tem), tem,
DECL_TEMPLATE_MEMBERS (tmpl));
return tem;
#else
sorry ("static data member templates");
return NULL_TREE;
#endif
}
else
my_friendly_abort (13);
......@@ -6182,72 +5893,9 @@ start_decl (declarator, declspecs, initialized, raises)
}
}
if (flag_cadillac)
cadillac_start_decl (tem);
return tem;
}
#if 0 /* unused */
static void
make_temporary_for_reference (decl, ctor_call, init, cleanupp)
tree decl, ctor_call, init;
tree *cleanupp;
{
tree type = TREE_TYPE (decl);
tree target_type = TREE_TYPE (type);
tree tmp, tmp_addr;
if (ctor_call)
{
tmp_addr = TREE_VALUE (TREE_OPERAND (ctor_call, 1));
if (TREE_CODE (tmp_addr) == NOP_EXPR)
tmp_addr = TREE_OPERAND (tmp_addr, 0);
my_friendly_assert (TREE_CODE (tmp_addr) == ADDR_EXPR, 146);
tmp = TREE_OPERAND (tmp_addr, 0);
}
else
{
tmp = get_temp_name (target_type, toplevel_bindings_p ());
tmp_addr = build_unary_op (ADDR_EXPR, tmp, 0);
}
TREE_TYPE (tmp_addr) = build_pointer_type (target_type);
DECL_INITIAL (decl) = convert (build_pointer_type (target_type), tmp_addr);
TREE_TYPE (DECL_INITIAL (decl)) = type;
if (TYPE_NEEDS_CONSTRUCTING (target_type))
{
if (toplevel_bindings_p ())
{
/* lay this variable out now. Otherwise `output_addressed_constants'
gets confused by its initializer. */
make_decl_rtl (tmp, NULL_PTR, 1);
static_aggregates = perm_tree_cons (init, tmp, static_aggregates);
}
else
{
if (ctor_call != NULL_TREE)
init = ctor_call;
else
init = build_method_call (tmp, constructor_name_full (target_type),
build_tree_list (NULL_TREE, init),
NULL_TREE, LOOKUP_NORMAL);
DECL_INITIAL (decl) = build (COMPOUND_EXPR, type, init,
DECL_INITIAL (decl));
*cleanupp = maybe_build_cleanup (tmp);
}
}
else
{
DECL_INITIAL (tmp) = init;
TREE_STATIC (tmp) = toplevel_bindings_p ();
cp_finish_decl (tmp, init, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
}
if (TREE_STATIC (tmp))
preserve_initializer ();
}
#endif
/* Handle initialization of references.
These three arguments from from `cp_finish_decl', and have the
same meaning here that they do there. */
......@@ -6476,28 +6124,6 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (TREE_CODE (decl) != FUNCTION_DECL)
{
ttype = target_type (type);
#if 0 /* WTF? -KR
Leave this out until we can figure out why it was
needed/desirable in the first place. Then put a comment
here explaining why. Or just delete the code if no ill
effects arise. */
if (TYPE_NAME (ttype)
&& TREE_CODE (TYPE_NAME (ttype)) == TYPE_DECL
&& ANON_AGGRNAME_P (TYPE_IDENTIFIER (ttype)))
{
tree old_id = TYPE_IDENTIFIER (ttype);
char *newname = (char *)alloca (IDENTIFIER_LENGTH (old_id) + 2);
/* Need to preserve template data for UPT nodes. */
tree old_template = IDENTIFIER_TEMPLATE (old_id);
newname[0] = '_';
bcopy (IDENTIFIER_POINTER (old_id), newname + 1,
IDENTIFIER_LENGTH (old_id) + 1);
old_id = get_identifier (newname);
lookup_tag_reverse (ttype, old_id);
TYPE_IDENTIFIER (ttype) = old_id;
IDENTIFIER_TEMPLATE (old_id) = old_template;
}
#endif
}
if (! DECL_EXTERNAL (decl) && TREE_READONLY (decl)
......@@ -6762,12 +6388,6 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (was_temp)
end_temporary_allocation ();
if (TREE_CODE (decl) == VAR_DECL
&& ! toplevel_bindings_p ()
&& ! TREE_STATIC (decl)
&& type_needs_gc_entry (type))
DECL_GC_OFFSET (decl) = size_int (++current_function_obstack_index);
if (TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl))
make_decl_rtl (decl, NULL_PTR, toplev);
else if (TREE_CODE (decl) == VAR_DECL
......@@ -6870,10 +6490,6 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
|| TYPE_NEEDS_DESTRUCTOR (type))
expand_static_init (decl, init);
/* Make entry in appropriate vector. */
if (flag_gc && type_needs_gc_entry (type))
build_static_gc_entry (decl, type);
}
else if (! toplev)
{
......@@ -7012,9 +6628,6 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (was_readonly)
TREE_READONLY (decl) = 1;
if (flag_cadillac)
cadillac_finish_decl (decl);
}
/* This is here for a midend callback from c-common.c */
......@@ -8288,13 +7901,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
volatilep = !! RIDBIT_SETP (RID_VOLATILE, specbits) + TYPE_VOLATILE (type);
staticp = 0;
inlinep = !! RIDBIT_SETP (RID_INLINE, specbits);
#if 0
/* This sort of redundancy is blessed in a footnote to the Sep 94 WP. */
if (constp > 1)
warning ("duplicate `const'");
if (volatilep > 1)
warning ("duplicate `volatile'");
#endif
virtualp = RIDBIT_SETP (RID_VIRTUAL, specbits);
RIDBIT_RESET (RID_VIRTUAL, specbits);
explicitp = RIDBIT_SETP (RID_EXPLICIT, specbits) != 0;
......@@ -8324,20 +7930,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
error ("non-object member `%s' cannot be declared `mutable'", name);
RIDBIT_RESET (RID_MUTABLE, specbits);
}
#if 0
if (RIDBIT_SETP (RID_TYPEDEF, specbits))
{
error ("non-object member `%s' cannot be declared `mutable'", name);
RIDBIT_RESET (RID_MUTABLE, specbits);
}
/* Because local typedefs are parsed twice, we don't want this
message here. */
else if (decl_context != FIELD)
{
error ("non-member `%s' cannot be declared `mutable'", name);
RIDBIT_RESET (RID_MUTABLE, specbits);
}
#endif
}
/* Warn if two storage classes are given. Default to `auto'. */
......@@ -8517,7 +8109,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
if (declarator)
{
tmp = TREE_OPERAND (declarator, 0);
/* Avoid trying to get an operand off an identifier node. */
if (TREE_CODE (declarator) == IDENTIFIER_NODE)
tmp = declarator;
else
tmp = TREE_OPERAND (declarator, 0);
op = IDENTIFIER_OPNAME_P (tmp);
}
error ("storage class specified for %s `%s'",
......@@ -8562,21 +8158,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
{
if (RIDBIT_SETP (RID_AUTO, specbits))
error ("top-level declaration of `%s' specifies `auto'", name);
#if 0
if (RIDBIT_SETP (RID_REGISTER, specbits))
error ("top-level declaration of `%s' specifies `register'", name);
#endif
#if 0
/* I'm not sure under what circumstances we should turn
on the extern bit, and under what circumstances we should
warn if other bits are turned on. */
if (decl_context == NORMAL
&& RIDBIT_NOSETP (RID_EXTERN, specbits)
&& ! root_lang_context_p ())
{
RIDBIT_SET (RID_EXTERN, specbits);
}
#endif
}
/* Now figure out the structure of the declarator proper.
......@@ -8622,11 +8203,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
ctype = TYPE_METHOD_BASETYPE (type);
if (ctype != NULL_TREE)
{
#if 0 /* not yet, should get fixed properly later */
tree dummy = make_type_decl (NULL_TREE, type);
#else
tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
#endif
ctype = grok_method_quals (ctype, dummy, quals);
type = TREE_TYPE (dummy);
quals = NULL_TREE;
......@@ -9360,11 +8937,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
}
}
#if 0 /* not yet, should get fixed properly later */
decl = make_type_decl (declarator, type);
#else
decl = build_decl (TYPE_DECL, declarator, type);
#endif
if (TREE_CODE (type) == OFFSET_TYPE || TREE_CODE (type) == METHOD_TYPE)
{
cp_error_at ("typedef name may not be class-qualified", decl);
......@@ -9448,11 +9021,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
}
else if (quals)
{
#if 0 /* not yet, should get fixed properly later */
tree dummy = make_type_decl (declarator, type);
#else
tree dummy = build_decl (TYPE_DECL, declarator, type);
#endif
if (ctype == NULL_TREE)
{
my_friendly_assert (TREE_CODE (type) == METHOD_TYPE, 159);
......@@ -9485,12 +9054,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
else if (TREE_CODE (declarator) == IDENTIFIER_NODE)
{
if (IDENTIFIER_OPNAME_P (declarator))
#if 0 /* How could this happen? */
error ("operator `%s' declared void",
operator_name_string (declarator));
#else
my_friendly_abort (356);
#endif
else
error ("variable or field `%s' declared void", name);
}
......@@ -10198,15 +9762,7 @@ grokparms (first_parm, funcdef_flag)
}
else
init = require_instantiated_type (type, init, integer_zero_node);
}
#if 0 /* This is too early to check; trailing parms might be merged in by
duplicate_decls. */
else if (any_init)
{
error ("all trailing parameters must have default arguments");
any_error = 1;
}
#endif
}
else
init = NULL_TREE;
......@@ -10502,10 +10058,6 @@ grok_op_properties (decl, virtualp, friendp)
if (TREE_CODE (parmtype) != REFERENCE_TYPE
|| TYPE_READONLY (TREE_TYPE (parmtype)))
TYPE_HAS_CONST_ASSIGN_REF (current_class_type) = 1;
#if 0 /* Too soon; done in grok_function_init */
if (DECL_ABSTRACT_VIRTUAL_P (decl))
TYPE_HAS_ABSTRACT_ASSIGN_REF (current_class_type) = 1;
#endif
}
}
else if (name == ansi_opname[(int) COND_EXPR])
......@@ -10697,8 +10249,6 @@ xref_tag (code_type_node, name, binfo, globalize)
done in `start_enum'. */
pushtag (name, ref, globalize);
if (flag_cadillac)
cadillac_start_enum (ref);
}
else
{
......@@ -10723,9 +10273,6 @@ xref_tag (code_type_node, name, binfo, globalize)
#endif
pushtag (name, ref, globalize);
class_binding_level = old_b;
if (flag_cadillac)
cadillac_start_struct (ref);
}
}
else
......@@ -10735,31 +10282,6 @@ xref_tag (code_type_node, name, binfo, globalize)
if (b == global_binding_level && !class_binding_level
&& IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE)
IDENTIFIER_GLOBAL_VALUE (name) = TYPE_NAME (ref);
#if 0
if (binfo)
{
tree tt1 = binfo;
tree tt2 = TYPE_BINFO_BASETYPES (ref);
if (TYPE_BINFO_BASETYPES (ref))
for (i = 0; tt1; i++, tt1 = TREE_CHAIN (tt1))
if (TREE_VALUE (tt1) != TYPE_IDENTIFIER (BINFO_TYPE (TREE_VEC_ELT (tt2, i))))
{
cp_error ("redeclaration of derivation chain of type `%#T'",
ref);
break;
}
if (tt1 == NULL_TREE)
/* The user told us something we already knew. */
goto just_return;
/* In C++, since these migrate into the global scope, we must
build them on the permanent obstack. */
end_temporary_allocation ();
}
#endif
}
if (binfo)
......@@ -10876,17 +10398,7 @@ xref_basetypes (code_type_node, name, ref, binfo)
BINFO_INHERITANCE_CHAIN (base_binfo) = TYPE_BINFO (ref);
SET_CLASSTYPE_MARKED (basetype);
#if 0
/* XYZZY TEST VIRTUAL BASECLASSES */
if (CLASSTYPE_N_BASECLASSES (basetype) == NULL_TREE
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
&& via_virtual == 0)
{
warning ("making type `%s' a virtual baseclass",
TYPE_NAME_STRING (basetype));
via_virtual = 1;
}
#endif
/* We are free to modify these bits because they are meaningless
at top level, and BASETYPE is a top-level type. */
if (via_virtual || TYPE_USES_VIRTUAL_BASECLASSES (basetype))
......@@ -10958,22 +10470,6 @@ start_enum (name)
TREE_ADDRESSABLE (b->tags) = 1;
current_local_enum = NULL_TREE;
#if 0 /* This stuff gets cleared in finish_enum anyway. */
if (TYPE_VALUES (enumtype) != NULL_TREE)
/* Completely replace its old definition.
The old enumerators remain defined, however. */
TYPE_VALUES (enumtype) = NULL_TREE;
/* Initially, set up this enum as like `int'
so that we can create the enumerators' declarations and values.
Later on, the precision of the type may be changed and
it may be laid out again. */
TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
TYPE_SIZE (enumtype) = NULL_TREE;
fixup_signed_type (enumtype);
#endif
/* We copy this value because enumerated type constants
are really of the type of the enumerator, not integer_type_node. */
enum_next_value = copy_node (integer_zero_node);
......@@ -11050,9 +10546,6 @@ finish_enum (enumtype, values)
layout_type (enumtype);
}
if (flag_cadillac)
cadillac_finish_enum (enumtype);
{
register tree tem;
......@@ -11072,12 +10565,7 @@ finish_enum (enumtype, values)
}
/* Finish debugging output for this type. */
#if 0
/* @@ Do we ever generate generate ENUMERAL_TYPE nodes for which debugging
information should *not* be generated? I think not. */
if (! DECL_IGNORED_P (TYPE_NAME (enumtype)))
#endif
rest_of_type_compilation (enumtype, global_bindings_p ());
rest_of_type_compilation (enumtype, global_bindings_p ());
return enumtype;
}
......@@ -11259,8 +10747,6 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
current_function_just_assigned_this = 0;
current_function_parms_stored = 0;
original_result_rtx = NULL_RTX;
current_function_obstack_index = 0;
current_function_obstack_usage = 0;
base_init_expr = NULL_TREE;
protect_list = NULL_TREE;
current_base_init_list = NULL_TREE;
......@@ -11390,10 +10876,7 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
current_function_decl = decl1;
if (flag_cadillac)
cadillac_start_function (decl1);
else
announce_function (decl1);
announce_function (decl1);
if (TYPE_SIZE (TREE_TYPE (fntype)) == NULL_TREE)
{
......@@ -11683,12 +11166,7 @@ store_parm_decls ()
tree cleanup = maybe_build_cleanup (parm);
if (DECL_NAME (parm) == NULL_TREE)
{
#if 0
cp_error_at ("parameter name omitted", parm);
#else
/* for C++, this is not an error. */
pushdecl (parm);
#endif
}
else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node)
cp_error ("parameter `%D' declared void", parm);
......@@ -11763,13 +11241,6 @@ store_parm_decls ()
current_function_parms_stored = 1;
if (flag_gc)
{
maybe_gc_cleanup = build_tree_list (NULL_TREE, error_mark_node);
if (! cp_expand_decl_cleanup (NULL_TREE, maybe_gc_cleanup))
cp_error ("parser lost in parsing declaration of `%D'", fndecl);
}
/* If this function is `main', emit a call to `__main'
to run global initializers, etc. */
if (DECL_NAME (fndecl)
......@@ -11778,15 +11249,6 @@ store_parm_decls ()
&& DECL_CONTEXT (fndecl) == NULL_TREE)
{
expand_main_function ();
if (flag_gc)
expand_expr (build_function_call (lookup_name (get_identifier ("__gc_main"), 0), NULL_TREE),
0, VOIDmode, 0);
#if 0
/* done at a different time */
if (flag_rtti)
output_builtin_tdesc_entries ();
#endif
}
/* Take care of exception handling things. */
......@@ -12085,7 +11547,7 @@ finish_function (lineno, call_poplevel, nested)
expand_direct_vtbls_init (binfo, binfo, 1, 0, current_class_decl);
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
expand_indirect_vtbls_init (binfo, C_C_D, current_class_decl, 0);
expand_indirect_vtbls_init (binfo, C_C_D, current_class_decl);
}
if (! ok_to_optimize_dtor)
......@@ -12168,12 +11630,6 @@ finish_function (lineno, call_poplevel, nested)
expand_end_cond ();
}
#if 0
if (DECL_NAME (fndecl) == NULL_TREE
&& TREE_CHAIN (DECL_ARGUMENTS (fndecl)) != NULL_TREE)
build_default_constructor (fndecl);
#endif
/* Emit insns from `emit_base_init' which sets up virtual
function table pointer(s). */
if (base_init_expr)
......@@ -12233,9 +11689,6 @@ finish_function (lineno, call_poplevel, nested)
&& ! DECL_NAME (DECL_RESULT (current_function_decl)))
no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
if (flag_gc)
expand_gc_prologue_and_epilogue ();
/* If this function is supposed to return a value, ensure that
we do not fall into the cleanups by mistake. The end of our
function will look like this:
......@@ -12378,9 +11831,6 @@ finish_function (lineno, call_poplevel, nested)
if (! nested)
permanent_allocation (1);
if (flag_cadillac)
cadillac_finish_function (fndecl);
if (DECL_SAVED_INSNS (fndecl) == NULL_RTX)
{
/* Stop pointing to the local nodes about to be freed. */
......@@ -12781,9 +12231,6 @@ finish_stmt ()
check_base_init (current_class_type);
}
current_function_assigns_this = 1;
if (flag_cadillac)
cadillac_finish_stmt ();
}
/* Change a static member function definition into a FUNCTION_TYPE, instead
......@@ -12915,17 +12362,6 @@ pop_cp_function_context (context)
SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)),
TREE_VALUE (link));
#if 0
if (DECL_SAVED_INSNS (current_function_decl) == 0)
{
/* Stop pointing to the local nodes about to be freed. */
/* But DECL_INITIAL must remain nonzero so we know this
was an actual function definition. */
DECL_INITIAL (current_function_decl) = error_mark_node;
DECL_ARGUMENTS (current_function_decl) = 0;
}
#endif
pop_function_context_from (context);
cp_function_chain = p->next;
......
......@@ -306,14 +306,6 @@ int flag_default_inline = 1;
0 means enums can convert to ints, but not vice-versa. */
int flag_int_enum_equivalence;
/* Controls whether compiler is operating under LUCID's Cadillac
system. 1 means yes, 0 means no. */
int flag_cadillac;
/* Controls whether compiler generates code to build objects
that can be collected when they become garbage. */
int flag_gc;
/* Controls whether compiler generates 'type descriptor' that give
run-time type information. */
int flag_rtti;
......@@ -404,7 +396,6 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"default-inline", &flag_default_inline, 1},
{"dollars-in-identifiers", &dollars_in_ident, 1},
{"enum-int-equiv", &flag_int_enum_equivalence, 1},
{"gc", &flag_gc, 1},
{"rtti", &flag_rtti, 1},
{"xref", &flag_gnu_xref, 1},
{"nonnull-objects", &flag_assume_nonnull_objects, 1},
......@@ -474,30 +465,6 @@ lang_decode_option (p)
flag_save_memoized_contexts = 0;
found = 1;
}
else if (! strncmp (p, "cadillac", 8))
{
flag_cadillac = atoi (p+9);
found = 1;
}
else if (! strncmp (p, "no-cadillac", 11))
{
flag_cadillac = 0;
found = 1;
}
else if (! strcmp (p, "gc"))
{
flag_gc = 1;
/* This must come along for the ride. */
flag_rtti = 1;
found = 1;
}
else if (! strcmp (p, "no-gc"))
{
flag_gc = 0;
/* This must come along for the ride. */
flag_rtti = 0;
found = 1;
}
else if (! strcmp (p, "alt-external-templates"))
{
flag_external_templates = 1;
......@@ -1411,9 +1378,6 @@ grokfield (declarator, declspecs, raises, init, asmspec_tree, attrlist)
return void_type_node;
}
if (flag_cadillac)
cadillac_start_decl (value);
if (asmspec_tree)
asmspec = TREE_STRING_POINTER (asmspec_tree);
......@@ -1955,57 +1919,6 @@ grok_function_init (decl, init)
cp_error ("invalid initializer for virtual method `%D'", decl);
}
/* When we get a declaration of the form
type cname::fname ...
the node for `cname::fname' gets built here in a special way.
Namely, we push into `cname's scope. When this declaration is
processed, we pop back out. */
tree
build_push_scope (cname, name)
tree cname;
tree name;
{
extern int current_class_depth;
tree ctype, rval;
int is_ttp = 0;
if (cname == error_mark_node)
return error_mark_node;
ctype = IDENTIFIER_TYPE_VALUE (cname);
if (TREE_CODE (ctype) == TEMPLATE_TYPE_PARM)
is_ttp = 1;
else if (ctype == NULL_TREE || ! IS_AGGR_TYPE (ctype))
{
cp_error ("`%T' not defined as aggregate type", cname);
return name;
}
else if (IS_SIGNATURE (ctype))
{
error ("cannot push into signature scope, scope resolution operator ignored");
return name;
}
rval = build_parse_node (SCOPE_REF, cname, name);
/* Don't need to push the scope if we're already in it.
We also don't need to push the scope for a ptr-to-member/method. */
if (ctype == current_class_type || TREE_CODE (name) != IDENTIFIER_NODE
|| is_ttp)
return rval;
/* We do need to push the scope in this case, since CTYPE helps
determine subsequent initializers (i.e., Foo::Bar x = foo_enum_1;). */
push_nested_class (ctype, 3);
TREE_COMPLEXITY (rval) = current_class_depth;
return rval;
}
void
cplus_decl_attributes (decl, attributes, prefix_attributes)
tree decl, attributes, prefix_attributes;
......@@ -2189,9 +2102,6 @@ get_temp_regvar (type, init)
expand_decl (decl);
expand_decl_init (decl);
if (type_needs_gc_entry (type))
DECL_GC_OFFSET (decl) = size_int (++current_function_obstack_index);
return decl;
}
......@@ -2287,9 +2197,6 @@ finish_anon_union (anon_union_decl)
/* The following call assumes that there are never any cleanups
for anonymous unions--a reasonable assumption. */
expand_anon_union_decl (anon_union_decl, NULL_TREE, elems);
if (flag_cadillac)
cadillac_finish_anon_union (anon_union_decl);
}
/* Finish and output a table which is generated by the compiler.
......
......@@ -481,12 +481,6 @@ push_eh_entry (stack)
struct ehNode *node = (struct ehNode*)xmalloc (sizeof (struct ehNode));
struct ehEntry *entry = (struct ehEntry*)xmalloc (sizeof (struct ehEntry));
if (stack == NULL) {
free (node);
free (entry);
return NULL_RTX;
}
/* These are saved for the exception table. */
push_rtl_perm ();
entry->start_label = gen_label_rtx ();
......@@ -510,22 +504,20 @@ push_eh_entry (stack)
return entry->start_label;
}
/* Pop an entry from the given STACK. */
static struct ehEntry *
pop_eh_entry (stack)
struct ehStack *stack;
{
struct ehNode *tempnode;
struct ehEntry *tempentry;
tempnode = stack->top;
tempentry = tempnode->entry;
stack->top = stack->top->chain;
free (tempnode);
if (stack && (tempnode = stack->top)) {
tempentry = tempnode->entry;
stack->top = stack->top->chain;
free (tempnode);
return tempentry;
}
return NULL;
return tempentry;
}
static struct ehEntry *
......@@ -742,21 +734,21 @@ init_exception_processing ()
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_pc"));
d = start_decl (d, declspecs, 0, NULL_TREE);
DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_pc = lookup_name (get_identifier ("__eh_pc"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_type"));
d = start_decl (d, declspecs, 0, NULL_TREE);
DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_throw_type = lookup_name (get_identifier ("__eh_type"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_value"));
d = start_decl (d, declspecs, 0, NULL_TREE);
DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_throw_value = lookup_name (get_identifier ("__eh_value"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
......@@ -764,7 +756,7 @@ init_exception_processing ()
d = build_parse_node (CALL_EXPR, d, void_list_node, NULL_TREE);
d = start_decl (d, declspecs, 0, NULL_TREE);
DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_cleanup = lookup_name (get_identifier ("__eh_cleanup"), 0);
}
......
......@@ -358,6 +358,7 @@ extract_init (decl, init)
{
return 0;
#if 0
if (IS_AGGR_TYPE (TREE_TYPE (decl))
|| TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
init = extract_aggr_init (decl, init);
......@@ -369,4 +370,5 @@ extract_init (decl, init)
DECL_INITIAL (decl) = init;
return 1;
#endif
}
......@@ -62,11 +62,8 @@ static void add_friend (), add_friends ();
/* Cache _builtin_new and _builtin_delete exprs. */
static tree BIN, BID, BIVN, BIVD;
/* Cache the identifier nodes for the two magic field of a new cookie. */
/* Cache the identifier nodes for the magic field of a new cookie. */
static tree nc_nelts_field_id;
#if 0
static tree nc_ptr_2comp_field_id;
#endif
static tree minus_one;
......@@ -582,7 +579,7 @@ emit_base_init (t, immediately)
continue;
#if 0 /* Once unsharing happens soon enough. */
my_friendly_assert (BINFO_INHERITANCE_CHAIN (base_binfo) == t_binfo);
my_friendly_assert (BINFO_INHERITANCE_CHAIN (base_binfo) == t_binfo, 999);
#else
BINFO_INHERITANCE_CHAIN (base_binfo) = t_binfo;
#endif
......@@ -632,7 +629,7 @@ emit_base_init (t, immediately)
/* Initialize all the virtual function table fields that
do come from virtual base classes. */
if (TYPE_USES_VIRTUAL_BASECLASSES (t))
expand_indirect_vtbls_init (t_binfo, C_C_D, current_class_decl, 0);
expand_indirect_vtbls_init (t_binfo, C_C_D, current_class_decl);
/* Initialize all the virtual function table fields that
do not come from virtual base classes. */
......@@ -1375,12 +1372,6 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
if (TREE_CODE (init_type) == ERROR_MARK)
return;
#if 0
/* These lines are found troublesome 5/11/89. */
if (TREE_CODE (init_type) == REFERENCE_TYPE)
init_type = TREE_TYPE (init_type);
#endif
/* This happens when we use C++'s functional cast notation.
If the types match, then just use the TARGET_EXPR
directly. Otherwise, we need to create the initializer
......@@ -1399,35 +1390,13 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
expand_expr_stmt (init);
return;
}
else
{
#if 0
/* This causes testcase return2.C to fail. */
init = TREE_OPERAND (init, 1);
init = build (CALL_EXPR, init_type,
TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), 0);
TREE_SIDE_EFFECTS (init) = 1;
if (init_list)
TREE_VALUE (init_list) = init;
#endif
}
}
if (init_type == type && TREE_CODE (init) == CALL_EXPR
#if 0
/* It is valid to directly initialize from a CALL_EXPR
without going through X(X&), apparently. */
&& ! TYPE_GETS_INIT_REF (type)
#endif
)
if (init_type == type && TREE_CODE (init) == CALL_EXPR)
{
/* A CALL_EXPR is a legitimate form of initialization, so
we should not print this warning message. */
#if 0
/* Should have gone away due to 5/11/89 change. */
if (TREE_CODE (TREE_TYPE (init)) == REFERENCE_TYPE)
init = convert_from_reference (init);
#endif
expand_assignment (exp, init, 0, 0);
if (exp == DECL_RESULT (current_function_decl))
{
......@@ -1565,148 +1534,9 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
}
}
/* Handle default copy constructors here, does not matter if there is
a constructor or not. */
if (type == init_type && IS_AGGR_TYPE (type)
&& init && TREE_CODE (init) != TREE_LIST)
expand_default_init (binfo, true_exp, exp, type, init, alias_this, flags);
/* Not sure why this is here... */
else if (TYPE_HAS_CONSTRUCTOR (type))
expand_default_init (binfo, true_exp, exp, type, init, alias_this, flags);
else if (TREE_CODE (type) == ARRAY_TYPE)
{
if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (type)))
expand_vec_init (exp, exp, array_type_nelts (type), init, 0);
else if (TYPE_VIRTUAL_P (TREE_TYPE (type)))
sorry ("arrays of objects with virtual functions but no constructors");
}
else
expand_recursive_init (binfo, true_exp, exp, init,
CLASSTYPE_BASE_INIT_LIST (type), alias_this);
}
/* A pointer which holds the initializer. First call to
expand_aggr_init gets this value pointed to, and sets it to init_null. */
static tree *init_ptr, init_null;
/* Subroutine of expand_recursive_init:
ADDR is the address of the expression being initialized.
INIT_LIST is the cons-list of initializations to be performed.
ALIAS_THIS is its same, lovable self. */
static void
expand_recursive_init_1 (binfo, true_exp, addr, init_list, alias_this)
tree binfo, true_exp, addr;
tree init_list;
int alias_this;
{
while (init_list)
{
if (TREE_PURPOSE (init_list))
{
if (TREE_CODE (TREE_PURPOSE (init_list)) == FIELD_DECL)
{
tree member = TREE_PURPOSE (init_list);
tree subexp = build_indirect_ref (convert_pointer_to (TREE_VALUE (init_list), addr), NULL_PTR);
tree member_base = build (COMPONENT_REF, TREE_TYPE (member), subexp, member);
if (IS_AGGR_TYPE (TREE_TYPE (member)))
expand_aggr_init (member_base, DECL_INITIAL (member), 0, 0);
else if (TREE_CODE (TREE_TYPE (member)) == ARRAY_TYPE
&& TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (member)))
{
member_base = save_expr (default_conversion (member_base));
expand_vec_init (member, member_base,
array_type_nelts (TREE_TYPE (member)),
DECL_INITIAL (member), 0);
}
else
expand_expr_stmt (build_modify_expr (member_base, INIT_EXPR, DECL_INITIAL (member)));
}
else if (TREE_CODE (TREE_PURPOSE (init_list)) == TREE_LIST)
{
expand_recursive_init_1 (binfo, true_exp, addr, TREE_PURPOSE (init_list), alias_this);
expand_recursive_init_1 (binfo, true_exp, addr, TREE_VALUE (init_list), alias_this);
}
else if (TREE_CODE (TREE_PURPOSE (init_list)) == ERROR_MARK)
{
/* Only initialize the virtual function tables if we
are initializing the ultimate users of those vtables. */
if (TREE_VALUE (init_list))
{
/* We have to ensure that the first argment to
expand_virtual_init is in binfo's hierarchy. */
/* Is it the case that this is exactly the right binfo? */
/* If it is ok, then fixup expand_virtual_init, to make
it much simpler. */
expand_virtual_init (get_binfo (TREE_VALUE (init_list), binfo, 0),
addr);
if (TREE_VALUE (init_list) == binfo
&& TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
expand_indirect_vtbls_init (binfo, true_exp, addr, 1);
}
}
else
my_friendly_abort (49);
}
else if (TREE_VALUE (init_list)
&& TREE_CODE (TREE_VALUE (init_list)) == TREE_VEC)
{
tree subexp = build_indirect_ref (convert_pointer_to (TREE_VALUE (init_list), addr), NULL_PTR);
expand_aggr_init_1 (binfo, true_exp, subexp, *init_ptr,
alias_this && BINFO_OFFSET_ZEROP (TREE_VALUE (init_list)),
LOOKUP_COMPLAIN);
/* INIT_PTR is used up. */
init_ptr = &init_null;
}
else
my_friendly_abort (50);
init_list = TREE_CHAIN (init_list);
}
}
/* Initialize EXP with INIT. Type EXP does not have a constructor,
but it has a baseclass with a constructor or a virtual function
table which needs initializing.
INIT_LIST is a cons-list describing what parts of EXP actually
need to be initialized. INIT is given to the *unique*, first
constructor within INIT_LIST. If there are multiple first
constructors, such as with multiple inheritance, INIT must
be zero or an ambiguity error is reported.
ALIAS_THIS is passed from `expand_aggr_init'. See comments
there. */
static void
expand_recursive_init (binfo, true_exp, exp, init, init_list, alias_this)
tree binfo, true_exp, exp, init;
tree init_list;
int alias_this;
{
tree *old_init_ptr = init_ptr;
tree addr = build_unary_op (ADDR_EXPR, exp, 0);
init_ptr = &init;
if (true_exp == exp && TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
{
expand_aggr_vbase_init (binfo, exp, addr, init_list);
expand_indirect_vtbls_init (binfo, true_exp, addr, 1);
}
expand_recursive_init_1 (binfo, true_exp, addr, init_list, alias_this);
if (*init_ptr)
{
tree type = TREE_TYPE (exp);
if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
if (IS_AGGR_TYPE (type))
cp_error ("unexpected argument to constructor `%T'", type);
else
error ("unexpected argument to constructor");
}
init_ptr = old_init_ptr;
/* We know that expand_default_init can handle everything we want
at this point. */
expand_default_init (binfo, true_exp, exp, type, init, alias_this, flags);
}
/* Report an error if NAME is not the name of a user-defined,
......@@ -1846,12 +1676,6 @@ build_member_call (type, name, parmlist)
if (dtor)
{
#if 0
/* Everything can explicitly call a destructor; see 12.4 */
if (! TYPE_HAS_DESTRUCTOR (type))
cp_error ("type `%#T' does not have a destructor", type);
else
#endif
cp_error ("cannot call destructor `%T::~%T' without object", type,
method_name);
return error_mark_node;
......@@ -2092,11 +1916,6 @@ build_offset_ref (type, name)
|| ! allocation_temporary_p ()))
fnfields = copy_list (fnfields);
#if 0
for (t = TREE_VALUE (fnfields); t; t = DECL_CHAIN (t))
assemble_external (t);
#endif
t = build_tree_list (error_mark_node, fnfields);
TREE_TYPE (t) = build_offset_type (type, unknown_type_node);
return t;
......@@ -2148,72 +1967,6 @@ build_offset_ref (type, name)
return build (OFFSET_REF, build_offset_type (type, TREE_TYPE (t)), decl, t);
}
/* Given an object EXP and a member function reference MEMBER,
return the address of the actual member function. */
tree
get_member_function (exp_addr_ptr, exp, member)
tree *exp_addr_ptr;
tree exp, member;
{
tree ctype = TREE_TYPE (exp);
tree function = save_expr (build_unary_op (ADDR_EXPR, member, 0));
if (TYPE_VIRTUAL_P (ctype)
|| (flag_all_virtual == 1 && TYPE_OVERLOADS_METHOD_CALL_EXPR (ctype)))
{
tree e0, e1, e3;
tree exp_addr;
/* Save away the unadulterated `this' pointer. */
exp_addr = save_expr (*exp_addr_ptr);
/* Cast function to signed integer. */
e0 = build1 (NOP_EXPR, integer_type_node, function);
/* There is a hack here that takes advantage of
twos complement arithmetic, and the fact that
there are more than one UNITS to the WORD.
If the high bit is set for the `function',
then we pretend it is a virtual function,
and the array indexing will knock this bit
out the top, leaving a valid index. */
if (UNITS_PER_WORD <= 1)
my_friendly_abort (54);
e1 = build (GT_EXPR, boolean_type_node, e0, integer_zero_node);
e1 = build_compound_expr (tree_cons (NULL_TREE, exp_addr,
build_tree_list (NULL_TREE, e1)));
e1 = save_expr (e1);
if (TREE_SIDE_EFFECTS (*exp_addr_ptr))
{
exp = build_indirect_ref (exp_addr, NULL_PTR);
*exp_addr_ptr = exp_addr;
}
/* This is really hairy: if the function pointer is a pointer
to a non-virtual member function, then we can't go mucking
with the `this' pointer (any more than we already have to
this point). If it is a pointer to a virtual member function,
then we have to adjust the `this' pointer according to
what the virtual function table tells us. */
e3 = build_vfn_ref (exp_addr_ptr, exp, e0);
my_friendly_assert (e3 != error_mark_node, 213);
/* Change this pointer type from `void *' to the
type it is really supposed to be. */
TREE_TYPE (e3) = TREE_TYPE (function);
/* If non-virtual, use what we had originally. Otherwise,
use the value we get from the virtual function table. */
*exp_addr_ptr = build_conditional_expr (e1, exp_addr, *exp_addr_ptr);
function = build_conditional_expr (e1, function, e3);
}
return build_indirect_ref (function, NULL_PTR);
}
/* If a OFFSET_REF made it through to here, then it did
not have its address taken. */
......@@ -2317,13 +2070,7 @@ resolve_offset_ref (exp)
for the dereferenced pointer-to-member construct. */
addr = build_unary_op (ADDR_EXPR, base, 0);
if (TREE_CODE (TREE_TYPE (member)) == METHOD_TYPE)
{
basetype = DECL_CLASS_CONTEXT (member);
addr = convert_pointer_to (basetype, addr);
return build_unary_op (ADDR_EXPR, get_member_function (&addr, build_indirect_ref (addr, NULL_PTR), member), 0);
}
else if (TREE_CODE (TREE_TYPE (member)) == OFFSET_TYPE)
if (TREE_CODE (TREE_TYPE (member)) == OFFSET_TYPE)
{
basetype = TYPE_OFFSET_BASETYPE (TREE_TYPE (member));
addr = convert_pointer_to (basetype, addr);
......@@ -2573,14 +2320,8 @@ xref_friend (type, decl, ctype)
tree type, decl, ctype;
{
tree friend_decl = TYPE_NAME (ctype);
#if 0
tree typedecl = TYPE_NAME (type);
tree t = tree_cons (NULL_TREE, ctype, DECL_UNDEFINED_FRIENDS (typedecl));
DECL_UNDEFINED_FRIENDS (typedecl) = t;
#else
tree t = 0;
#endif
SET_DECL_WAITING_FRIENDS (friend_decl,
tree_cons (type, t,
DECL_WAITING_FRIENDS (friend_decl)));
......@@ -2767,9 +2508,6 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals)
add_friend (current_class_type, decl);
DECL_FRIEND_P (decl) = 1;
#if 0
TREE_OVERLOADED (declarator) = 1;
#endif
}
else
{
......@@ -2820,9 +2558,6 @@ embrace_waiting_friends (type)
waiters = TREE_CHAIN (waiters))
{
tree waiter = TREE_PURPOSE (waiters);
#if 0
tree waiter_prev = TREE_VALUE (waiters);
#endif
tree decl = TREE_TYPE (waiters);
tree name = decl ? (TREE_CODE (decl) == IDENTIFIER_NODE
? decl : DECL_NAME (decl)) : NULL_TREE;
......@@ -2846,13 +2581,6 @@ embrace_waiting_friends (type)
}
else
make_friend_class (type, waiter);
#if 0
if (TREE_CHAIN (waiter_prev))
TREE_CHAIN (waiter_prev) = TREE_CHAIN (TREE_CHAIN (waiter_prev));
else
DECL_UNDEFINED_FRIENDS (TYPE_NAME (waiter)) = NULL_TREE;
#endif
}
}
......@@ -3131,17 +2859,6 @@ build_new (placement, decl, init, use_global_new)
rval = build_builtin_call (build_pointer_type (true_type),
has_array ? BIVN : BIN,
build_tree_list (NULL_TREE, size));
#if 0
/* See comment above as to why this is disabled. */
if (alignment)
{
rval = build (PLUS_EXPR, build_pointer_type (true_type), rval,
alignment);
rval = build (BIT_AND_EXPR, build_pointer_type (true_type),
rval, build1 (BIT_NOT_EXPR, integer_type_node,
alignment));
}
#endif
TREE_CALLS_NEW (rval) = 1;
}
......@@ -3361,24 +3078,6 @@ build_new (placement, decl, init, use_global_new)
rval = build_compound_expr (chainon (pending_sizes,
build_tree_list (NULL_TREE, rval)));
if (flag_gc)
{
extern tree gc_visible;
tree objbits;
tree update_expr;
rval = save_expr (rval);
/* We don't need a `headof' operation to do this because
we know where the object starts. */
objbits = build1 (INDIRECT_REF, unsigned_type_node,
build (MINUS_EXPR, ptr_type_node,
rval, c_sizeof_nowarn (unsigned_type_node)));
update_expr = build_modify_expr (objbits, BIT_IOR_EXPR, gc_visible);
rval = build_compound_expr (tree_cons (NULL_TREE, rval,
tree_cons (NULL_TREE, update_expr,
build_tree_list (NULL_TREE, rval))));
}
return rval;
}
......@@ -3988,11 +3687,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
@@ Does this really need to be done? */
tree ifexp = build_binary_op(NE_EXPR, addr, integer_zero_node,1);
#if 0
if (TREE_CODE (ref) == VAR_DECL
|| TREE_CODE (ref) == COMPONENT_REF)
warning ("losing in build_delete");
#endif
expr = build (COND_EXPR, void_type_node,
ifexp, expr, void_zero_node);
}
......@@ -4228,7 +3923,8 @@ build_vec_delete (base, maxindex, elt_size, auto_delete_vec, auto_delete,
}
else
{
error ("type to vector delete is neither pointer or array type");
if (base != error_mark_node)
error ("type to vector delete is neither pointer or array type");
return error_mark_node;
}
......
......@@ -32,8 +32,6 @@ Boston, MA 02111-1307, USA. */
"-fno-alt-external-templates",
"-fansi-overloading",
"-fno-ansi-overloading",
"-fcadillac",
"-fno-cadillac",
"-fcheck-new",
"-fno-check-new",
"-fconserve-space",
......@@ -50,8 +48,6 @@ Boston, MA 02111-1307, USA. */
"-fno-external-templates",
"-ffor-scope",
"-fno-for-scope",
"-fgc",
"-fno-gc",
"-fgnu-keywords",
"-fno-gnu-keywords",
"-fhandle-exceptions",
......
......@@ -360,9 +360,6 @@ lang_init ()
/* With luck, we discover the real source file's name from that
and put it in input_filename. */
put_back (check_newline ());
if (flag_cadillac)
cadillac_start ();
if (flag_gnu_xref) GNU_xref_begin (input_filename);
init_repo (input_filename);
}
......@@ -793,7 +790,7 @@ init_lex ()
}
#endif
if (! (flag_gc || flag_rtti) || flag_no_gnu_keywords)
if (!flag_rtti || flag_no_gnu_keywords)
{
UNSET_RESERVED_WORD ("classof");
UNSET_RESERVED_WORD ("headof");
......@@ -1129,7 +1126,7 @@ do_pending_inlines ()
/* Reverse the pending inline functions, since
they were cons'd instead of appended. */
{
struct pending_inline *prev = 0, *tail, *bottom = 0;
struct pending_inline *prev = 0, *tail;
t = pending_inlines;
pending_inlines = 0;
......@@ -1140,33 +1137,6 @@ do_pending_inlines ()
t->deja_vu = 1;
prev = t;
}
/* This kludge should go away when synthesized methods are handled
properly, i.e. only when needed. */
for (t = prev; t; t = t->next)
{
if (t->lineno <= 0)
{
tree f = t->fndecl;
DECL_PENDING_INLINE_INFO (f) = 0;
interface_unknown = t->interface == 1;
interface_only = t->interface == 0;
synthesize_method (f);
if (tail)
tail->next = t->next;
else
prev = t->next;
if (! bottom)
bottom = t;
}
else
tail = t;
}
if (bottom)
{
obstack_free (&synth_obstack, bottom);
extract_interface_info ();
}
t = prev;
}
......@@ -2491,9 +2461,6 @@ linenum:
body_time = this_time;
}
if (flag_cadillac)
cadillac_note_source ();
input_filename
= (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
......@@ -2607,8 +2574,6 @@ linenum:
&& write_symbols == DWARF_DEBUG)
dwarfout_start_new_source_file (input_filename);
#endif /* DWARF_DEBUGGING_INFO */
if (flag_cadillac)
cadillac_push_source ();
in_system_header = entering_system_header;
if (c_header_level)
++c_header_level;
......@@ -2631,8 +2596,6 @@ linenum:
warning ("badly nested C headers from preprocessor");
--pending_lang_change;
}
if (flag_cadillac)
cadillac_pop_source ();
in_system_header = entering_system_header;
p = input_file_stack;
......@@ -2653,11 +2616,7 @@ linenum:
error ("#-lines for entering and leaving files don't match");
}
else
{
in_system_header = entering_system_header;
if (flag_cadillac)
cadillac_switch_source (-1);
}
in_system_header = entering_system_header;
}
/* If NEXTCHAR is not end of line, we don't care what it is. */
......
......@@ -929,21 +929,6 @@ build_static_name (basetype, name)
return get_identifier (buf);
}
/* Generate an identifier that encodes the (ANSI) exception TYPE. */
/* This should be part of `ansi_opname', or at least be defined by the std. */
#define EXCEPTION_NAME_PREFIX "__ex"
#define EXCEPTION_NAME_LENGTH 4
tree
cplus_exception_name (type)
tree type;
{
OB_INIT ();
OB_PUTS (EXCEPTION_NAME_PREFIX);
return get_identifier (build_overload_name (type, 0, 1));
}
/* Change the name of a function definition so that it may be
overloaded. NAME is the name of the function to overload,
PARMS is the parameter list (which determines what name the
......
......@@ -510,7 +510,7 @@ template_def:
d = start_decl ($<ttype>2, /*current_declspecs*/NULL_TREE, 0,
$3);
cplus_decl_attributes (d, $5, /*prefix_attributes*/NULL_TREE);
cp_finish_decl (d, NULL_TREE, $4, 0, 0);
cp_finish_decl (d, NULL_TREE, $4, 1, 0);
end_template_decl ($1, d, 0, def);
if (def)
reinit_parse_for_template ((int) $6, $1, d);
......@@ -527,7 +527,7 @@ template_def:
momentary = suspend_momentary ();
d = start_decl ($<ttype>3, specs, 0, $<ttype>4);
cplus_decl_attributes (d, $6, attrs);
cp_finish_decl (d, NULL_TREE, $5, 0, 0);
cp_finish_decl (d, NULL_TREE, $5, 1, 0);
end_template_decl ($1, d, 0, def);
if (def)
{
......@@ -544,7 +544,7 @@ template_def:
split_specs_attrs ($2, &specs, &attrs);
d = start_decl ($<ttype>3, specs, 0, NULL_TREE);
cplus_decl_attributes (d, NULL_TREE, attrs);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
end_template_decl ($1, d, 0, def);
if (def)
reinit_parse_for_template ((int) $4, $1, d);
......@@ -572,7 +572,7 @@ datadef:
split_specs_attrs ($1, &specs, &attrs);
d = start_decl ($<ttype>2, specs, 0, NULL_TREE);
cplus_decl_attributes (d, NULL_TREE, attrs);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
}
| typed_declspecs initdecls ';'
{
......@@ -584,7 +584,7 @@ datadef:
split_specs_attrs ($1, &specs, &attrs);
d = start_decl ($<ttype>2, specs, 0, NULL_TREE);
cplus_decl_attributes (d, NULL_TREE, attrs);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
note_list_got_semicolon ($<ttype>$);
}
| declmods ';'
......@@ -996,7 +996,7 @@ condition:
}
init
{
cp_finish_decl ($<ttype>7, $8, $5, 0, LOOKUP_ONLYCONVERTING);
cp_finish_decl ($<ttype>7, $8, $5, 1, LOOKUP_ONLYCONVERTING);
resume_momentary ($<itype>6);
$$ = $<ttype>7;
if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
......@@ -1729,7 +1729,7 @@ decl:
{ tree d = get_decl_list ($1);
int yes = suspend_momentary ();
d = start_decl ($2, d, 0, NULL_TREE);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
resume_momentary (yes);
if (IS_AGGR_TYPE_CODE (TREE_CODE ($1)))
note_got_semicolon ($1);
......@@ -1741,7 +1741,7 @@ decl:
yes = suspend_momentary ();
d = start_decl ($2, specs, 0, NULL_TREE);
cplus_decl_attributes (d, NULL_TREE, attrs);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
resume_momentary (yes);
note_list_got_semicolon ($1);
}
......@@ -1985,7 +1985,7 @@ initdcl0:
cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
init
/* Note how the declaration of the variable is in effect while its init is parsed! */
{ cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING);
{ cp_finish_decl ($<ttype>6, $7, $3, 1, LOOKUP_ONLYCONVERTING);
$$ = $<itype>5; }
| declarator exception_specification_opt maybeasm maybe_attribute
{ tree d;
......@@ -2003,7 +2003,7 @@ initdcl0:
$$ = suspend_momentary ();
d = start_decl ($<ttype>1, current_declspecs, 0, $2);
cplus_decl_attributes (d, $4, prefix_attributes);
cp_finish_decl (d, NULL_TREE, $3, 0, 0); }
cp_finish_decl (d, NULL_TREE, $3, 1, 0); }
;
initdcl:
......@@ -2012,11 +2012,11 @@ initdcl:
cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
init
/* Note how the declaration of the variable is in effect while its init is parsed! */
{ cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING); }
{ cp_finish_decl ($<ttype>6, $7, $3, 1, LOOKUP_ONLYCONVERTING); }
| declarator exception_specification_opt maybeasm maybe_attribute
{ $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0, $2);
cplus_decl_attributes ($<ttype>$, $4, prefix_attributes);
cp_finish_decl ($<ttype>$, NULL_TREE, $3, 0, 0); }
cp_finish_decl ($<ttype>$, NULL_TREE, $3, 1, 0); }
;
notype_initdcl0:
......@@ -2028,7 +2028,7 @@ notype_initdcl0:
cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
init
/* Note how the declaration of the variable is in effect while its init is parsed! */
{ cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING);
{ cp_finish_decl ($<ttype>6, $7, $3, 1, LOOKUP_ONLYCONVERTING);
$$ = $<itype>5; }
| notype_declarator exception_specification_opt maybeasm maybe_attribute
{ tree d;
......@@ -2037,7 +2037,7 @@ notype_initdcl0:
$$ = suspend_momentary ();
d = start_decl ($<ttype>1, current_declspecs, 0, $2);
cplus_decl_attributes (d, $4, prefix_attributes);
cp_finish_decl (d, NULL_TREE, $3, 0, 0); }
cp_finish_decl (d, NULL_TREE, $3, 1, 0); }
;
nomods_initdcl0:
......@@ -2049,7 +2049,7 @@ nomods_initdcl0:
cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
init
/* Note how the declaration of the variable is in effect while its init is parsed! */
{ cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING);
{ cp_finish_decl ($<ttype>6, $7, $3, 1, LOOKUP_ONLYCONVERTING);
$$ = $<itype>5; }
| notype_declarator exception_specification_opt maybeasm maybe_attribute
{ tree d;
......@@ -2058,7 +2058,7 @@ nomods_initdcl0:
$$ = suspend_momentary ();
d = start_decl ($1, current_declspecs, 0, $2);
cplus_decl_attributes (d, $4, prefix_attributes);
cp_finish_decl (d, NULL_TREE, $3, 0, 0); }
cp_finish_decl (d, NULL_TREE, $3, 1, 0); }
;
/* the * rules are dummies to accept the Apollo extended syntax
......
......@@ -440,34 +440,6 @@ convert_pointer_to_vbase (type, expr)
return convert_pointer_to_real (vb, expr);
}
/* This is the newer recursive depth first search routine. */
#if 0 /* unused */
/* Return non-zero if PARENT is directly derived from TYPE. By directly
we mean it's only one step up the inheritance lattice. We check this
by walking horizontally across the types that TYPE directly inherits
from, to see if PARENT is among them. This is used by get_binfo and
by compute_access. */
static int
immediately_derived (parent, type)
tree parent, type;
{
if (TYPE_BINFO (type))
{
tree binfos = BINFO_BASETYPES (TYPE_BINFO (type));
int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
for (i = 0; i < n_baselinks; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
if (parent == BINFO_TYPE (base_binfo))
return 1;
}
}
return 0;
}
#endif
/* Check whether the type given in BINFO is derived from PARENT. If
it isn't, return 0. If it is, but the derivation is MI-ambiguous
AND protect != 0, emit an error message and return error_mark_node.
......@@ -1320,7 +1292,7 @@ lookup_field (xbasetype, name, protect, want_type)
{
/* This is ambiguous. */
errstr = "request for member `%D' is ambiguous";
protect = 2;
protect += 2;
break;
}
}
......@@ -1426,6 +1398,14 @@ lookup_field (xbasetype, name, protect, want_type)
}
}
if (protect == 2)
{
/* If we are not interested in ambiguities, don't report them,
just return NULL_TREE. */
rval = NULL_TREE;
protect = 0;
}
if (errstr && protect)
{
cp_error (errstr, name, type);
......@@ -1911,16 +1891,6 @@ breadth_first_search (binfo, testfn, qfn)
typedef tree (*pft)();
typedef int (*pfi)();
int tree_needs_constructor_p (binfo, i)
tree binfo;
int i;
{
tree basetype;
my_friendly_assert (i != 0, 296);
basetype = BINFO_TYPE (BINFO_BASETYPE (binfo, i));
return TYPE_NEEDS_CONSTRUCTING (basetype);
}
static tree declarator;
static tree
......@@ -2098,8 +2068,6 @@ get_matching_virtual (binfo, fndecl, dtorp)
break;
}
}
if (best == NULL_TREE && warn_overloaded_virtual)
cp_warning_at ("conflicting specification deriving virtual function `%D'", fndecl);
return best;
}
......@@ -2836,65 +2804,28 @@ fixup_virtual_upcast_offsets (real_binfo, binfo, init_self, can_elide, addr, ori
ICK! */
void
expand_indirect_vtbls_init (binfo, true_exp, decl_ptr, use_computed_offsets)
expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
tree binfo;
tree true_exp, decl_ptr;
int use_computed_offsets;
{
tree type = BINFO_TYPE (binfo);
if (TYPE_USES_VIRTUAL_BASECLASSES (type))
{
rtx fixup_insns = NULL_RTX;
int old_flag = flag_this_is_variable;
tree vbases = CLASSTYPE_VBASECLASSES (type);
vbase_types = vbases;
vbase_decl_ptr = true_exp ? build_unary_op (ADDR_EXPR, true_exp, 0) : decl_ptr;
vbase_decl = true_exp ? true_exp : build_indirect_ref (decl_ptr, NULL_PTR);
if (use_computed_offsets)
{
/* This is an object of type IN_TYPE, */
flag_this_is_variable = -2;
}
dfs_walk (binfo, dfs_find_vbases, unmarked_new_vtablep);
/* Initialized with vtables of type TYPE. */
for (; vbases; vbases = TREE_CHAIN (vbases))
{
tree addr;
if (use_computed_offsets)
addr = (tree)CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (vbases));
else
{
#if 1
addr = convert_pointer_to_vbase (TREE_TYPE (vbases), vbase_decl_ptr);
#else
/* This should should never work better than the above. (mrs) */
tree vbinfo = get_binfo (TREE_TYPE (vbases),
TREE_TYPE (vbase_decl),
0);
/* See is we can get lucky. */
if (TREE_VIA_VIRTUAL (vbinfo))
addr = convert_pointer_to_real (vbinfo, vbase_decl_ptr);
else
{
/* We go through all these contortions to avoid this
call, as it will fail when the virtual base type
is ambiguous from here. We don't yet have a way
to search for and find just an instance of the
virtual base class. Searching for the binfo in
vbases won't work, as we don't have the vbase
pointer field, for all vbases in the main class,
only direct vbases. */
addr = convert_pointer_to_real (TREE_TYPE (vbases),
vbase_decl_ptr);
if (addr == error_mark_node)
continue;
}
#endif
}
addr = convert_pointer_to_vbase (TREE_TYPE (vbases), vbase_decl_ptr);
/* Do all vtables from this virtual base. */
/* This assumes that virtual bases can never serve as parent
......@@ -2902,10 +2833,6 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr, use_computed_offsets)
expand_direct_vtbls_init (vbases, TYPE_BINFO (BINFO_TYPE (vbases)),
1, 0, addr);
/* If we are using computed offsets we can skip fixups. */
if (use_computed_offsets)
continue;
/* Now we adjust the offsets for virtual functions that cross
virtual boundaries on an implicit upcast on vf call so that
the layout of the most complete type is used, instead of
......@@ -2944,19 +2871,9 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr, use_computed_offsets)
}
dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep);
flag_this_is_variable = old_flag;
}
}
void
clear_search_slots (type)
tree type;
{
dfs_walk (TYPE_BINFO (type),
dfs_clear_search_slot, dfs_search_slot_nonempty_p);
}
/* get virtual base class types.
This adds type to the vbase_types list in reverse dfs order.
Ordering is very important, so don't change it. */
......@@ -3359,15 +3276,6 @@ push_class_decls (type)
search_stack = push_search_level (search_stack, &search_obstack);
id = TYPE_IDENTIFIER (type);
#if 0
if (IDENTIFIER_TEMPLATE (id) != 0)
{
tree tmpl = IDENTIFIER_TEMPLATE (id);
push_template_decls (DECL_ARGUMENTS (TREE_PURPOSE (tmpl)),
TREE_VALUE (tmpl), 1);
overload_template_name (id, 1);
}
#endif
/* Push class fields into CLASS_VALUE scope, and mark. */
dfs_walk (TYPE_BINFO (type), dfs_pushdecls, unmarkedp);
......
......@@ -182,36 +182,6 @@ scan_tokens (n)
}
}
/* Create room for N tokens at the front of the fifo. This is used
to insert new tokens into the stream ahead of the current token. */
static void
shift_tokens (n)
int n;
{
if (first_token >= n)
first_token -= n;
else
{
int old_token_count = num_tokens ();
char *tmp;
obstack_blank (&token_obstack, (n-first_token) * sizeof (struct token));
if (old_token_count)
{
tmp = (char *)alloca ((num_tokens () + (n-first_token))
* sizeof (struct token));
/* This move does not rely on the system being able to handle
overlapping moves. */
bcopy ((char *) nth_token (0), tmp,
old_token_count * sizeof (struct token));
bcopy (tmp, (char *) nth_token (n),
old_token_count * sizeof (struct token));
}
first_token = 0;
}
}
static int
probe_obstack (h, obj, nlevels)
struct obstack *h;
......@@ -360,10 +330,12 @@ yylex()
break;
case SCSPEC:
/* do_aggr needs to check if the previous token was RID_FRIEND,
so just increment first_token instead of calling consume_token. */
first_token++;
case NEW:
/* do_aggr needs to check if the previous token was RID_NEW,
so just increment first_token instead of calling consume_token. */
++first_token;
break;
case TYPESPEC:
consume_token ();
break;
......@@ -394,7 +366,7 @@ yylex()
* Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
* If token[2] == '{' or ':' then it's TYPENAME_DEFN.
* It's also a definition if it's a forward declaration (as in 'struct Foo;')
* which we can tell lf token[2] == ';' *and* token[-1] != FRIEND.
* which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW.
*/
static int
do_aggr ()
......@@ -408,10 +380,16 @@ do_aggr ()
yc2 = nth_token (2)->yychar;
if (yc2 == ';')
{
/* It's a forward declaration iff we were not preceded by 'friend'. */
if (first_token > 0 && nth_token (-1)->yychar == SCSPEC
&& nth_token (-1)->yylval.ttype == ridpointers[(int) RID_FRIEND])
return 0;
/* It's a forward declaration iff we were not preceded by
'friend' or `new'. */
if (first_token > 0)
{
if (nth_token (-1)->yychar == SCSPEC
&& nth_token (-1)->yylval.ttype == ridpointers[(int) RID_FRIEND])
return 0;
if (nth_token (-1)->yychar == NEW)
return 0;
}
}
else if (yc2 != '{' && yc2 != ':')
return 0;
......
......@@ -419,32 +419,6 @@ build_cplus_method_type (basetype, rettype, argtypes)
}
tree
build_cplus_staticfn_type (basetype, rettype, argtypes)
tree basetype, rettype, argtypes;
{
register tree t;
int hashcode;
/* Make a node of the sort we want. */
t = make_node (FUNCTION_TYPE);
TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
TREE_TYPE (t) = rettype;
TYPE_ARG_TYPES (t) = argtypes;
/* If we already have such a type, use the old one and free this one.
Note that it also frees up the above cons cell if found. */
hashcode = TYPE_HASH (basetype) + TYPE_HASH (rettype) + type_hash_list (argtypes);
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
layout_type (t);
return t;
}
tree
build_cplus_array_type (elt_type, index_type)
tree elt_type;
tree index_type;
......@@ -1149,59 +1123,6 @@ get_decl_list (value)
return build_decl_list (NULL_TREE, value);
}
/* Look in the type hash table for a type isomorphic to
`build_tree_list (NULL_TREE, VALUE)'.
If one is found, return it. Otherwise return 0. */
tree
list_hash_lookup_or_cons (value)
tree value;
{
register int hashcode = TYPE_HASH (value);
register struct list_hash *h;
struct obstack *ambient_obstack;
tree list = NULL_TREE;
if (TREE_CODE (value) == IDENTIFIER_NODE)
list = get_identifier_list (value);
else if (TREE_CODE (value) == TYPE_DECL
&& TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE
&& TYPE_LANG_SPECIFIC (TREE_TYPE (value)))
list = CLASSTYPE_ID_AS_LIST (TREE_TYPE (value));
else if (TREE_CODE (value) == RECORD_TYPE
&& TYPE_LANG_SPECIFIC (value))
list = CLASSTYPE_AS_LIST (value);
if (list != NULL_TREE)
{
my_friendly_assert (TREE_CHAIN (list) == NULL_TREE, 302);
return list;
}
if (debug_no_list_hash)
return hash_tree_chain (value, NULL_TREE);
for (h = list_hash_table[hashcode % TYPE_HASH_SIZE]; h; h = h->next)
if (h->hashcode == hashcode
&& TREE_VIA_VIRTUAL (h->list) == 0
&& TREE_VIA_PUBLIC (h->list) == 0
&& TREE_VIA_PROTECTED (h->list) == 0
&& TREE_PURPOSE (h->list) == 0
&& TREE_VALUE (h->list) == value)
{
my_friendly_assert (TREE_TYPE (h->list) == 0, 303);
my_friendly_assert (TREE_CHAIN (h->list) == 0, 304);
return h->list;
}
ambient_obstack = current_obstack;
current_obstack = &class_obstack;
list = build_tree_list (NULL_TREE, value);
list_hash_add (hashcode, list);
current_obstack = ambient_obstack;
return list;
}
/* Build an association between TYPE and some parameters:
......@@ -1283,38 +1204,6 @@ reverse_path (path)
return prev;
}
tree
virtual_member (elem, list)
tree elem;
tree list;
{
tree t;
tree rval, nval;
for (t = list; t; t = TREE_CHAIN (t))
if (elem == BINFO_TYPE (t))
return t;
rval = 0;
for (t = list; t; t = TREE_CHAIN (t))
{
tree binfos = BINFO_BASETYPES (t);
int i;
if (binfos != NULL_TREE)
for (i = TREE_VEC_LENGTH (binfos)-1; i >= 0; i--)
{
nval = binfo_value (elem, BINFO_TYPE (TREE_VEC_ELT (binfos, i)));
if (nval)
{
if (rval && BINFO_OFFSET (nval) != BINFO_OFFSET (rval))
my_friendly_abort (104);
rval = nval;
}
}
}
return rval;
}
void
debug_binfo (elem)
tree elem;
......@@ -1379,20 +1268,6 @@ count_functions (t)
return 0;
}
/* Like value_member, but for DECL_CHAINs. */
tree
decl_value_member (elem, list)
tree elem, list;
{
while (list)
{
if (elem == list)
return list;
list = DECL_CHAIN (list);
}
return NULL_TREE;
}
int
is_overloaded_fn (x)
tree x;
......@@ -1450,16 +1325,6 @@ fnaddr_from_vtable_entry (entry)
return TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (entry))));
}
void
set_fnaddr_from_vtable_entry (entry, value)
tree entry, value;
{
if (flag_vtable_thunks)
abort ();
else
TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (entry)))) = value;
}
tree
function_arg_chain (t)
tree t;
......@@ -1555,16 +1420,6 @@ lang_printable_name (decl)
return print_ring[ring_counter];
}
/* Comparison function for sorting identifiers in RAISES lists.
Note that because IDENTIFIER_NODEs are unique, we can sort
them by address, saving an indirection. */
static int
id_cmp (p1, p2)
tree *p1, *p2;
{
return (HOST_WIDE_INT)TREE_VALUE (*p1) - (HOST_WIDE_INT)TREE_VALUE (*p2);
}
/* Build the FUNCTION_TYPE or METHOD_TYPE which may throw exceptions
listed in RAISES. */
tree
......
......@@ -397,15 +397,6 @@ common_type (t1, t2)
return t1;
}
#if 0
case POINTER_TYPE:
t1 = build_pointer_type (common_type (TREE_TYPE (t1), TREE_TYPE (t2)));
return build_type_attribute_variant (t1, attributes);
case REFERENCE_TYPE:
t1 = build_reference_type (common_type (TREE_TYPE (t1), TREE_TYPE (t2)));
return build_type_attribute_variant (t1, attributes);
#endif
case ARRAY_TYPE:
{
......@@ -905,15 +896,6 @@ common_base_type (tt1, tt2)
if (UNIQUELY_DERIVED_FROM_P (tt2, tt1))
return tt2;
#if 0
/* If they share a virtual baseclass, that's good enough. */
for (tmp = CLASSTYPE_VBASECLASSES (tt1); tmp; tmp = TREE_CHAIN (tmp))
{
if (binfo_member (BINFO_TYPE (tmp), CLASSTYPE_VBASECLASSES (tt2)))
return BINFO_TYPE (tmp);
}
#endif
/* Otherwise, try to find a unique baseclass of TT1
that is shared by TT2, and follow that down. */
for (i = CLASSTYPE_N_BASECLASSES (tt1)-1; i >= 0; i--)
......@@ -998,17 +980,6 @@ compparms (parms1, parms2, strict)
return t2 == void_list_node && TREE_PURPOSE (t1);
return TREE_PURPOSE (t1) || TREE_PURPOSE (t2);
}
#if 0
/* Default parms are not part of the type of a function. */
if (strict != 3 && TREE_PURPOSE (t1) && TREE_PURPOSE (t2))
{
int cmp = simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2));
if (cmp < 0)
my_friendly_abort (113);
if (cmp == 0)
return 0;
}
#endif
t1 = TREE_CHAIN (t1);
t2 = TREE_CHAIN (t2);
......@@ -1096,12 +1067,6 @@ comp_target_parms (parms1, parms2, strict)
}
if (strict != 0)
return 0;
#if 0
/* What good do these cases do? */
if (strict == 0)
return p2 == void_type_node && TREE_PURPOSE (t1);
return TREE_PURPOSE (t1) || TREE_PURPOSE (t2);
#endif
}
/* Target types are compatible--just make sure that if
we use parameter lists, that they are ok as well. */
......@@ -1305,14 +1270,7 @@ c_sizeof_nowarn (type)
type = TREE_TYPE (type);
if (TYPE_SIZE (type) == 0)
{
#if 0
/* ??? Tiemann, why have any diagnostic here?
There is none in the corresponding function for C. */
warning ("sizeof applied to an incomplete type");
#endif
return size_int (0);
}
return size_int (0);
/* Convert in case a char is more than one unit. */
t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
......@@ -1410,6 +1368,8 @@ decay_conversion (exp)
{
if (TREE_CODE (exp) == OFFSET_REF)
{
/* FIXME: We should emit an error here about using a ptrmemfunc
for something other than a function call. */
my_friendly_assert (TREE_CODE (TREE_OPERAND (exp, 1)) == FUNCTION_DECL,
308);
return build_unary_op (ADDR_EXPR, TREE_OPERAND (exp, 1), 0);
......@@ -1632,6 +1592,45 @@ rationalize_conditional_expr (code, t)
build_unary_op (code, TREE_OPERAND (t, 2), 0));
}
/* Given the TYPE of an anonymous union field inside T, return the
FIELD_DECL for the field. If not found return NULL_TREE. Because
anonymous unions can nest, we must also search all anonymous unions
that are directly reachable. */
static tree
lookup_anon_field (t, type)
tree t, type;
{
tree field;
for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
{
if (TREE_STATIC (field))
continue;
if (TREE_CODE (field) != FIELD_DECL)
continue;
/* If we find it directly, return the field. */
if (DECL_NAME (field) == NULL_TREE
&& type == TREE_TYPE (field))
{
return field;
}
/* Otherwise, it could be nested, search harder. */
if (DECL_NAME (field) == NULL_TREE
&& TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{
tree subfield = lookup_anon_field (TREE_TYPE (field), type);
if (subfield)
return subfield;
}
}
return NULL_TREE;
}
/* Build a COMPONENT_REF for a given DATUM, and it's member COMPONENT.
COMPONENT can be an IDENTIFIER_NODE that is the name of the member
that we are interested in, or it can be a FIELD_DECL. */
tree
build_component_ref (datum, component, basetype_path, protect)
tree datum, component, basetype_path;
......@@ -1663,14 +1662,7 @@ build_component_ref (datum, component, basetype_path, protect)
if (code == REFERENCE_TYPE)
{
#if 0
/* TREE_REFERENCE_EXPRs are not converted by `convert_from_reference'.
@@ Maybe that is not right. */
if (TREE_REFERENCE_EXPR (datum))
datum = build1 (INDIRECT_REF, TREE_TYPE (basetype), datum);
else
#endif
datum = convert_from_reference (datum);
datum = convert_from_reference (datum);
basetype = TREE_TYPE (datum);
code = TREE_CODE (basetype);
}
......@@ -1682,10 +1674,6 @@ build_component_ref (datum, component, basetype_path, protect)
&& DECL_CHAIN (TREE_VALUE (component)) == NULL_TREE), 309);
return build (COMPONENT_REF, TREE_TYPE (component), datum, component);
}
#if 0
if (TREE_CODE (component) == TYPE_EXPR)
return build_component_type_expr (datum, component, NULL_TREE, protect);
#endif
if (! IS_AGGR_TYPE_CODE (code))
{
......@@ -1724,6 +1712,10 @@ build_component_ref (datum, component, basetype_path, protect)
hierarchy, the compiler will abort (because vptr lookups are
not supposed to be ambiguous. */
field = CLASSTYPE_VFIELD (basetype);
else if (TREE_CODE (component) == FIELD_DECL)
{
field = component;
}
else
{
if (basetype_path == NULL_TREE)
......@@ -1778,11 +1770,6 @@ build_component_ref (datum, component, basetype_path, protect)
not matter unless we're actually calling the function. */
tree t;
#if 0
for (t = TREE_VALUE (fndecls); t; t = DECL_CHAIN (t))
assemble_external (t);
#endif
t = build_tree_list (error_mark_node, fndecls);
TREE_TYPE (t) = build_offset_type (basetype,
unknown_type_node);
......@@ -1790,12 +1777,7 @@ build_component_ref (datum, component, basetype_path, protect)
}
}
#if 0
if (component == ansi_opname[(int) TYPE_EXPR])
cp_error ("`%#T' has no such type conversion operator", basetype);
else
#endif
cp_error ("`%#T' has no member named `%D'", basetype, component);
cp_error ("`%#T' has no member named `%D'", basetype, component);
return error_mark_node;
}
else if (TREE_TYPE (field) == error_mark_node)
......@@ -1816,6 +1798,18 @@ build_component_ref (datum, component, basetype_path, protect)
}
}
if (DECL_FIELD_CONTEXT (field) != basetype)
{
tree context = DECL_FIELD_CONTEXT (field);
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (context)))
{
tree subfield = lookup_anon_field (basetype, context);
tree subdatum = build_component_ref (datum, subfield,
basetype_path, protect);
return build_component_ref (subdatum, field, basetype_path, protect);
}
}
if (DECL_FIELD_CONTEXT (field) != basetype
&& TYPE_USES_COMPLEX_INHERITANCE (basetype))
{
......@@ -2140,15 +2134,8 @@ build_x_function_call (function, params, decl)
}
else if (TREE_CODE (function) == TREE_LIST)
{
#if 0
if (TREE_CODE (TREE_VALUE (function)) == TREE_LIST)
function = TREE_PURPOSE (TREE_VALUE (function));
else
function = TREE_PURPOSE (function);
#else
my_friendly_assert (TREE_CODE (TREE_VALUE (function)) == FUNCTION_DECL, 312);
function = TREE_PURPOSE (function);
#endif
}
else if (TREE_CODE (function) != IDENTIFIER_NODE)
{
......@@ -2543,14 +2530,6 @@ build_function_call (function, params)
{
return build_function_call_real (function, params, 1, LOOKUP_NORMAL);
}
tree
build_function_call_maybe (function, params)
tree function, params;
{
return build_function_call_real (function, params, 0, 0);
}
/* Convert the actual parameter expressions in the list VALUES
to the types in the list TYPELIST.
......@@ -2580,7 +2559,6 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
tree return_loc, typelist, values, fndecl;
int flags;
{
extern tree gc_protect_fndecl;
register tree typetail, valtail;
register tree result = NULL_TREE;
char *called_thing;
......@@ -2664,22 +2642,6 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
else if (TREE_CODE (val) == OFFSET_REF)
val = resolve_offset_ref (val);
{
#if 0
/* This code forces the assumption that if we have a ptr-to-func
type in an arglist, that every routine that wants to check
its validity has done so, and thus we need not do any
more conversion. I don't remember why this is necessary. */
else if (TREE_CODE (ttype) == FUNCTION_TYPE
&& (type == NULL
|| TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (type)) == VOID_TYPE))
{
type = build_pointer_type (ttype);
}
#endif
}
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs, since VAL is used in non-lvalue context. */
if (TREE_CODE (val) == NOP_EXPR
......@@ -2712,16 +2674,6 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
}
else
{
#if 0 && defined (PROMOTE_PROTOTYPES)
/* This breaks user-defined conversions. */
/* Rather than truncating and then reextending,
convert directly to int, if that's the type we will want. */
if (! flag_traditional
&& (TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == ENUMERAL_TYPE)
&& (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
type = integer_type_node;
#endif
parmval = convert_for_initialization (return_loc, type, val,
flags|INDIRECT_BIND,
"argument passing", fndecl, i);
......@@ -2760,17 +2712,6 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
result = tree_cons (NULL_TREE, default_conversion (val), result);
}
if (flag_gc
/* There are certain functions for which we don't need
to protect our arguments. GC_PROTECT_FNDECL is one. */
&& fndecl != gc_protect_fndecl
&& type_needs_gc_entry (TREE_TYPE (TREE_VALUE (result)))
&& ! value_safe_from_gc (NULL_TREE, TREE_VALUE (result)))
/* This will build a temporary variable whose cleanup is
to clear the obstack entry. */
TREE_VALUE (result) = protect_value_from_gc (NULL_TREE,
TREE_VALUE (result));
if (typetail)
typetail = TREE_CHAIN (typetail);
}
......@@ -2813,11 +2754,6 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
if (parmval == error_mark_node)
return error_mark_node;
if (flag_gc
&& type_needs_gc_entry (TREE_TYPE (parmval))
&& ! value_safe_from_gc (NULL_TREE, parmval))
parmval = protect_value_from_gc (NULL_TREE, parmval);
result = tree_cons (0, parmval, result);
typetail = TREE_CHAIN (typetail);
/* ends with `...'. */
......@@ -3764,11 +3700,11 @@ pointer_int_sum (resultcode, ptrop, intop)
intop = TREE_OPERAND (intop, 0);
}
/* Convert the integer argument to a type the same size as a pointer
/* Convert the integer argument to a type the same size as sizetype
so the multiply won't overflow spuriously. */
if (TYPE_PRECISION (TREE_TYPE (intop)) != POINTER_SIZE)
intop = convert (type_for_size (POINTER_SIZE, 0), intop);
if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype))
intop = convert (type_for_size (TYPE_PRECISION (sizetype), 0), intop);
/* Replace the integer argument with a suitable product by the object size.
Do this multiplication as signed, then convert to the appropriate
......@@ -3861,9 +3797,6 @@ build_component_addr (arg, argtype, msg)
return error_mark_node;
}
if (flag_gc)
cp_warning ("address of `%T::%D' taken", basetype, field);
if (TREE_CODE (field) == FIELD_DECL
&& TYPE_USES_COMPLEX_INHERITANCE (basetype))
{
......@@ -4645,17 +4578,12 @@ build_conditional_expr (ifexp, op1, op2)
code2 = TREE_CODE (type2);
}
#if 1 /* Produces wrong result if within sizeof. Sorry. */
/* Don't promote the operands separately if they promote
the same way. Return the unpromoted type and let the combined
value get promoted if necessary. */
if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)
&& code2 != ARRAY_TYPE
#if 0
/* For C++, let the enumeral type come through. */
&& code2 != ENUMERAL_TYPE
#endif
&& code2 != FUNCTION_TYPE
&& code2 != METHOD_TYPE)
{
......@@ -4686,7 +4614,6 @@ build_conditional_expr (ifexp, op1, op2)
result = build1 (NOP_EXPR, type1, result);
return result;
}
#endif
/* They don't match; promote them both and then try to reconcile them.
But don't permit mismatching enum types. */
......@@ -4815,13 +4742,8 @@ build_conditional_expr (ifexp, op1, op2)
if (!integer_zerop (op2))
pedwarn ("pointer/integer type mismatch in conditional expression");
else
{
op2 = null_pointer_node;
#if 0 /* Sez who? */
if (pedantic && TREE_CODE (type1) == FUNCTION_TYPE)
pedwarn ("ANSI C++ forbids conditional expr between 0 and function pointer");
#endif
}
op2 = null_pointer_node;
result_type = type1;
}
else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
......@@ -4829,13 +4751,8 @@ build_conditional_expr (ifexp, op1, op2)
if (!integer_zerop (op1))
pedwarn ("pointer/integer type mismatch in conditional expression");
else
{
op1 = null_pointer_node;
#if 0 /* Sez who? */
if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE)
pedwarn ("ANSI C++ forbids conditional expr between 0 and function pointer");
#endif
}
op1 = null_pointer_node;
result_type = type2;
}
......@@ -4892,43 +4809,6 @@ build_conditional_expr (ifexp, op1, op2)
if (result_type != TREE_TYPE (op2))
op2 = convert_and_check (result_type, op2);
#if 0
/* XXX delete me, I've been here for years. */
if (IS_AGGR_TYPE_CODE (code1))
{
result_type = TREE_TYPE (op1);
if (TREE_CONSTANT (ifexp))
return (integer_zerop (ifexp) ? op2 : op1);
if (TYPE_MODE (result_type) == BLKmode)
{
register tree tempvar
= build_decl (VAR_DECL, NULL_TREE, result_type);
register tree xop1 = build_modify_expr (tempvar, NOP_EXPR, op1);
register tree xop2 = build_modify_expr (tempvar, NOP_EXPR, op2);
register tree result = fold (build (COND_EXPR, result_type,
ifexp, xop1, xop2));
layout_decl (tempvar, 0);
/* No way to handle variable-sized objects here.
I fear that the entire handling of BLKmode conditional exprs
needs to be redone. */
my_friendly_assert (TREE_CONSTANT (DECL_SIZE (tempvar)), 315);
DECL_RTL (tempvar)
= assign_stack_local (DECL_MODE (tempvar),
(TREE_INT_CST_LOW (DECL_SIZE (tempvar))
+ BITS_PER_UNIT - 1)
/ BITS_PER_UNIT,
0);
TREE_SIDE_EFFECTS (result)
= TREE_SIDE_EFFECTS (ifexp) | TREE_SIDE_EFFECTS (op1)
| TREE_SIDE_EFFECTS (op2);
return build (COMPOUND_EXPR, result_type, result, tempvar);
}
}
#endif /* 0 */
if (TREE_CONSTANT (ifexp))
return integer_zerop (ifexp) ? op2 : op1;
......@@ -5009,16 +4889,6 @@ build_compound_expr (list)
break_out_cleanups (TREE_VALUE (list)), rest);
}
#ifdef __GNUC__
__inline
#endif
int
null_ptr_cst_p (t)
tree t;
{
return (TREE_CODE (t) == INTEGER_CST && integer_zerop (t));
}
tree build_static_cast (type, expr)
tree type, expr;
{
......@@ -5248,6 +5118,8 @@ build_c_cast (type, expr, allow_nonconverting)
warning ("cast increases required alignment of target type");
#if 0
/* We should see about re-enabling these, they seem useful to
me. */
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (otype) == POINTER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype))
......@@ -5302,282 +5174,6 @@ build_c_cast (type, expr, allow_nonconverting)
return value;
}
#if 0
/* Build an assignment expression of lvalue LHS from value RHS.
In C++, if the left hand side of the assignment is a REFERENCE_TYPE,
that reference becomes deferenced down to it base type. */
/* Return a reference to the BASE_INDEX part of EXPR. TYPE is
the type to which BASE_INDEX applies. */
static tree
get_base_ref (type, base_index, expr)
tree type;
int base_index;
tree expr;
{
tree binfos = TYPE_BINFO_BASETYPES (type);
tree base_binfo = TREE_VEC_ELT (binfos, base_index);
tree ref;
if (TREE_CODE (expr) == ARRAY_REF
|| ! BINFO_OFFSET_ZEROP (base_binfo)
|| TREE_VIA_VIRTUAL (base_binfo)
|| TYPE_MODE (type) != TYPE_MODE (BINFO_TYPE (base_binfo)))
{
tree addr = build_unary_op (ADDR_EXPR, expr, 0);
ref = build_indirect_ref (convert_pointer_to (base_binfo, addr),
NULL_PTR);
}
else
{
ref = copy_node (expr);
TREE_TYPE (ref) = BINFO_TYPE (base_binfo);
}
return ref;
}
/* Build an assignment expression of lvalue LHS from value RHS.
MODIFYCODE is the code for a binary operator that we use
to combine the old value of LHS with RHS to get the new value.
Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment.
C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed.
`build_modify_expr_1' implements recursive part of memberwise
assignment operation. */
static tree
build_modify_expr_1 (lhs, modifycode, rhs, basetype_path)
tree lhs, rhs;
enum tree_code modifycode;
tree basetype_path;
{
register tree result;
tree newrhs = rhs;
tree lhstype = TREE_TYPE (lhs);
tree olhstype = lhstype;
/* Avoid duplicate error messages from operands that had errors. */
if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK)
return error_mark_node;
/* If a binary op has been requested, combine the old LHS value with the RHS
producing the value we should actually store into the LHS. */
if (modifycode == INIT_EXPR)
;
else if (modifycode == NOP_EXPR)
{
/* must deal with overloading of `operator=' here. */
if (TREE_CODE (lhstype) == REFERENCE_TYPE)
lhstype = TREE_TYPE (lhstype);
else
lhstype = olhstype;
}
else
{
lhs = stabilize_reference (lhs);
newrhs = build_binary_op (modifycode, lhs, rhs, 1);
modifycode = NOP_EXPR;
}
/* If storing into a structure or union member,
it has probably been given type `int'.
Compute the type that would go with
the actual amount of storage the member occupies. */
if (TREE_CODE (lhs) == COMPONENT_REF
&& (TREE_CODE (lhstype) == INTEGER_TYPE
|| TREE_CODE (lhstype) == REAL_TYPE
|| TREE_CODE (lhstype) == ENUMERAL_TYPE))
lhstype = TREE_TYPE (get_unwidened (lhs, 0));
/* C++: The semantics of C++ differ from those of C when an
assignment of an aggregate is desired. Assignment in C++ is
now defined as memberwise assignment of non-static members
and base class objects. This rule applies recursively
until a member of a built-in type is found.
Also, we cannot do a bit-wise copy of aggregates which
contain virtual function table pointers. Those
pointer values must be preserved through the copy.
However, this is handled in expand_expr, and not here.
This is because much better code can be generated at
that stage than this one. */
if (TREE_CODE (lhstype) == RECORD_TYPE
&& TYPE_LANG_SPECIFIC (lhstype)
&& TYPE_MAIN_VARIANT (lhstype) == TYPE_MAIN_VARIANT (TREE_TYPE (newrhs)))
{
register tree elt;
int i;
/* Perform operation on object. */
if (modifycode == INIT_EXPR && TYPE_HAS_INIT_REF (lhstype))
{
result = build_method_call (lhs, constructor_name_full (lhstype),
build_tree_list (NULL_TREE, rhs),
basetype_path, LOOKUP_NORMAL);
return build_indirect_ref (result, NULL_PTR);
}
else if (modifycode == NOP_EXPR)
{
/* `operator=' is not an inheritable operator; see 13.4.3. */
if (TYPE_LANG_SPECIFIC (lhstype) && TYPE_HAS_ASSIGNMENT (lhstype))
{
result = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
lhs, rhs, make_node (NOP_EXPR));
if (result == NULL_TREE)
return error_mark_node;
return result;
}
}
if (TYPE_USES_VIRTUAL_BASECLASSES (lhstype)
|| (modifycode == NOP_EXPR && TYPE_GETS_ASSIGNMENT (lhstype))
|| (modifycode == INIT_EXPR && TYPE_GETS_INIT_REF (lhstype)))
{
tree binfos = BINFO_BASETYPES (TYPE_BINFO (lhstype));
result = NULL_TREE;
if (binfos != NULL_TREE)
/* Perform operation on each member, depth-first, left-right. */
for (i = 0; i <= TREE_VEC_LENGTH (binfos)-1; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
tree base_lhs, base_rhs;
tree new_result;
/* Assignments from virtual baseclasses handled elsewhere. */
if (TREE_VIA_VIRTUAL (base_binfo))
continue;
base_lhs = get_base_ref (lhstype, i, lhs);
base_rhs = get_base_ref (lhstype, i, newrhs);
BINFO_INHERITANCE_CHAIN (base_binfo) = basetype_path;
new_result
= build_modify_expr_1 (base_lhs, modifycode, base_rhs,
base_binfo);
/* We either get back a compound stmt, or a simple one. */
if (new_result && TREE_CODE (new_result) == TREE_LIST)
new_result = build_compound_expr (new_result);
result = tree_cons (NULL_TREE, new_result, result);
}
for (elt = TYPE_FIELDS (lhstype); elt; elt = TREE_CHAIN (elt))
{
tree vbases = NULL_TREE;
tree elt_lhs, elt_rhs;
if (TREE_CODE (elt) != FIELD_DECL)
continue;
if (DECL_NAME (elt)
&& (VFIELD_NAME_P (DECL_NAME (elt))
|| VBASE_NAME_P (DECL_NAME (elt))))
continue;
if (TREE_READONLY (elt)
|| TREE_CODE (TREE_TYPE (elt)) == REFERENCE_TYPE)
{
cp_error ("cannot generate default `%T::operator ='",
lhstype);
if (TREE_CODE (TREE_TYPE (elt)) == REFERENCE_TYPE)
cp_error_at ("because member `%#D' is a reference", elt);
else
cp_error_at ("because member `%#D' is const", elt);
return error_mark_node;
}
if (IS_AGGR_TYPE (TREE_TYPE (elt))
&& TYPE_LANG_SPECIFIC (TREE_TYPE (elt)))
vbases = CLASSTYPE_VBASECLASSES (TREE_TYPE (elt));
elt_lhs = build (COMPONENT_REF, TREE_TYPE (elt), lhs, elt);
elt_rhs = build (COMPONENT_REF, TREE_TYPE (elt), newrhs, elt);
/* It is not always safe to go through `build_modify_expr_1'
when performing element-wise copying. This is because
an element may be of ARRAY_TYPE, which will not
be properly copied as a naked element. */
if (TREE_CODE (TREE_TYPE (elt)) == RECORD_TYPE
&& TYPE_LANG_SPECIFIC (TREE_TYPE (elt)))
basetype_path = TYPE_BINFO (TREE_TYPE (elt));
while (vbases)
{
tree elt_lhs_addr = build_unary_op (ADDR_EXPR, elt_lhs, 0);
tree elt_rhs_addr = build_unary_op (ADDR_EXPR, elt_rhs, 0);
elt_lhs_addr = convert_pointer_to (vbases, elt_lhs_addr);
elt_rhs_addr = convert_pointer_to (vbases, elt_rhs_addr);
result
= tree_cons (NULL_TREE,
build_modify_expr_1
(build_indirect_ref (elt_lhs_addr, NULL_PTR),
modifycode,
build_indirect_ref (elt_rhs_addr, NULL_PTR),
basetype_path),
result);
if (TREE_VALUE (result) == error_mark_node)
return error_mark_node;
vbases = TREE_CHAIN (vbases);
}
elt_lhs = build_modify_expr_1 (elt_lhs, modifycode, elt_rhs,
basetype_path);
result = tree_cons (NULL_TREE, elt_lhs, result);
}
if (result)
return build_compound_expr (result);
/* No fields to move. */
return integer_zero_node;
}
else
{
result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
void_type_node, lhs, rhs);
TREE_SIDE_EFFECTS (result) = 1;
return result;
}
}
result = build_modify_expr (lhs, modifycode, newrhs);
/* ARRAY_TYPEs cannot be converted to anything meaningful,
and leaving it there screws up `build_compound_expr' when
it tries to defaultly convert everything. */
if (TREE_CODE (TREE_TYPE (result)) == ARRAY_TYPE)
TREE_TYPE (result) = void_type_node;
return result;
}
#endif
/* Taken from expr.c:
Subroutine of expand_expr:
record the non-copied parts (LIST) of an expr (LHS), and return a list
which specifies the initial values of these parts. */
static tree
init_noncopied_parts (lhs, list)
tree lhs;
tree list;
{
tree tail;
tree parts = 0;
for (tail = list; tail; tail = TREE_CHAIN (tail))
if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
parts = chainon (parts, init_noncopied_parts (lhs, TREE_VALUE (tail)));
else
{
tree part = TREE_VALUE (tail);
tree part_type = TREE_TYPE (part);
tree to_be_initialized = build (COMPONENT_REF, part_type, lhs, part);
parts = tree_cons (TREE_PURPOSE (tail), to_be_initialized, parts);
}
return parts;
}
tree
expand_target_expr (t)
tree t;
......@@ -5638,12 +5234,6 @@ build_modify_expr (lhs, modifycode, rhs)
/* Types that aren't fully specified cannot be used in assignments. */
lhs = require_complete_type (lhs);
/* Decide early if we are going to protect RHS from GC
before assigning it to LHS. */
if (type_needs_gc_entry (TREE_TYPE (rhs))
&& ! value_safe_from_gc (lhs, rhs))
rhs = protect_value_from_gc (lhs, rhs);
newrhs = rhs;
/* Handle assignment to signature pointers/refs. */
......@@ -5762,7 +5352,6 @@ build_modify_expr (lhs, modifycode, rhs)
}
else if (modifycode == NOP_EXPR)
{
#if 1
/* `operator=' is not an inheritable operator. */
if (! IS_AGGR_TYPE (lhstype))
/* Do the default thing */;
......@@ -5789,46 +5378,6 @@ build_modify_expr (lhs, modifycode, rhs)
return error_mark_node;
return result;
}
#else
/* Treat `operator=' as an inheritable operator. */
if (TYPE_LANG_SPECIFIC (lhstype) && TYPE_GETS_ASSIGNMENT (lhstype))
{
tree orig_lhstype = lhstype;
while (! TYPE_HAS_ASSIGNMENT (lhstype))
{
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (lhstype);
tree basetype = NULL_TREE;
for (i = 0; i < n_baseclasses; i++)
if (TYPE_GETS_ASSIGNMENT (TYPE_BINFO_BASETYPE (lhstype, i)))
{
if (basetype != NULL_TREE)
{
message_2_types (error, "base classes `%s' and `%s' both have operator ='",
basetype,
TYPE_BINFO_BASETYPE (lhstype, i));
return error_mark_node;
}
basetype = TYPE_BINFO_BASETYPE (lhstype, i);
}
lhstype = basetype;
}
if (orig_lhstype != lhstype)
{
lhs = build_indirect_ref (convert_pointer_to (lhstype,
build_unary_op (ADDR_EXPR, lhs, 0)), NULL_PTR);
if (lhs == error_mark_node)
{
cp_error ("conversion to private basetype `%T'", lhstype);
return error_mark_node;
}
}
result = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
lhs, rhs, make_node (NOP_EXPR));
if (result == NULL_TREE)
return error_mark_node;
return result;
}
#endif
lhstype = olhstype;
}
else if (PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE))
......@@ -5992,104 +5541,6 @@ build_modify_expr (lhs, modifycode, rhs)
if (TREE_SIDE_EFFECTS (newrhs))
newrhs = stabilize_reference (newrhs);
#if 0
/* This is now done by generating X(X&) and operator=(X&). */
/* C++: The semantics of C++ differ from those of C when an
assignment of an aggregate is desired. Assignment in C++ is
now defined as memberwise assignment of non-static members
and base class objects. This rule applies recursively
until a member of a built-in type is found.
Also, we cannot do a bit-wise copy of aggregates which
contain virtual function table pointers. Those
pointer values must be preserved through the copy.
However, this is handled in expand_expr, and not here.
This is because much better code can be generated at
that stage than this one. */
if (TREE_CODE (lhstype) == RECORD_TYPE
&& ! TYPE_PTRMEMFUNC_P (lhstype)
&& (TYPE_MAIN_VARIANT (lhstype) == TYPE_MAIN_VARIANT (TREE_TYPE (newrhs))
|| (TREE_CODE (TREE_TYPE (newrhs)) == RECORD_TYPE
&& UNIQUELY_DERIVED_FROM_P (lhstype, TREE_TYPE (newrhs)))))
{
tree vbases = CLASSTYPE_VBASECLASSES (lhstype);
tree lhs_addr = build_unary_op (ADDR_EXPR, lhs, 0);
tree rhs_addr;
/* Memberwise assignment would cause NEWRHS to be
evaluated for every member that gets assigned.
By wrapping side-effecting exprs in a SAVE_EXPR,
NEWRHS will only be evaluated once. */
if (IS_AGGR_TYPE (TREE_TYPE (newrhs))
&& TREE_SIDE_EFFECTS (newrhs)
/* This are things we don't have to save. */
&& TREE_CODE (newrhs) != COND_EXPR
&& TREE_CODE (newrhs) != TARGET_EXPR
&& TREE_CODE (newrhs) != WITH_CLEANUP_EXPR)
/* Call `break_out_cleanups' on NEWRHS in case there are cleanups.
If NEWRHS is a CALL_EXPR that needs a cleanup, failure to do so
will result in expand_expr expanding the call without knowing
that it should run the cleanup. */
newrhs = save_expr (break_out_cleanups (newrhs));
if (TREE_CODE (newrhs) == COND_EXPR)
rhs_addr = rationalize_conditional_expr (ADDR_EXPR, newrhs);
else
rhs_addr = build_unary_op (ADDR_EXPR, newrhs, 0);
result = tree_cons (NULL_TREE,
convert (build_reference_type (lhstype), lhs),
NULL_TREE);
if (! comptypes (TREE_TYPE (lhs_addr), TREE_TYPE (rhs_addr), 1))
rhs_addr = convert_pointer_to (TREE_TYPE (TREE_TYPE (lhs_addr)), rhs_addr);
{
tree noncopied_parts = NULL_TREE;
if (TYPE_NONCOPIED_PARTS (lhstype) != 0)
noncopied_parts = init_noncopied_parts (lhs,
TYPE_NONCOPIED_PARTS (lhstype));
while (noncopied_parts != 0)
{
result = tree_cons (NULL_TREE,
build_modify_expr (convert (ptr_type_node, TREE_VALUE (noncopied_parts)),
NOP_EXPR,
TREE_PURPOSE (noncopied_parts)),
result);
noncopied_parts = TREE_CHAIN (noncopied_parts);
}
}
/* Once we have our hands on an address, we must change NEWRHS
to work from there. Otherwise we can get multiple evaluations
of NEWRHS. */
if (TREE_CODE (newrhs) != SAVE_EXPR)
newrhs = build_indirect_ref (rhs_addr, NULL_PTR);
while (vbases)
{
tree elt_lhs = convert_pointer_to (vbases, lhs_addr);
tree elt_rhs = convert_pointer_to (vbases, rhs_addr);
result
= tree_cons (NULL_TREE,
build_modify_expr_1 (build_indirect_ref (elt_lhs, NULL_PTR),
modifycode,
build_indirect_ref (elt_rhs, NULL_PTR),
TYPE_BINFO (lhstype)),
result);
if (TREE_VALUE (result) == error_mark_node)
return error_mark_node;
vbases = TREE_CHAIN (vbases);
}
result = tree_cons (NULL_TREE,
build_modify_expr_1 (lhs,
modifycode,
newrhs,
TYPE_BINFO (lhstype)),
result);
return build_compound_expr (result);
}
#endif
/* Convert new value to destination type. */
if (TREE_CODE (lhstype) == ARRAY_TYPE)
......@@ -6148,15 +5599,6 @@ build_modify_expr (lhs, modifycode, rhs)
}
else
{
#if 0
if (IS_AGGR_TYPE (lhstype))
{
if (result = build_opfncall (MODIFY_EXPR,
LOOKUP_NORMAL, lhs, newrhs,
make_node (NOP_EXPR)))
return result;
}
#endif
/* Avoid warnings on enum bit fields. */
if (TREE_CODE (olhstype) == ENUMERAL_TYPE
&& TREE_CODE (lhstype) == INTEGER_TYPE)
......@@ -6371,22 +5813,8 @@ build_ptrmemfunc (type, pfn, force)
{
tree ndelta, ndelta2, nindex;
/* Is is already the right type? */
#if 0
/* Sorry, can't do this, the backend is too stupid. */
if (TYPE_METHOD_BASETYPE (TREE_TYPE (type))
== TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))))
{
if (type != TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))
{
npfn = build1 (NOP_EXPR, TYPE_GET_PTRMEMFUNC_TYPE (type), pfn);
TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn);
}
return pfn;
}
#else
if (type == TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))
return pfn;
#endif
if (TREE_CODE (pfn) != CONSTRUCTOR)
{
......@@ -7063,12 +6491,6 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
if (coder == ERROR_MARK)
return error_mark_node;
#if 0
/* This is *not* the quick way out! It is the way to disaster. */
if (type == rhstype)
goto converted;
#endif
/* We accept references to incomplete types, so we can
return here before checking if RHS is of complete type. */
......@@ -7536,14 +6958,6 @@ c_expand_return (retval)
}
current_function_returns_value = returns_value;
#if 0
/* These wind up after the BARRIER, which causes problems for
expand_end_binding. What purpose were they supposed to serve? */
if (original_result_rtx)
use_variable (original_result_rtx);
if (use_temp)
use_variable (DECL_RTL (DECL_RESULT (current_function_decl)));
#endif
/* One way to clear out cleanups that EXPR might
generate. Note that this code will really be
......
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