[C++ Patch]: obsolete code
Nathan Sidwell
nathan@codesourcery.com
Mon Jul 17 03:53:00 GMT 2000
Hi,
In preparation for dealing with the `extern "C" void foo ()' problem,
I came across some obsolete code. comp_target_parms is always called
with STRICT == 1. (Maybe this patch'll help that routine evaporate
entirely :-)
built & tested on i686-pc-linux-gnu
ok?
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-07-17 Nathan Sidwell <nathan@codesourcery.com>
* typeck.c (comp_target_parms): Remove obsolete parameter.
(comp_target_types): Adjust.
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/typeck.c,v
retrieving revision 1.297
diff -c -3 -p -r1.297 typeck.c
*** typeck.c 2000/07/10 07:16:23 1.297
--- typeck.c 2000/07/17 10:47:41
*************** static tree convert_for_assignment PARAM
*** 46,52 ****
int));
static tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
static tree rationalize_conditional_expr PARAMS ((enum tree_code, tree));
! static int comp_target_parms PARAMS ((tree, tree, int));
static int comp_ptr_ttypes_real PARAMS ((tree, tree, int));
static int comp_ptr_ttypes_const PARAMS ((tree, tree));
static int comp_ptr_ttypes_reinterpret PARAMS ((tree, tree));
--- 46,52 ----
int));
static tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
static tree rationalize_conditional_expr PARAMS ((enum tree_code, tree));
! static int comp_target_parms PARAMS ((tree, tree));
static int comp_ptr_ttypes_real PARAMS ((tree, tree, int));
static int comp_ptr_ttypes_const PARAMS ((tree, tree));
static int comp_ptr_ttypes_reinterpret PARAMS ((tree, tree));
*************** comp_target_types (ttl, ttr, nptrs)
*** 1251,1257 ****
argsr = TREE_CHAIN (argsr);
}
! switch (comp_target_parms (argsl, argsr, 1))
{
case 0:
return 0;
--- 1251,1257 ----
argsr = TREE_CHAIN (argsr);
}
! switch (comp_target_parms (argsl, argsr))
{
case 0:
return 0;
*************** compparms (parms1, parms2)
*** 1472,1480 ****
(jason 17 Apr 1997) */
static int
! comp_target_parms (parms1, parms2, strict)
tree parms1, parms2;
- int strict;
{
register tree t1 = parms1, t2 = parms2;
int warn_contravariance = 0;
--- 1472,1479 ----
(jason 17 Apr 1997) */
static int
! comp_target_parms (parms1, parms2)
tree parms1, parms2;
{
register tree t1 = parms1, t2 = parms2;
int warn_contravariance = 0;
*************** comp_target_parms (parms1, parms2, stric
*** 1504,1516 ****
/* If one parmlist is shorter than the other,
they fail to match, unless STRICT is <= 0. */
if (t1 == 0 || t2 == 0)
! {
! if (strict > 0)
! return 0;
! if (strict < 0)
! return 1 + warn_contravariance;
! return ((t1 && TREE_PURPOSE (t1)) + warn_contravariance);
! }
p1 = TREE_VALUE (t1);
p2 = TREE_VALUE (t2);
if (same_type_p (p1, p2))
--- 1503,1509 ----
/* If one parmlist is shorter than the other,
they fail to match, unless STRICT is <= 0. */
if (t1 == 0 || t2 == 0)
! return 0;
p1 = TREE_VALUE (t1);
p2 = TREE_VALUE (t2);
if (same_type_p (p1, p2))
*************** comp_target_parms (parms1, parms2, stric
*** 1523,1533 ****
|| (TREE_CODE (p1) == REFERENCE_TYPE
&& TREE_CODE (p2) == REFERENCE_TYPE))
{
- if (strict <= 0
- && (TYPE_MAIN_VARIANT (TREE_TYPE (p1))
- == TYPE_MAIN_VARIANT (TREE_TYPE (p2))))
- continue;
-
/* The following is wrong for contravariance,
but many programs depend on it. */
if (TREE_TYPE (p1) == void_type_node)
--- 1516,1521 ----
*************** comp_target_parms (parms1, parms2, stric
*** 1550,1557 ****
warn_contravariance = 1;
continue;
}
! if (strict != 0)
! return 0;
}
}
return warn_contravariance ? -1 : 1;
--- 1538,1544 ----
warn_contravariance = 1;
continue;
}
! return 0;
}
}
return warn_contravariance ? -1 : 1;
More information about the Gcc-patches
mailing list