aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMike Stump <mrs@gcc.gnu.org>1996-05-17 17:08:27 +0000
committerMike Stump <mrs@gcc.gnu.org>1996-05-17 17:08:27 +0000
commitce122a86188dc56eaf70488215b52b3dbc22bbce (patch)
tree59ea69ac1a94bb1aa0024e358f2e3c91cc814c5c /gcc
parent5f2d9b40eb904ff871e398356fd949a7fd06ade7 (diff)
downloadgcc-ce122a86188dc56eaf70488215b52b3dbc22bbce.zip
gcc-ce122a86188dc56eaf70488215b52b3dbc22bbce.tar.gz
gcc-ce122a86188dc56eaf70488215b52b3dbc22bbce.tar.bz2
86th Cygnus<->FSF quick merge
From-SVN: r12008
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog25
-rw-r--r--gcc/cp/call.c113
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/expr.c3
-rw-r--r--gcc/cp/method.c9
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/cp/typeck.c4
7 files changed, 85 insertions, 74 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4b4c2b8..f0dd601 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
(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>
* call.c (build_method_call): Allow implicit & on METHOD_TYPEs,
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f51d09b..6e2132d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1584,6 +1584,36 @@ build_call (function, result_type, parms)
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)
or object.method (args). This can also build
@@ -1988,35 +2018,10 @@ build_method_call (instance, name, parms, basetype_path, flags)
save_basetype = TYPE_MAIN_VARIANT (basetype);
- last = NULL_TREE;
- for (parmtypes = NULL_TREE, parm = parms; parm; parm = TREE_CHAIN (parm))
+ parmtypes = default_parm_conversions (parms, &last);
+ if (parmtypes == error_mark_node)
{
- tree t = TREE_TYPE (TREE_VALUE (parm));
- 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);
+ return error_mark_node;
}
if (instance && IS_SIGNATURE (basetype))
@@ -2146,7 +2151,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
cp->harshness = (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
(it was probably a friend function), the return the
@@ -2429,14 +2434,16 @@ build_method_call (instance, name, parms, basetype_path, flags)
&& value_member (function, get_abstract_virtuals (basetype)))
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",
- basetype, save_name);
- return error_mark_node;
+ if (static_call_context)
+ {
+ 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);
mark_used (function);
@@ -2632,7 +2639,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
{
/* must check for overloading here */
tree functions, function, parm;
- tree parmtypes = NULL_TREE, last = NULL_TREE;
+ tree parmtypes, last;
register tree outer;
int length;
int parmlength = list_length (parms);
@@ -2648,31 +2655,14 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
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 (t == 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 (final_cp)
+ final_cp->h.code = EVIL_CODE;
+ return error_mark_node;
}
+
if (last)
TREE_CHAIN (last) = void_list_node;
else
@@ -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. */
tree
-build_overload_call (fnname, parms, flags, final_cp)
+build_overload_call (fnname, parms, flags)
tree fnname, parms;
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);
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index cb850e0..a1d59d6 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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_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 PROTO((tree, tree, int, struct candidate *));
+extern tree build_overload_call PROTO((tree, tree, int));
/* in class.c */
extern tree build_vbase_pointer PROTO((tree, tree));
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index 7411a4e..343246f 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -374,7 +374,8 @@ do_case (start, end)
{
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");
if (end && pedantic)
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 79761e9..3214923 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1233,8 +1233,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
tree args = tree_cons (NULL_TREE, xarg2, arg3);
fnname = ansi_opname[(int) code];
if (flags & LOOKUP_GLOBAL)
- return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN,
- (struct candidate *)0);
+ return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN);
rval = build_method_call
(build_indirect_ref (build1 (NOP_EXPR, xarg1, error_mark_node),
@@ -1258,8 +1257,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
if (flags & LOOKUP_GLOBAL)
return build_overload_call (fnname,
build_tree_list (NULL_TREE, xarg1),
- flags & LOOKUP_COMPLAIN,
- (struct candidate *)0);
+ flags & LOOKUP_COMPLAIN);
arg1 = TREE_TYPE (xarg1);
/* This handles the case where we're trying to delete
@@ -1481,8 +1479,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
{
parms = tree_cons (NULL_TREE, xarg1,
build_tree_list (NULL_TREE, xarg2));
- rval = build_overload_call (fnname, parms, flags,
- (struct candidate *)0);
+ rval = build_overload_call (fnname, parms, flags);
}
return rval;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0addffd..536e6c6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1182,8 +1182,7 @@ instantiate_class_template (type)
{
tree tmp;
for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp))
- if (TREE_CODE (tmp) == FIELD_DECL
- && TREE_CODE (DECL_NAME (tmp)) != SCOPE_REF)
+ if (TREE_CODE (tmp) == FIELD_DECL)
require_complete_type (tmp);
/* XXX handle attributes */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 507150c..e1fac0d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1430,7 +1430,7 @@ decay_conversion (exp)
register tree type = TREE_TYPE (exp);
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)
return decay_conversion (resolve_offset_ref (exp));
@@ -2370,7 +2370,7 @@ build_x_function_call (function, params, decl)
(function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0);
else if (DECL_CHAIN (val) != NULL_TREE)
return build_overload_call
- (function, params, LOOKUP_COMPLAIN, (struct candidate *)0);
+ (function, params, LOOKUP_COMPLAIN);
else
my_friendly_abort (360);
}