Commit ce122a86 by Mike Stump

86th Cygnus<->FSF quick merge

From-SVN: r12008
parent 5f2d9b40
...@@ -3,6 +3,31 @@ Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com> ...@@ -3,6 +3,31 @@ Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com>
* decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef. * decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
(finish_file): Likewise. (finish_file): Likewise.
Thu May 16 15:29:33 1996 Bob Manson <manson@charmed.cygnus.com>
* expr.c (do_case): Don't try to dereference null TREE_TYPEs
when checking for pointer types.
Thu May 16 13:38:58 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (instantiate_class_template): Remove obsolete check for
access declarations.
Thu May 16 13:34:15 1996 Mike Stump <mrs@cygnus.com>
* call.c (build_overload_call): Simplify calls to
build_overload_call by removing last parameter.
(build_method_call): Ditto.
* cp-tree.h: Ditto.
* method.c (build_opfncall): Ditto.
* typeck.c (build_x_function_call): Ditto.
Thu May 16 13:15:43 1996 Mike Stump <mrs@cygnus.com>
* call.c (default_parm_conversions): Factor out common code.
(build_method_call): Use it.
(build_overload_call_real): Use it.
Wed May 15 14:46:14 1996 Mike Stump <mrs@cygnus.com> Wed May 15 14:46:14 1996 Mike Stump <mrs@cygnus.com>
* call.c (build_method_call): Allow implicit & on METHOD_TYPEs, * call.c (build_method_call): Allow implicit & on METHOD_TYPEs,
......
...@@ -1584,6 +1584,36 @@ build_call (function, result_type, parms) ...@@ -1584,6 +1584,36 @@ build_call (function, result_type, parms)
return function; return function;
} }
static tree
default_parm_conversions (parms, last)
tree parms, *last;
{
tree parm, parmtypes = NULL_TREE;
*last = NULL_TREE;
for (parm = parms; parm; parm = TREE_CHAIN (parm))
{
tree t = TREE_TYPE (TREE_VALUE (parm));
if (TREE_CODE (t) == OFFSET_TYPE
|| TREE_CODE (t) == METHOD_TYPE
|| TREE_CODE (t) == FUNCTION_TYPE)
{
TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
t = TREE_TYPE (TREE_VALUE (parm));
}
if (t == error_mark_node)
return error_mark_node;
*last = build_tree_list (NULL_TREE, t);
parmtypes = chainon (parmtypes, *last);
}
return parmtypes;
}
/* Build something of the form ptr->method (args) /* Build something of the form ptr->method (args)
or object.method (args). This can also build or object.method (args). This can also build
...@@ -1988,35 +2018,10 @@ build_method_call (instance, name, parms, basetype_path, flags) ...@@ -1988,35 +2018,10 @@ build_method_call (instance, name, parms, basetype_path, flags)
save_basetype = TYPE_MAIN_VARIANT (basetype); save_basetype = TYPE_MAIN_VARIANT (basetype);
last = NULL_TREE; parmtypes = default_parm_conversions (parms, &last);
for (parmtypes = NULL_TREE, parm = parms; parm; parm = TREE_CHAIN (parm)) if (parmtypes == error_mark_node)
{ {
tree t = TREE_TYPE (TREE_VALUE (parm)); return error_mark_node;
if (TREE_CODE (t) == OFFSET_TYPE)
{
/* Convert OFFSET_TYPE entities to their normal selves. */
TREE_VALUE (parm) = resolve_offset_ref (TREE_VALUE (parm));
t = TREE_TYPE (TREE_VALUE (parm));
}
if (TREE_CODE (t) == METHOD_TYPE)
{
cp_pedwarn ("assuming & on `%E'", TREE_VALUE (parm));
TREE_VALUE (parm) = build_unary_op (ADDR_EXPR, TREE_VALUE (parm), 0);
}
#if 0
/* This breaks reference-to-array parameters. */
if (TREE_CODE (t) == ARRAY_TYPE)
{
/* Perform the conversion from ARRAY_TYPE to POINTER_TYPE in place.
This eliminates needless calls to `compute_conversion_costs'. */
TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
t = TREE_TYPE (TREE_VALUE (parm));
}
#endif
if (t == error_mark_node)
return error_mark_node;
last = build_tree_list (NULL_TREE, t);
parmtypes = chainon (parmtypes, last);
} }
if (instance && IS_SIGNATURE (basetype)) if (instance && IS_SIGNATURE (basetype))
...@@ -2146,7 +2151,7 @@ build_method_call (instance, name, parms, basetype_path, flags) ...@@ -2146,7 +2151,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
cp->harshness = (struct harshness_code *) cp->harshness = (struct harshness_code *)
alloca ((len + 1) * sizeof (struct harshness_code)); alloca ((len + 1) * sizeof (struct harshness_code));
result = build_overload_call (name, friend_parms, 0, cp); result = build_overload_call_real (name, friend_parms, 0, cp, 1);
/* If it turns out to be the one we were actually looking for /* If it turns out to be the one we were actually looking for
(it was probably a friend function), the return the (it was probably a friend function), the return the
...@@ -2429,14 +2434,16 @@ build_method_call (instance, name, parms, basetype_path, flags) ...@@ -2429,14 +2434,16 @@ build_method_call (instance, name, parms, basetype_path, flags)
&& value_member (function, get_abstract_virtuals (basetype))) && value_member (function, get_abstract_virtuals (basetype)))
cp_error ("abstract virtual `%#D' called from constructor", function); cp_error ("abstract virtual `%#D' called from constructor", function);
if (IS_SIGNATURE (basetype) && static_call_context) if (IS_SIGNATURE (basetype))
{ {
cp_error ("cannot call signature member function `%T::%D' without signature pointer/reference", if (static_call_context)
basetype, save_name); {
return error_mark_node; cp_error ("cannot call signature member function `%T::%D' without signature pointer/reference",
basetype, save_name);
return error_mark_node;
} }
else if (IS_SIGNATURE (basetype)) return build_signature_method_call (basetype, instance, function, parms);
return build_signature_method_call (basetype, instance, function, parms); }
function = DECL_MAIN_VARIANT (function); function = DECL_MAIN_VARIANT (function);
mark_used (function); mark_used (function);
...@@ -2632,7 +2639,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete) ...@@ -2632,7 +2639,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
{ {
/* must check for overloading here */ /* must check for overloading here */
tree functions, function, parm; tree functions, function, parm;
tree parmtypes = NULL_TREE, last = NULL_TREE; tree parmtypes, last;
register tree outer; register tree outer;
int length; int length;
int parmlength = list_length (parms); int parmlength = list_length (parms);
...@@ -2648,31 +2655,14 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete) ...@@ -2648,31 +2655,14 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
final_cp[1].h.code = EVIL_CODE; final_cp[1].h.code = EVIL_CODE;
} }
for (parm = parms; parm; parm = TREE_CHAIN (parm)) parmtypes = default_parm_conversions (parms, &last);
if (parmtypes == error_mark_node)
{ {
register tree t = TREE_TYPE (TREE_VALUE (parm)); if (final_cp)
final_cp->h.code = EVIL_CODE;
if (t == error_mark_node) return error_mark_node;
{
if (final_cp)
final_cp->h.code = EVIL_CODE;
return error_mark_node;
}
if (TREE_CODE (t) == OFFSET_TYPE)
#if 0
/* This breaks reference-to-array parameters. */
|| TREE_CODE (t) == ARRAY_TYPE
#endif
{
/* Perform the conversion from ARRAY_TYPE to POINTER_TYPE in place.
Also convert OFFSET_TYPE entities to their normal selves.
This eliminates needless calls to `compute_conversion_costs'. */
TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
t = TREE_TYPE (TREE_VALUE (parm));
}
last = build_tree_list (NULL_TREE, t);
parmtypes = chainon (parmtypes, last);
} }
if (last) if (last)
TREE_CHAIN (last) = void_list_node; TREE_CHAIN (last) = void_list_node;
else else
...@@ -2891,10 +2881,9 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete) ...@@ -2891,10 +2881,9 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
/* This requires a complete type on the result of the call. */ /* This requires a complete type on the result of the call. */
tree tree
build_overload_call (fnname, parms, flags, final_cp) build_overload_call (fnname, parms, flags)
tree fnname, parms; tree fnname, parms;
int flags; int flags;
struct candidate *final_cp;
{ {
return build_overload_call_real (fnname, parms, flags, final_cp, 1); return build_overload_call_real (fnname, parms, flags, (struct candidate *)0, 1);
} }
...@@ -1944,7 +1944,7 @@ extern tree build_addr_func PROTO((tree)); ...@@ -1944,7 +1944,7 @@ extern tree build_addr_func PROTO((tree));
extern tree build_scoped_method_call PROTO((tree, tree, tree, tree)); 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, struct candidate *)); extern tree build_overload_call PROTO((tree, tree, int));
/* in class.c */ /* in class.c */
extern tree build_vbase_pointer PROTO((tree, tree)); extern tree build_vbase_pointer PROTO((tree, tree));
......
...@@ -374,7 +374,8 @@ do_case (start, end) ...@@ -374,7 +374,8 @@ do_case (start, end)
{ {
tree value1 = NULL_TREE, value2 = NULL_TREE, label; tree value1 = NULL_TREE, value2 = NULL_TREE, label;
if (start && POINTER_TYPE_P (TREE_TYPE (start))) if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
&& POINTER_TYPE_P (TREE_TYPE (start)))
error ("pointers are not permitted as case values"); error ("pointers are not permitted as case values");
if (end && pedantic) if (end && pedantic)
......
...@@ -1233,8 +1233,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3) ...@@ -1233,8 +1233,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
tree args = tree_cons (NULL_TREE, xarg2, arg3); tree args = tree_cons (NULL_TREE, xarg2, arg3);
fnname = ansi_opname[(int) code]; fnname = ansi_opname[(int) code];
if (flags & LOOKUP_GLOBAL) if (flags & LOOKUP_GLOBAL)
return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN, return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN);
(struct candidate *)0);
rval = build_method_call rval = build_method_call
(build_indirect_ref (build1 (NOP_EXPR, xarg1, error_mark_node), (build_indirect_ref (build1 (NOP_EXPR, xarg1, error_mark_node),
...@@ -1258,8 +1257,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3) ...@@ -1258,8 +1257,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
if (flags & LOOKUP_GLOBAL) if (flags & LOOKUP_GLOBAL)
return build_overload_call (fnname, return build_overload_call (fnname,
build_tree_list (NULL_TREE, xarg1), build_tree_list (NULL_TREE, xarg1),
flags & LOOKUP_COMPLAIN, flags & LOOKUP_COMPLAIN);
(struct candidate *)0);
arg1 = TREE_TYPE (xarg1); arg1 = TREE_TYPE (xarg1);
/* This handles the case where we're trying to delete /* This handles the case where we're trying to delete
...@@ -1481,8 +1479,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3) ...@@ -1481,8 +1479,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
{ {
parms = tree_cons (NULL_TREE, xarg1, parms = tree_cons (NULL_TREE, xarg1,
build_tree_list (NULL_TREE, xarg2)); build_tree_list (NULL_TREE, xarg2));
rval = build_overload_call (fnname, parms, flags, rval = build_overload_call (fnname, parms, flags);
(struct candidate *)0);
} }
return rval; return rval;
......
...@@ -1182,8 +1182,7 @@ instantiate_class_template (type) ...@@ -1182,8 +1182,7 @@ 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)
&& TREE_CODE (DECL_NAME (tmp)) != SCOPE_REF)
require_complete_type (tmp); require_complete_type (tmp);
/* XXX handle attributes */ /* XXX handle attributes */
......
...@@ -1430,7 +1430,7 @@ decay_conversion (exp) ...@@ -1430,7 +1430,7 @@ decay_conversion (exp)
register tree type = TREE_TYPE (exp); register tree type = TREE_TYPE (exp);
register enum tree_code code = TREE_CODE (type); register enum tree_code code = TREE_CODE (type);
if (code == OFFSET_TYPE /* || TREE_CODE (exp) == OFFSET_REF */ ) if (code == OFFSET_TYPE)
{ {
if (TREE_CODE (exp) == OFFSET_REF) if (TREE_CODE (exp) == OFFSET_REF)
return decay_conversion (resolve_offset_ref (exp)); return decay_conversion (resolve_offset_ref (exp));
...@@ -2370,7 +2370,7 @@ build_x_function_call (function, params, decl) ...@@ -2370,7 +2370,7 @@ build_x_function_call (function, params, decl)
(function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0); (function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0);
else if (DECL_CHAIN (val) != NULL_TREE) else if (DECL_CHAIN (val) != NULL_TREE)
return build_overload_call return build_overload_call
(function, params, LOOKUP_COMPLAIN, (struct candidate *)0); (function, params, LOOKUP_COMPLAIN);
else else
my_friendly_abort (360); my_friendly_abort (360);
} }
......
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