Commit c73964b2 by Mike Stump

87th Cygnus<->FSF quick merge

From-SVN: r12606
parent 581bc4de
...@@ -3,8 +3,173 @@ Thu Aug 8 17:48:16 1996 Michael Meissner <meissner@tiktok.cygnus.com> ...@@ -3,8 +3,173 @@ Thu Aug 8 17:48:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* decl2.c (import_export_vtable): Delete code that disabled vtable * decl2.c (import_export_vtable): Delete code that disabled vtable
heuristic on systems with ASM_OUTPUT_EXTERNAL. heuristic on systems with ASM_OUTPUT_EXTERNAL.
Wed Aug 7 12:44:11 1996 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (build_x_function_call): Handle static call context
better.
* decl.c (finish_function): Set the DECL_CONTEXT of the result to
the function, not its outer block.
* call.c (build_field_call): Pass fields on to build_opfncall
regardless of TYPE_OVERLOADS_CALL_EXPR.
(build_method_call): Pass on to build_new_method_call sooner.
* typeck.c (build_ptrmemfunc): Just return what instantiate_type
gives us.
* class.c (instantiate_type): Don't put a POINTER_TYPE to
METHOD_TYPE on an expression. Also make a copy of rhs instead of
modifying it.
Tue Aug 6 12:58:46 1996 Jason Merrill <jason@yorick.cygnus.com>
* call.c (compare_ics): Handle qual_conv after lvalue_conv.
(add_builtin_candidate): Don't take enums for ++.
(build_new_method_call): Handle non-aggregates and field calls.
Move new overloading code from...
* cvt.c: Here.
* decl.c (grokparms): Don't check default args in templates.
Mon Aug 5 17:17:06 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (build_new_op): Fix args to build_unary_op.
(add_builtin_candidates): Don't call type_promotes_to on float.
* decl.c (grokparms): Check the type of the default arg.
* cvt.c (build_new_op): Pass non-overloaded cases on rather than
returning NULL_TREE.
* typeck.c (build_x_binary_op): Avoid doing extra work.
(build_x_unary_op): Ditto.
(build_x_conditional_expr): Ditto.
* cvt.c (build_over_call): Return.
(add_builtin_candidate): Fix MEMBER_REF.
(build_new_op): Ditto.
Mon Aug 5 17:07:47 1996 Mike Stump <mrs@cygnus.com>
* method.c (build_overload_name): Put bug fix into code but leave
disabled for now so we can be bug compatible with older releases
that do repeats incorrectly. In the future, we can enable it.
Mon Aug 5 13:46:28 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (convert_like): Don't call build_cplus_new twice.
* call.c, cp-tree.h, cvt.c, decl2.c, init.c, method.c, pt.c, typeck.c:
Control new overloading code with -fansi-overloading.
Sun Aug 4 15:29:11 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (build_over_call): Call build_cplus_new.
* call.c (build_method_call): Ditto.
* typeck.c (build_function_call_real): Ditto.
(build_conditional_expr): If both operands are TARGET_EXPRs, wrap
the COND_EXPR in a TARGET_EXPR so they use the same slot.
* cvt.c (build_up_reference): Propagate INDIRECT_BIND to
recursive calls.
* typeck.c (complete_type): Propagate
TYPE_NEEDS_{CONSTRUCTING,DESTRUCTOR}.
Sat Aug 3 14:05:07 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (joust): More ?: kludging. Sigh.
(build_over_call): Don't try to synthesize global fns.
* search.c (lookup_conversions): Use binfo marking.
Sat Aug 3 12:33:42 1996 Bob Manson <manson@charmed.cygnus.com>
* search.c (build_mi_matrix): Use the correct value of cid
when determining the new mi_size.
Sat Aug 3 01:27:41 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (add_builtin_candidates): Do consider type conversion ops
for the first parms of += et al.
(strip_top_quals): New fn.
(reference_binding): Use it instead of TYPE_MAIN_VARIANT.
(implicit_conversion): Ditto.
(add_builtin_candidates): Be careful about arrays.
(build_new_method_call): Handle vtable optimization.
Fri Aug 2 01:26:59 1996 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.h (LOOKUP_NO_TEMP_BIND): New flag.
* cvt.c (reference_binding): Use it.
(implicit_conversion): Use it.
(add_builtin_candidate, COND_EXPR): Use it.
* cvt.c (build_new_function_call): Check for error args.
* typeck.c (comptypes): Just check DERIVED_FROM_P, not UNIQUELY.
* gxx.gperf: Add __null.
* hash.h: Regenerate.
* lex.h: Add RID_NULL.
* lex.c (init_lex): Create null_pointer_node here, stick it in
RID_NULL.
* decl.c (init_decl_processing): Still set its type here.
* cvt.c (cp_convert_to_pointer): Don't produce null_pointer_node.
(convert_to_pointer_force): Ditto.
(null_ptr_cst_p): Check for null_pointer_node; only accept (void*)0
if (! pedantic).
* call.c (convert_harshness): Use null_ptr_cst_p.
* typeck.c (convert_for_assignment): Ditto. Don't produce
null_pointer_node.
* error.c (args_as_string): Handle lists of actual args, too.
* cvt.c (null_ptr_cst): Support (void*)0 for now.
(build_user_type_conversion_1): Improve diagnostics.
(build_new_function_call): Likewise.
(build_object_call): Likewise.
(build_new_method_call): Likewise. Move call before def diagnostic...
(build_over_call): Here.
* cvt.c (build_new_method_call): Don't complain about no match if
LOOKUP_SPECULATIVELY.
(build_over_call): Fix 'this' for virtual fn.
(build_new_method_call): Add diagnostic.
Thu Aug 1 16:45:09 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (add_function_candidate): Expect 'this' and 'in_chrg' for
constructors to be passed in.
(build_over_call): Likewise.
(build_user_type_conversion_1): Pass them in.
(convert_like): Likewise.
(build_object_call): Handle overloaded conversions.
(build_over_call): Pass the right args to build_vfn_ref.
(standard_conversion): Fix pmf convs.
(joust): Handle comparing statics and non-statics.
(build_new_method_call): New fn.
* call.c (build_method_call): Call it if NEW_OVER.
Thu Aug 1 16:06:14 1996 Mike Stump <mrs@cygnus.com>
* lex.c (do_identifier): Don't use %O on IDENTIFIER_OPNAME_Ps, use
%D instead.
Thu Aug 1 15:24:02 1996 Mike Stump <mrs@cygnus.com>
* except.c (expand_throw): Use maybe_build_cleanup_and_delete
instead of just maybe_build_cleanup so that we deallocate the
thrown object.
Thu Aug 1 15:18:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* decl2.c (finish_prevtable_vardecl): Make non-static for pt.c's use.
* cp-tree.h (finish_prevtable_vardecl): Add decl.
Thu Aug 1 11:53:51 1996 Bob Manson <manson@charmed.cygnus.com> Thu Aug 1 11:53:51 1996 Bob Manson <manson@charmed.cygnus.com>
* pt.c (instantiate_class_template): Call complete_type. Also, if
we're at the end of the file and we just instantiated a template
class with a vtable, call finish_prevtable_vardecl.
* error.c (dump_decl): Don't explode (or explode more gracefully * error.c (dump_decl): Don't explode (or explode more gracefully
as appropriate) if the object being dumped has a null type. as appropriate) if the object being dumped has a null type.
(dump_expr): Ditto. (dump_expr): Ditto.
......
...@@ -4841,6 +4841,8 @@ instantiate_type (lhstype, rhs, complain) ...@@ -4841,6 +4841,8 @@ instantiate_type (lhstype, rhs, complain)
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs))) if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
return rhs; return rhs;
rhs = copy_node (rhs);
/* This should really only be used when attempting to distinguish /* This should really only be used when attempting to distinguish
what sort of a pointer to function we have. For now, any what sort of a pointer to function we have. For now, any
arithmetic operation which is not supported on pointers arithmetic operation which is not supported on pointers
...@@ -5246,6 +5248,12 @@ instantiate_type (lhstype, rhs, complain) ...@@ -5246,6 +5248,12 @@ instantiate_type (lhstype, rhs, complain)
TREE_TYPE (rhs) = lhstype; TREE_TYPE (rhs) = lhstype;
TREE_OPERAND (rhs, 0) = fn; TREE_OPERAND (rhs, 0) = fn;
TREE_CONSTANT (rhs) = staticp (fn); TREE_CONSTANT (rhs) = staticp (fn);
if (TREE_CODE (lhstype) == POINTER_TYPE &&
TREE_CODE (TREE_TYPE (lhstype)) == METHOD_TYPE)
{
build_ptrmemfunc_type (lhstype);
rhs = build_ptrmemfunc (lhstype, rhs, 0);
}
} }
return rhs; return rhs;
......
...@@ -295,6 +295,11 @@ extern int flag_elide_constructors; ...@@ -295,6 +295,11 @@ extern int flag_elide_constructors;
extern int flag_ansi; extern int flag_ansi;
/* Nonzero means do argument matching for overloading according to the
ANSI rules, rather than what g++ used to believe to be correct. */
extern int flag_ansi_overloading;
/* Nonzero means recognize and handle signature language constructs. */ /* Nonzero means recognize and handle signature language constructs. */
extern int flag_handle_signatures; extern int flag_handle_signatures;
...@@ -1841,7 +1846,8 @@ extern tree current_class_type; /* _TYPE: the type of the current class */ ...@@ -1841,7 +1846,8 @@ extern tree current_class_type; /* _TYPE: the type of the current class */
before LOOKUP_SPECULATIVELY is checked. before LOOKUP_SPECULATIVELY is checked.
LOOKUP_NO_CONVERSION means that user-defined conversions are not LOOKUP_NO_CONVERSION means that user-defined conversions are not
permitted. Built-in conversions are permitted. permitted. Built-in conversions are permitted.
LOOKUP_DESTRUCTOR means explicit call to destructor. */ LOOKUP_DESTRUCTOR means explicit call to destructor.
LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references. */
#define LOOKUP_PROTECT (1) #define LOOKUP_PROTECT (1)
#define LOOKUP_COMPLAIN (2) #define LOOKUP_COMPLAIN (2)
...@@ -1855,6 +1861,7 @@ extern tree current_class_type; /* _TYPE: the type of the current class */ ...@@ -1855,6 +1861,7 @@ extern tree current_class_type; /* _TYPE: the type of the current class */
#define INDIRECT_BIND (256) #define INDIRECT_BIND (256)
#define LOOKUP_NO_CONVERSION (512) #define LOOKUP_NO_CONVERSION (512)
#define LOOKUP_DESTRUCTOR (512) #define LOOKUP_DESTRUCTOR (512)
#define LOOKUP_NO_TEMP_BIND (1024)
/* These flags are used by the conversion code. /* These flags are used by the conversion code.
CONV_IMPLICIT : Perform implicit conversions (standard and user-defined). CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
...@@ -1935,6 +1942,9 @@ extern tree build_scoped_method_call PROTO((tree, tree, tree, tree)); ...@@ -1935,6 +1942,9 @@ extern tree build_scoped_method_call PROTO((tree, tree, tree, tree));
extern tree build_method_call PROTO((tree, tree, tree, tree, int)); extern tree build_method_call PROTO((tree, tree, tree, tree, int));
extern tree build_overload_call_real PROTO((tree, tree, int, struct candidate *, int)); extern tree build_overload_call_real PROTO((tree, tree, int, struct candidate *, int));
extern tree build_overload_call PROTO((tree, tree, int)); extern tree build_overload_call PROTO((tree, tree, int));
extern tree build_new_method_call PROTO((tree, tree, tree, tree, int));
extern tree build_new_function_call PROTO((tree, tree, tree));
extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree));
/* in class.c */ /* in class.c */
extern tree build_vbase_pointer PROTO((tree, tree)); extern tree build_vbase_pointer PROTO((tree, tree));
...@@ -2057,6 +2067,7 @@ extern tree start_method PROTO((tree, tree, tree)); ...@@ -2057,6 +2067,7 @@ extern tree start_method PROTO((tree, tree, tree));
extern tree finish_method PROTO((tree)); extern tree finish_method PROTO((tree));
extern void hack_incomplete_structures PROTO((tree)); extern void hack_incomplete_structures PROTO((tree));
extern tree maybe_build_cleanup PROTO((tree)); extern tree maybe_build_cleanup PROTO((tree));
extern tree maybe_build_cleanup_and_delete PROTO((tree));
extern void cplus_expand_expr_stmt PROTO((tree)); extern void cplus_expand_expr_stmt PROTO((tree));
extern void finish_stmt PROTO((void)); extern void finish_stmt PROTO((void));
extern void pop_implicit_try_blocks PROTO((tree)); extern void pop_implicit_try_blocks PROTO((tree));
...@@ -2096,6 +2107,7 @@ extern void finish_builtin_type PROTO((tree, char *, tree *, int, tree)); ...@@ -2096,6 +2107,7 @@ extern void finish_builtin_type PROTO((tree, char *, tree *, int, tree));
extern tree coerce_new_type PROTO((tree)); extern tree coerce_new_type PROTO((tree));
extern tree coerce_delete_type PROTO((tree)); extern tree coerce_delete_type PROTO((tree));
extern void import_export_vtable PROTO((tree, tree, int)); extern void import_export_vtable PROTO((tree, tree, int));
extern int finish_prevtable_vardecl PROTO((tree, tree));
extern int walk_vtables PROTO((void (*)(), int (*)())); extern int walk_vtables PROTO((void (*)(), int (*)()));
extern void walk_sigtables PROTO((void (*)(), void (*)())); extern void walk_sigtables PROTO((void (*)(), void (*)()));
extern void finish_file PROTO((void)); extern void finish_file PROTO((void));
...@@ -2330,6 +2342,7 @@ extern void init_search_processing PROTO((void)); ...@@ -2330,6 +2342,7 @@ extern void init_search_processing PROTO((void));
extern void reinit_search_statistics PROTO((void)); extern void reinit_search_statistics PROTO((void));
extern tree current_scope PROTO((void)); extern tree current_scope PROTO((void));
extern tree lookup_conversions PROTO((tree)); extern tree lookup_conversions PROTO((tree));
extern tree get_template_base PROTO((tree, tree));
/* in sig.c */ /* in sig.c */
extern tree build_signature_pointer_type PROTO((tree, int, int)); extern tree build_signature_pointer_type PROTO((tree, int, int));
......
...@@ -4912,9 +4912,7 @@ init_decl_processing () ...@@ -4912,9 +4912,7 @@ init_decl_processing ()
void_list_node = build_tree_list (NULL_TREE, void_type_node); void_list_node = build_tree_list (NULL_TREE, void_type_node);
TREE_PARMLIST (void_list_node) = 1; TREE_PARMLIST (void_list_node) = 1;
null_pointer_node = build_int_2 (0, 0);
TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
layout_type (TREE_TYPE (null_pointer_node));
/* Used for expressions that do nothing, but are not errors. */ /* Used for expressions that do nothing, but are not errors. */
void_zero_node = build_int_2 (0, 0); void_zero_node = build_int_2 (0, 0);
...@@ -9864,6 +9862,10 @@ grokparms (first_parm, funcdef_flag) ...@@ -9864,6 +9862,10 @@ grokparms (first_parm, funcdef_flag)
} }
else else
init = require_instantiated_type (type, init, integer_zero_node); init = require_instantiated_type (type, init, integer_zero_node);
if (! current_template_parms
&& ! implicit_conversion (type, TREE_TYPE (init), init, LOOKUP_NORMAL))
cp_pedwarn ("invalid type `%T' for default argument to `%#D'",
TREE_TYPE (init), decl);
} }
} }
else else
...@@ -11962,7 +11964,7 @@ finish_function (lineno, call_poplevel, nested) ...@@ -11962,7 +11964,7 @@ finish_function (lineno, call_poplevel, nested)
pop_memoized_context (1); pop_memoized_context (1);
/* Must mark the RESULT_DECL as being in this function. */ /* Must mark the RESULT_DECL as being in this function. */
DECL_CONTEXT (DECL_RESULT (fndecl)) = DECL_INITIAL (fndecl); DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
/* Obey `register' declarations if `setjmp' is called in this fn. */ /* Obey `register' declarations if `setjmp' is called in this fn. */
if (flag_traditional && current_function_calls_setjmp) if (flag_traditional && current_function_calls_setjmp)
...@@ -12303,15 +12305,14 @@ hack_incomplete_structures (type) ...@@ -12303,15 +12305,14 @@ hack_incomplete_structures (type)
} }
/* If DECL is of a type which needs a cleanup, build that cleanup here. /* If DECL is of a type which needs a cleanup, build that cleanup here.
We don't build cleanups if just going for syntax checking, since See build_delete for information about AUTO_DELETE.
fixup_cleanups does not know how to not handle them.
Don't build these on the momentary obstack; they must live Don't build these on the momentary obstack; they must live
the life of the binding contour. */ the life of the binding contour. */
tree static tree
maybe_build_cleanup (decl) maybe_build_cleanup_1 (decl, auto_delete)
tree decl; tree decl, auto_delete;
{ {
tree type = TREE_TYPE (decl); tree type = TREE_TYPE (decl);
if (TYPE_NEEDS_DESTRUCTOR (type)) if (TYPE_NEEDS_DESTRUCTOR (type))
...@@ -12335,7 +12336,7 @@ maybe_build_cleanup (decl) ...@@ -12335,7 +12336,7 @@ maybe_build_cleanup (decl)
|| flag_expensive_optimizations) || flag_expensive_optimizations)
flags |= LOOKUP_NONVIRTUAL; flags |= LOOKUP_NONVIRTUAL;
rval = build_delete (TREE_TYPE (rval), rval, integer_two_node, flags, 0); rval = build_delete (TREE_TYPE (rval), rval, auto_delete, flags, 0);
if (TYPE_USES_VIRTUAL_BASECLASSES (type) if (TYPE_USES_VIRTUAL_BASECLASSES (type)
&& ! TYPE_HAS_DESTRUCTOR (type)) && ! TYPE_HAS_DESTRUCTOR (type))
...@@ -12352,6 +12353,26 @@ maybe_build_cleanup (decl) ...@@ -12352,6 +12353,26 @@ maybe_build_cleanup (decl)
} }
return 0; return 0;
} }
/* If DECL is of a type which needs a cleanup, build that cleanup
here. The cleanup does free the storage with a call to delete. */
tree
maybe_build_cleanup_and_delete (decl)
tree decl;
{
return maybe_build_cleanup_1 (decl, integer_three_node);
}
/* If DECL is of a type which needs a cleanup, build that cleanup
here. The cleanup does not free the storage with a call a delete. */
tree
maybe_build_cleanup (decl)
tree decl;
{
return maybe_build_cleanup_1 (decl, integer_two_node);
}
/* Expand a C++ expression at the statement level. /* Expand a C++ expression at the statement level.
This is needed to ferret out nodes which have UNKNOWN_TYPE. This is needed to ferret out nodes which have UNKNOWN_TYPE.
......
...@@ -125,6 +125,15 @@ int flag_no_ident; ...@@ -125,6 +125,15 @@ int flag_no_ident;
int flag_ansi; int flag_ansi;
/* Nonzero means do argument matching for overloading according to the
ANSI rules, rather than what g++ used to believe to be correct. */
#ifdef NEW_OVER
int flag_ansi_overloading = 1;
#else
int flag_ansi_overloading;
#endif
/* Nonzero means do emit exported implementations of functions even if /* Nonzero means do emit exported implementations of functions even if
they can be inlined. */ they can be inlined. */
...@@ -157,7 +166,11 @@ int warn_ctor_dtor_privacy = 1; ...@@ -157,7 +166,11 @@ int warn_ctor_dtor_privacy = 1;
/* True if we want to implement vtables using "thunks". /* True if we want to implement vtables using "thunks".
The default is off. */ The default is off. */
#if defined(NEW_OVER) && defined (__i386__)
int flag_vtable_thunks = 1;
#else
int flag_vtable_thunks; int flag_vtable_thunks;
#endif
/* True if we want to deal with repository information. */ /* True if we want to deal with repository information. */
...@@ -410,6 +423,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] = ...@@ -410,6 +423,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"implement-inlines", &flag_implement_inlines, 1}, {"implement-inlines", &flag_implement_inlines, 1},
{"external-templates", &flag_external_templates, 1}, {"external-templates", &flag_external_templates, 1},
{"implicit-templates", &flag_implicit_templates, 1}, {"implicit-templates", &flag_implicit_templates, 1},
{"ansi-overloading", &flag_ansi_overloading, 1},
{"huge-objects", &flag_huge_objects, 1}, {"huge-objects", &flag_huge_objects, 1},
{"conserve-space", &flag_conserve_space, 1}, {"conserve-space", &flag_conserve_space, 1},
{"vtable-thunks", &flag_vtable_thunks, 1}, {"vtable-thunks", &flag_vtable_thunks, 1},
...@@ -2562,7 +2576,7 @@ import_export_template (type) ...@@ -2562,7 +2576,7 @@ import_export_template (type)
} }
} }
static int int
finish_prevtable_vardecl (prev, vars) finish_prevtable_vardecl (prev, vars)
tree prev, vars; tree prev, vars;
{ {
......
...@@ -1539,9 +1539,20 @@ args_as_string (p, v) ...@@ -1539,9 +1539,20 @@ args_as_string (p, v)
int v; int v;
{ {
if (p == NULL_TREE) if (p == NULL_TREE)
return "..."; return "";
return type_as_string (p, v); if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (p))) == 't')
return type_as_string (p, v);
OB_INIT ();
for (; p; p = TREE_CHAIN (p))
{
dump_type (TREE_TYPE (TREE_VALUE (p)), v);
if (TREE_CHAIN (p))
OB_PUTS (", ");
}
OB_FINISH ();
return (char *)obstack_base (&scratch_obstack);
} }
char * char *
......
...@@ -1079,7 +1079,7 @@ expand_throw (exp) ...@@ -1079,7 +1079,7 @@ expand_throw (exp)
start_sequence (); start_sequence ();
object = build_reinterpret_cast (TREE_TYPE (exp), saved_throw_value); object = build_reinterpret_cast (TREE_TYPE (exp), saved_throw_value);
object = build_indirect_ref (object, NULL_PTR); object = build_indirect_ref (object, NULL_PTR);
cleanup = maybe_build_cleanup (object); cleanup = maybe_build_cleanup_and_delete (object);
if (cleanup) if (cleanup)
expand_expr (cleanup, const0_rtx, VOIDmode, 0); expand_expr (cleanup, const0_rtx, VOIDmode, 0);
cleanup_insns = get_insns (); cleanup_insns = get_insns ();
...@@ -1089,7 +1089,8 @@ expand_throw (exp) ...@@ -1089,7 +1089,8 @@ expand_throw (exp)
{ {
cleanup = start_anon_func (); cleanup = start_anon_func ();
expand_expr (maybe_build_cleanup (object), const0_rtx, VOIDmode, 0); expand_expr (maybe_build_cleanup_and_delete (object),
const0_rtx, VOIDmode, 0);
end_anon_func (); end_anon_func ();
......
...@@ -15,6 +15,7 @@ __extension__, EXTENSION, NORID ...@@ -15,6 +15,7 @@ __extension__, EXTENSION, NORID
__inline, SCSPEC, RID_INLINE __inline, SCSPEC, RID_INLINE
__inline__, SCSPEC, RID_INLINE __inline__, SCSPEC, RID_INLINE
__label__, LABEL, NORID __label__, LABEL, NORID
__null, CONSTANT, RID_NULL
__signature__, AGGR, RID_SIGNATURE /* Extension */, __signature__, AGGR, RID_SIGNATURE /* Extension */,
__signed, TYPESPEC, RID_SIGNED __signed, TYPESPEC, RID_SIGNED
__signed__, TYPESPEC, RID_SIGNED __signed__, TYPESPEC, RID_SIGNED
......
...@@ -1541,9 +1541,14 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags) ...@@ -1541,9 +1541,14 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
{ {
tree rval = build_type_conversion (CONVERT_EXPR, type, init, 1); tree rval = build_type_conversion (CONVERT_EXPR, type, init, 1);
if (rval) if (flag_ansi_overloading && rval)
{
if (rval != error_mark_node)
expand_aggr_init_1 (binfo, true_exp, exp, rval, alias_this, flags);
return;
}
else if (rval)
{ {
#ifndef NEW_OVER
/* See if there is a constructor for``type'' that takes a /* See if there is a constructor for``type'' that takes a
``ttype''-typed object. */ ``ttype''-typed object. */
tree parms = build_tree_list (NULL_TREE, init); tree parms = build_tree_list (NULL_TREE, init);
...@@ -1557,9 +1562,8 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags) ...@@ -1557,9 +1562,8 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
cp_error ("ambiguity between conversion to `%T' and constructor", cp_error ("ambiguity between conversion to `%T' and constructor",
type); type);
else else
#endif if (rval != error_mark_node)
if (rval != error_mark_node) expand_aggr_init_1 (binfo, true_exp, exp, rval, alias_this, flags);
expand_aggr_init_1 (binfo, true_exp, exp, rval, alias_this, flags);
return; return;
} }
} }
......
...@@ -673,6 +673,9 @@ init_lex () ...@@ -673,6 +673,9 @@ init_lex ()
TREE_TYPE (signature_type_node) = signature_type_node; TREE_TYPE (signature_type_node) = signature_type_node;
ridpointers[(int) RID_SIGNATURE] = signature_type_node; ridpointers[(int) RID_SIGNATURE] = signature_type_node;
null_pointer_node = build_int_2 (0, 0);
ridpointers[RID_NULL] = null_pointer_node;
opname_tab[(int) COMPONENT_REF] = "->"; opname_tab[(int) COMPONENT_REF] = "->";
opname_tab[(int) MEMBER_REF] = "->*"; opname_tab[(int) MEMBER_REF] = "->*";
opname_tab[(int) METHOD_CALL_EXPR] = "->()"; opname_tab[(int) METHOD_CALL_EXPR] = "->()";
...@@ -2561,7 +2564,7 @@ do_identifier (token, parsing) ...@@ -2561,7 +2564,7 @@ do_identifier (token, parsing)
else if (IDENTIFIER_OPNAME_P (token)) else if (IDENTIFIER_OPNAME_P (token))
{ {
if (token != ansi_opname[ERROR_MARK]) if (token != ansi_opname[ERROR_MARK])
cp_error ("operator %O not defined", token); cp_error ("`%D' not defined", token);
id = error_mark_node; id = error_mark_node;
} }
else if (parsing && (yychar == '(' || yychar == LEFT_RIGHT)) else if (parsing && (yychar == '(' || yychar == LEFT_RIGHT))
......
...@@ -72,6 +72,7 @@ enum rid ...@@ -72,6 +72,7 @@ enum rid
RID_EXCEPTION, RID_EXCEPTION,
RID_TEMPLATE, RID_TEMPLATE,
RID_SIGNATURE, RID_SIGNATURE,
RID_NULL,
/* Before adding enough to get up to 64, the RIDBIT_* macros /* Before adding enough to get up to 64, the RIDBIT_* macros
will have to be changed a little. */ will have to be changed a little. */
RID_MAX RID_MAX
......
...@@ -674,7 +674,14 @@ build_overload_name (parmtypes, begin, end) ...@@ -674,7 +674,14 @@ build_overload_name (parmtypes, begin, end)
if (TREE_USED (parmtype)) if (TREE_USED (parmtype))
{ {
#if 0
/* We can turn this on at some point when we want
improved symbol mangling. */
nrepeats++;
#else
/* This is bug compatible with 2.7.x */
flush_repeats (parmtype); flush_repeats (parmtype);
#endif
goto next; goto next;
} }
...@@ -1193,9 +1200,8 @@ build_opfncall (code, flags, xarg1, xarg2, arg3) ...@@ -1193,9 +1200,8 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
int try_second; int try_second;
int binary_is_unary; int binary_is_unary;
#ifdef NEW_OVER if (flag_ansi_overloading)
return build_new_op (code, flags, xarg1, xarg2, arg3); return build_new_op (code, flags, xarg1, xarg2, arg3);
#endif
if (xarg1 == error_mark_node) if (xarg1 == error_mark_node)
return error_mark_node; return error_mark_node;
......
...@@ -1189,10 +1189,15 @@ instantiate_class_template (type) ...@@ -1189,10 +1189,15 @@ instantiate_class_template (type)
tree tmp; tree tmp;
for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp)) for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp))
if (TREE_CODE (tmp) == FIELD_DECL) if (TREE_CODE (tmp) == FIELD_DECL)
require_complete_type (tmp); {
TREE_TYPE (tmp) = complete_type (TREE_TYPE (tmp));
require_complete_type (tmp);
}
type = finish_struct_1 (type, 0); type = finish_struct_1 (type, 0);
CLASSTYPE_GOT_SEMICOLON (type) = 1; CLASSTYPE_GOT_SEMICOLON (type) = 1;
if (at_eof && TYPE_BINFO_VTABLE (type) != NULL_TREE)
finish_prevtable_vardecl (NULL, TYPE_BINFO_VTABLE (type));
repo_template_used (type); repo_template_used (type);
} }
...@@ -2707,13 +2712,11 @@ unify (tparms, targs, ntparms, parm, arg, nsubsts, strict) ...@@ -2707,13 +2712,11 @@ unify (tparms, targs, ntparms, parm, arg, nsubsts, strict)
if (CLASSTYPE_TEMPLATE_INFO (parm) && uses_template_parms (parm)) if (CLASSTYPE_TEMPLATE_INFO (parm) && uses_template_parms (parm))
{ {
tree t = NULL_TREE; tree t = NULL_TREE;
#ifdef NEW_OVER if (flag_ansi_overloading && ! strict)
if (! strict)
t = get_template_base (CLASSTYPE_TI_TEMPLATE (parm), arg); t = get_template_base (CLASSTYPE_TI_TEMPLATE (parm), arg);
else else if
#endif (CLASSTYPE_TEMPLATE_INFO (arg)
if (CLASSTYPE_TEMPLATE_INFO (arg) && CLASSTYPE_TI_TEMPLATE (parm) == CLASSTYPE_TI_TEMPLATE (arg))
&& CLASSTYPE_TI_TEMPLATE (parm) == CLASSTYPE_TI_TEMPLATE (arg))
t = arg; t = arg;
if (! t || t == error_mark_node) if (! t || t == error_mark_node)
return 1; return 1;
......
...@@ -3087,8 +3087,8 @@ build_mi_matrix (type) ...@@ -3087,8 +3087,8 @@ build_mi_matrix (type)
dfs_walk (binfo, dfs_number, unnumberedp); dfs_walk (binfo, dfs_number, unnumberedp);
mi_size = CLASSTYPE_N_SUPERCLASSES (type) + CLASSTYPE_N_VBASECLASSES (type); mi_size = CLASSTYPE_N_SUPERCLASSES (type) + CLASSTYPE_N_VBASECLASSES (type);
if (mi_size < cid) if (mi_size < (cid-1))
mi_size = cid; mi_size = cid-1;
mi_matrix = (char *)xmalloc ((mi_size + 1) * (mi_size + 1)); mi_matrix = (char *)xmalloc ((mi_size + 1) * (mi_size + 1));
mi_type = type; mi_type = type;
bzero (mi_matrix, (mi_size + 1) * (mi_size + 1)); bzero (mi_matrix, (mi_size + 1) * (mi_size + 1));
...@@ -3551,6 +3551,7 @@ add_conversions (binfo) ...@@ -3551,6 +3551,7 @@ add_conversions (binfo)
break; break;
conversions = tree_cons (binfo, tmp, conversions); conversions = tree_cons (binfo, tmp, conversions);
} }
SET_BINFO_MARKED (binfo);
} }
tree tree
...@@ -3559,7 +3560,10 @@ lookup_conversions (type) ...@@ -3559,7 +3560,10 @@ lookup_conversions (type)
{ {
conversions = NULL_TREE; conversions = NULL_TREE;
if (TYPE_SIZE (type)) if (TYPE_SIZE (type))
dfs_walk (TYPE_BINFO (type), add_conversions, 0); {
dfs_walk (TYPE_BINFO (type), add_conversions, unmarkedp);
dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp);
}
return conversions; return conversions;
} }
......
...@@ -135,6 +135,10 @@ complete_type (type) ...@@ -135,6 +135,10 @@ complete_type (type)
if (TYPE_SIZE (t) != NULL_TREE if (TYPE_SIZE (t) != NULL_TREE
&& current_template_parms == NULL_TREE) && current_template_parms == NULL_TREE)
layout_type (type); layout_type (type);
TYPE_NEEDS_CONSTRUCTING (type)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t));
TYPE_NEEDS_DESTRUCTOR (type)
= TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (t));
} }
else if (IS_AGGR_TYPE (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type)) else if (IS_AGGR_TYPE (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
instantiate_class_template (TYPE_MAIN_VARIANT (type)); instantiate_class_template (TYPE_MAIN_VARIANT (type));
...@@ -771,7 +775,7 @@ comptypes (type1, type2, strict) ...@@ -771,7 +775,7 @@ comptypes (type1, type2, strict)
{ {
int rval; int rval;
look_hard: look_hard:
rval = t1 == t2 || UNIQUELY_DERIVED_FROM_P (t1, t2); rval = t1 == t2 || DERIVED_FROM_P (t1, t2);
if (rval) if (rval)
{ {
...@@ -780,7 +784,7 @@ comptypes (type1, type2, strict) ...@@ -780,7 +784,7 @@ comptypes (type1, type2, strict)
} }
if (strict < 0) if (strict < 0)
{ {
val = UNIQUELY_DERIVED_FROM_P (t2, t1); val = DERIVED_FROM_P (t2, t1);
break; break;
} }
} }
...@@ -2239,8 +2243,12 @@ build_x_function_call (function, params, decl) ...@@ -2239,8 +2243,12 @@ build_x_function_call (function, params, decl)
/* Handle methods, friends, and overloaded functions, respectively. */ /* Handle methods, friends, and overloaded functions, respectively. */
if (is_method) if (is_method)
{ {
tree basetype = NULL_TREE;
if (TREE_CODE (function) == FUNCTION_DECL) if (TREE_CODE (function) == FUNCTION_DECL)
{ {
basetype = DECL_CLASS_CONTEXT (function);
if (DECL_NAME (function)) if (DECL_NAME (function))
function = DECL_NAME (function); function = DECL_NAME (function);
else else
...@@ -2249,6 +2257,7 @@ build_x_function_call (function, params, decl) ...@@ -2249,6 +2257,7 @@ build_x_function_call (function, params, decl)
else if (TREE_CODE (function) == TREE_LIST) else if (TREE_CODE (function) == TREE_LIST)
{ {
my_friendly_assert (TREE_CODE (TREE_VALUE (function)) == FUNCTION_DECL, 312); my_friendly_assert (TREE_CODE (TREE_VALUE (function)) == FUNCTION_DECL, 312);
basetype = DECL_CLASS_CONTEXT (TREE_VALUE (function));
function = TREE_PURPOSE (function); function = TREE_PURPOSE (function);
} }
else if (TREE_CODE (function) != IDENTIFIER_NODE) else if (TREE_CODE (function) != IDENTIFIER_NODE)
...@@ -2276,6 +2285,10 @@ build_x_function_call (function, params, decl) ...@@ -2276,6 +2285,10 @@ build_x_function_call (function, params, decl)
must go through here in case it is a virtual function. must go through here in case it is a virtual function.
@@ Perhaps this could be optimized. */ @@ Perhaps this could be optimized. */
if (basetype && (! current_class_type
|| ! DERIVED_FROM_P (basetype, current_class_type)))
return build_member_call (basetype, function, params);
if (decl == NULL_TREE) if (decl == NULL_TREE)
{ {
if (current_class_type == NULL_TREE) if (current_class_type == NULL_TREE)
...@@ -2315,11 +2328,11 @@ build_x_function_call (function, params, decl) ...@@ -2315,11 +2328,11 @@ build_x_function_call (function, params, decl)
} }
else else
{ {
#ifdef NEW_OVER
return build_new_function_call (function, params, NULL_TREE);
#else
tree val = TREE_VALUE (function); tree val = TREE_VALUE (function);
if (flag_ansi_overloading)
return build_new_function_call (function, params, NULL_TREE);
if (TREE_CODE (val) == TEMPLATE_DECL) if (TREE_CODE (val) == TEMPLATE_DECL)
return build_overload_call_real return build_overload_call_real
(function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0); (function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0);
...@@ -2328,7 +2341,6 @@ build_x_function_call (function, params, decl) ...@@ -2328,7 +2341,6 @@ build_x_function_call (function, params, decl)
(function, params, LOOKUP_COMPLAIN); (function, params, LOOKUP_COMPLAIN);
else else
my_friendly_abort (360); my_friendly_abort (360);
#endif
} }
} }
...@@ -2628,6 +2640,8 @@ build_function_call_real (function, params, require_complete, flags) ...@@ -2628,6 +2640,8 @@ build_function_call_real (function, params, require_complete, flags)
return result; return result;
result = require_complete_type (result); result = require_complete_type (result);
} }
if (IS_AGGR_TYPE (value_type))
result = build_cplus_new (value_type, result);
return convert_from_reference (result); return convert_from_reference (result);
} }
} }
...@@ -2899,6 +2913,9 @@ build_x_binary_op (code, arg1, arg2) ...@@ -2899,6 +2913,9 @@ build_x_binary_op (code, arg1, arg2)
if (current_template_parms) if (current_template_parms)
return build_min_nt (code, arg1, arg2); return build_min_nt (code, arg1, arg2);
if (flag_ansi_overloading)
return build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE);
rval = build_opfncall (code, LOOKUP_SPECULATIVELY, rval = build_opfncall (code, LOOKUP_SPECULATIVELY,
arg1, arg2, NULL_TREE); arg1, arg2, NULL_TREE);
if (rval) if (rval)
...@@ -3955,11 +3972,23 @@ build_x_unary_op (code, xarg) ...@@ -3955,11 +3972,23 @@ build_x_unary_op (code, xarg)
/* don't look for a function */; /* don't look for a function */;
else else
{ {
tree rval = build_opfncall (code, LOOKUP_SPECULATIVELY, xarg, tree rval;
NULL_TREE, NULL_TREE);
if (rval) if (flag_ansi_overloading)
return build_opfncall (code, LOOKUP_NORMAL, xarg, {
rval = build_new_op (code, LOOKUP_NORMAL, xarg,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
if (rval || code != ADDR_EXPR)
return rval;
}
else
{
rval = build_opfncall (code, LOOKUP_SPECULATIVELY, xarg,
NULL_TREE, NULL_TREE);
if (rval)
return build_opfncall (code, LOOKUP_NORMAL, xarg,
NULL_TREE, NULL_TREE);
}
} }
if (code == ADDR_EXPR) if (code == ADDR_EXPR)
...@@ -4629,6 +4658,9 @@ build_x_conditional_expr (ifexp, op1, op2) ...@@ -4629,6 +4658,9 @@ build_x_conditional_expr (ifexp, op1, op2)
if (current_template_parms) if (current_template_parms)
return build_min_nt (COND_EXPR, ifexp, op1, op2); return build_min_nt (COND_EXPR, ifexp, op1, op2);
if (flag_ansi_overloading)
return build_new_op (COND_EXPR, LOOKUP_NORMAL, ifexp, op1, op2);
/* See comments in `build_x_binary_op'. */ /* See comments in `build_x_binary_op'. */
if (op1 != 0) if (op1 != 0)
rval = build_opfncall (COND_EXPR, LOOKUP_SPECULATIVELY, ifexp, op1, op2); rval = build_opfncall (COND_EXPR, LOOKUP_SPECULATIVELY, ifexp, op1, op2);
...@@ -4723,6 +4755,15 @@ build_conditional_expr (ifexp, op1, op2) ...@@ -4723,6 +4755,15 @@ build_conditional_expr (ifexp, op1, op2)
result = fold (build (COND_EXPR, type1, ifexp, op1, op2)); result = fold (build (COND_EXPR, type1, ifexp, op1, op2));
if (TREE_TYPE (result) != type1) if (TREE_TYPE (result) != type1)
result = build1 (NOP_EXPR, type1, result); result = build1 (NOP_EXPR, type1, result);
/* Expand both sides into the same slot,
hopefully the target of the ?: expression. */
if (TREE_CODE (op1) == TARGET_EXPR && TREE_CODE (op2) == TARGET_EXPR)
{
tree slot = build (VAR_DECL, TREE_TYPE (result));
layout_decl (slot, 0);
result = build (TARGET_EXPR, TREE_TYPE (result),
slot, result, NULL_TREE, NULL_TREE);
}
return result; return result;
} }
...@@ -6093,12 +6134,7 @@ build_ptrmemfunc (type, pfn, force) ...@@ -6093,12 +6134,7 @@ build_ptrmemfunc (type, pfn, force)
if (TREE_CODE (pfn) == TREE_LIST if (TREE_CODE (pfn) == TREE_LIST
|| (TREE_CODE (pfn) == ADDR_EXPR || (TREE_CODE (pfn) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (pfn, 0)) == TREE_LIST)) && TREE_CODE (TREE_OPERAND (pfn, 0)) == TREE_LIST))
{ return instantiate_type (type, pfn, 1);
pfn = instantiate_type (type, pfn, 1);
if (pfn == error_mark_node)
return error_mark_node;
pfn = build_addr_func (pfn);
}
/* Allow pointer to member conversions here. */ /* Allow pointer to member conversions here. */
delta = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TREE_TYPE (pfn))), delta = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TREE_TYPE (pfn))),
...@@ -6354,7 +6390,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) ...@@ -6354,7 +6390,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
if (TYPE_MAIN_VARIANT (ttl) != void_type_node if (TYPE_MAIN_VARIANT (ttl) != void_type_node
&& TYPE_MAIN_VARIANT (ttr) == void_type_node && TYPE_MAIN_VARIANT (ttr) == void_type_node
&& rhs != null_pointer_node) && ! null_ptr_cst_p (rhs))
{ {
if (coder == RECORD_TYPE) if (coder == RECORD_TYPE)
cp_pedwarn ("implicit conversion of signature pointer to type `%T'", cp_pedwarn ("implicit conversion of signature pointer to type `%T'",
...@@ -6545,9 +6581,8 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) ...@@ -6545,9 +6581,8 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
else else
cp_pedwarn ("%s to `%T' from `%T' lacks a cast", cp_pedwarn ("%s to `%T' from `%T' lacks a cast",
errtype, type, rhstype); errtype, type, rhstype);
return convert (type, rhs);
} }
return null_pointer_node; return convert (type, rhs);
} }
else if (codel == INTEGER_TYPE else if (codel == INTEGER_TYPE
&& (coder == POINTER_TYPE && (coder == POINTER_TYPE
......
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