Commit acd8e2d0 by Nathan Sidwell Committed by Nathan Sidwell

cp-tree.h (comp_except_specs, [...]): Return bool.

	* cp-tree.h (comp_except_specs, compparms, cp_has_mutable_p,
	at_least_as_qualified_p, more_qualified_p): Return bool.
	* typeck.c: ANSIFY function definitions.
	(comp_array_types): Take redeclaration bool parameter.
	(comptypes): Rearrange STRICT handling.
	(at_least_as_qualified_p, more_qualified_p,
	comp_cv_qualification): Cache cv quals.
	(compparms): Rearrange loop.

From-SVN: r68164
parent b82a33d2
2003-06-18 Nathan Sidwell <nathan@codesourcery.com> 2003-06-18 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (comp_except_specs, compparms, cp_has_mutable_p,
at_least_as_qualified_p, more_qualified_p): Return bool.
* typeck.c: ANSIFY function definitions.
(comp_array_types): Take redeclaration bool parameter.
(comptypes): Rearrange STRICT handling.
(at_least_as_qualified_p, more_qualified_p,
comp_cv_qualification): Cache cv quals.
(compparms): Rearrange loop.
2003-06-18 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (COMPARE_RELAXED): Rename to ... * cp-tree.h (COMPARE_RELAXED): Rename to ...
(COMPARE_DERIVED): ... here. Adjust comment. (COMPARE_DERIVED): ... here. Adjust comment.
(resolve_typename_type_in_current_instantiation): Remove. (resolve_typename_type_in_current_instantiation): Remove.
......
...@@ -3796,11 +3796,11 @@ extern void cp_warning_at (const char *msgid, ...); ...@@ -3796,11 +3796,11 @@ extern void cp_warning_at (const char *msgid, ...);
extern void cp_pedwarn_at (const char *msgid, ...); extern void cp_pedwarn_at (const char *msgid, ...);
/* XXX Not i18n clean. */ /* XXX Not i18n clean. */
#define cp_deprecated(STR) \ #define cp_deprecated(STR) \
do { \ do { \
if (warn_deprecated) \ if (warn_deprecated) \
warning ("%s is deprecated, please see the documentation for details", \ warning ("%s is deprecated, please see the documentation for details", \
(STR)); \ (STR)); \
} while (0) } while (0)
/* in error.c */ /* in error.c */
...@@ -4239,10 +4239,10 @@ extern tree complete_type_or_diagnostic (tree, tree, int); ...@@ -4239,10 +4239,10 @@ extern tree complete_type_or_diagnostic (tree, tree, int);
extern int type_unknown_p (tree); extern int type_unknown_p (tree);
extern tree commonparms (tree, tree); extern tree commonparms (tree, tree);
extern tree original_type (tree); extern tree original_type (tree);
extern int comp_except_specs (tree, tree, int); extern bool comp_except_specs (tree, tree, bool);
extern bool comptypes (tree, tree, int); extern bool comptypes (tree, tree, int);
extern int comp_target_types (tree, tree, int); extern int comp_target_types (tree, tree, int);
extern int compparms (tree, tree); extern bool compparms (tree, tree);
extern int comp_cv_qualification (tree, tree); extern int comp_cv_qualification (tree, tree);
extern int comp_cv_qual_signature (tree, tree); extern int comp_cv_qual_signature (tree, tree);
extern tree expr_sizeof (tree); extern tree expr_sizeof (tree);
...@@ -4275,9 +4275,9 @@ extern int comp_ptr_ttypes (tree, tree); ...@@ -4275,9 +4275,9 @@ extern int comp_ptr_ttypes (tree, tree);
extern int ptr_reasonably_similar (tree, tree); extern int ptr_reasonably_similar (tree, tree);
extern tree build_ptrmemfunc (tree, tree, int); extern tree build_ptrmemfunc (tree, tree, int);
extern int cp_type_quals (tree); extern int cp_type_quals (tree);
extern int cp_has_mutable_p (tree); extern bool cp_has_mutable_p (tree);
extern int at_least_as_qualified_p (tree, tree); extern bool at_least_as_qualified_p (tree, tree);
extern int more_qualified_p (tree, tree); extern bool more_qualified_p (tree, tree);
extern tree build_ptrmemfunc1 (tree, tree, tree); extern tree build_ptrmemfunc1 (tree, tree, tree);
extern void expand_ptrmemfunc_cst (tree, tree *, tree *); extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
extern tree pfn_from_ptrmemfunc (tree); extern tree pfn_from_ptrmemfunc (tree);
......
...@@ -45,34 +45,32 @@ Boston, MA 02111-1307, USA. */ ...@@ -45,34 +45,32 @@ Boston, MA 02111-1307, USA. */
#include "diagnostic.h" #include "diagnostic.h"
#include "target.h" #include "target.h"
static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree, static tree convert_for_assignment (tree, tree, const char *, tree, int);
int)); static tree cp_pointer_int_sum (enum tree_code, tree, tree);
static tree cp_pointer_int_sum PARAMS ((enum tree_code, tree, tree)); static tree rationalize_conditional_expr (enum tree_code, tree);
static tree rationalize_conditional_expr PARAMS ((enum tree_code, tree)); static int comp_target_parms (tree, tree);
static int comp_target_parms PARAMS ((tree, tree)); static int comp_ptr_ttypes_real (tree, tree, int);
static int comp_ptr_ttypes_real PARAMS ((tree, tree, int)); static int comp_ptr_ttypes_const (tree, tree);
static int comp_ptr_ttypes_const PARAMS ((tree, tree)); static int comp_ptr_ttypes_reinterpret (tree, tree);
static int comp_ptr_ttypes_reinterpret PARAMS ((tree, tree)); static bool comp_except_types (tree, tree, bool);
static int comp_except_types PARAMS ((tree, tree, int)); static bool comp_array_types (tree, tree, bool);
static bool comp_array_types PARAMS ((tree, tree, int)); static tree common_base_type (tree, tree);
static tree common_base_type PARAMS ((tree, tree)); static tree lookup_anon_field (tree, tree);
static tree lookup_anon_field PARAMS ((tree, tree)); static tree pointer_diff (tree, tree, tree);
static tree pointer_diff PARAMS ((tree, tree, tree)); static tree qualify_type_recursive (tree, tree);
static tree qualify_type_recursive PARAMS ((tree, tree)); static tree get_delta_difference (tree, tree, int);
static tree get_delta_difference PARAMS ((tree, tree, int)); static int comp_cv_target_types (tree, tree, int);
static int comp_cv_target_types PARAMS ((tree, tree, int)); static void casts_away_constness_r (tree *, tree *);
static void casts_away_constness_r PARAMS ((tree *, tree *)); static bool casts_away_constness (tree, tree);
static int casts_away_constness PARAMS ((tree, tree)); static void maybe_warn_about_returning_address_of_local (tree);
static void maybe_warn_about_returning_address_of_local PARAMS ((tree)); static tree strip_all_pointer_quals (tree);
static tree strip_all_pointer_quals PARAMS ((tree));
static tree lookup_destructor (tree, tree, tree); static tree lookup_destructor (tree, tree, tree);
/* Return the target type of TYPE, which means return T for: /* Return the target type of TYPE, which means return T for:
T*, T&, T[], T (...), and otherwise, just T. */ T*, T&, T[], T (...), and otherwise, just T. */
tree tree
target_type (type) target_type (tree type)
tree type;
{ {
if (TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type); type = TREE_TYPE (type);
...@@ -91,8 +89,7 @@ target_type (type) ...@@ -91,8 +89,7 @@ target_type (type)
complete type when this function returns. */ complete type when this function returns. */
tree tree
require_complete_type (value) require_complete_type (tree value)
tree value;
{ {
tree type; tree type;
...@@ -131,8 +128,7 @@ require_complete_type (value) ...@@ -131,8 +128,7 @@ require_complete_type (value)
horribly wrong, in which case the error_mark_node is returned. */ horribly wrong, in which case the error_mark_node is returned. */
tree tree
complete_type (type) complete_type (tree type)
tree type;
{ {
if (type == NULL_TREE) if (type == NULL_TREE)
/* Rather than crash, we return something sure to cause an error /* Rather than crash, we return something sure to cause an error
...@@ -163,10 +159,7 @@ complete_type (type) ...@@ -163,10 +159,7 @@ complete_type (type)
Returns NULL_TREE if the type cannot be made complete. */ Returns NULL_TREE if the type cannot be made complete. */
tree tree
complete_type_or_diagnostic (type, value, diag_type) complete_type_or_diagnostic (tree type, tree value, int diag_type)
tree type;
tree value;
int diag_type;
{ {
type = complete_type (type); type = complete_type (type);
if (type == error_mark_node) if (type == error_mark_node)
...@@ -739,7 +732,8 @@ common_type (t1, t2) ...@@ -739,7 +732,8 @@ common_type (t1, t2)
} }
/* Compare two exception specifier types for exactness or subsetness, if /* Compare two exception specifier types for exactness or subsetness, if
allowed. Returns 0 for mismatch, 1 for same, 2 if B is allowed by A. allowed. Returns false for mismatch, true for match (same, or
derived and !exact).
[except.spec] "If a class X ... objects of class X or any class publicly [except.spec] "If a class X ... objects of class X or any class publicly
and unambigously derrived from X. Similarly, if a pointer type Y * ... and unambigously derrived from X. Similarly, if a pointer type Y * ...
...@@ -753,17 +747,15 @@ common_type (t1, t2) ...@@ -753,17 +747,15 @@ common_type (t1, t2)
We implement the letter of the standard. */ We implement the letter of the standard. */
static int static bool
comp_except_types (a, b, exact) comp_except_types (tree a, tree b, bool exact)
tree a, b;
int exact;
{ {
if (same_type_p (a, b)) if (same_type_p (a, b))
return 1; return true;
else if (!exact) else if (!exact)
{ {
if (cp_type_quals (a) || cp_type_quals (b)) if (cp_type_quals (a) || cp_type_quals (b))
return 0; return false;
if (TREE_CODE (a) == POINTER_TYPE if (TREE_CODE (a) == POINTER_TYPE
&& TREE_CODE (b) == POINTER_TYPE) && TREE_CODE (b) == POINTER_TYPE)
...@@ -771,43 +763,41 @@ comp_except_types (a, b, exact) ...@@ -771,43 +763,41 @@ comp_except_types (a, b, exact)
a = TREE_TYPE (a); a = TREE_TYPE (a);
b = TREE_TYPE (b); b = TREE_TYPE (b);
if (cp_type_quals (a) || cp_type_quals (b)) if (cp_type_quals (a) || cp_type_quals (b))
return 0; return false;
} }
if (TREE_CODE (a) != RECORD_TYPE if (TREE_CODE (a) != RECORD_TYPE
|| TREE_CODE (b) != RECORD_TYPE) || TREE_CODE (b) != RECORD_TYPE)
return 0; return false;
if (ACCESSIBLY_UNIQUELY_DERIVED_P (a, b)) if (ACCESSIBLY_UNIQUELY_DERIVED_P (a, b))
return 2; return true;
} }
return 0; return false;
} }
/* Return 1 if TYPE1 and TYPE2 are equivalent exception specifiers. /* Return true if TYPE1 and TYPE2 are equivalent exception specifiers.
If EXACT is 0, T2 can be stricter than T1 (according to 15.4/7), If EXACT is false, T2 can be stricter than T1 (according to 15.4/7),
otherwise it must be exact. Exception lists are unordered, but otherwise it must be exact. Exception lists are unordered, but
we've already filtered out duplicates. Most lists will be in order, we've already filtered out duplicates. Most lists will be in order,
we should try to make use of that. */ we should try to make use of that. */
int bool
comp_except_specs (t1, t2, exact) comp_except_specs (tree t1, tree t2, bool exact)
tree t1, t2;
int exact;
{ {
tree probe; tree probe;
tree base; tree base;
int length = 0; int length = 0;
if (t1 == t2) if (t1 == t2)
return 1; return true;
if (t1 == NULL_TREE) /* T1 is ... */ if (t1 == NULL_TREE) /* T1 is ... */
return t2 == NULL_TREE || !exact; return t2 == NULL_TREE || !exact;
if (!TREE_VALUE (t1)) /* t1 is EMPTY */ if (!TREE_VALUE (t1)) /* t1 is EMPTY */
return t2 != NULL_TREE && !TREE_VALUE (t2); return t2 != NULL_TREE && !TREE_VALUE (t2);
if (t2 == NULL_TREE) /* T2 is ... */ if (t2 == NULL_TREE) /* T2 is ... */
return 0; return false;
if (TREE_VALUE (t1) && !TREE_VALUE (t2)) /* T2 is EMPTY, T1 is not */ if (TREE_VALUE (t1) && !TREE_VALUE (t2)) /* T2 is EMPTY, T1 is not */
return !exact; return !exact;
...@@ -831,27 +821,25 @@ comp_except_specs (t1, t2, exact) ...@@ -831,27 +821,25 @@ comp_except_specs (t1, t2, exact)
} }
} }
if (probe == NULL_TREE) if (probe == NULL_TREE)
return 0; return false;
} }
return !exact || base == NULL_TREE || length == list_length (t1); return !exact || base == NULL_TREE || length == list_length (t1);
} }
/* Compare the array types T1 and T2. STRICT is as for comptypes. */ /* Compare the array types T1 and T2. ALLOW_REDECLARATION is true if
[] can match [size]. */
static bool static bool
comp_array_types (t1, t2, strict) comp_array_types (tree t1, tree t2, bool allow_redeclaration)
tree t1, t2;
int strict;
{ {
tree d1; tree d1;
tree d2; tree d2;
if (t1 == t2) if (t1 == t2)
return 1; return true;
/* The type of the array elements must be the same. */ /* The type of the array elements must be the same. */
if (!comptypes (TREE_TYPE (t1), TREE_TYPE (t2), if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
strict & ~COMPARE_REDECLARATION))
return false; return false;
d1 = TYPE_DOMAIN (t1); d1 = TYPE_DOMAIN (t1);
...@@ -873,7 +861,7 @@ comp_array_types (t1, t2, strict) ...@@ -873,7 +861,7 @@ comp_array_types (t1, t2, strict)
array types that differ by the presence or absence of a major array types that differ by the presence or absence of a major
array bound (_dcl.array_). */ array bound (_dcl.array_). */
if (!d1 || !d2) if (!d1 || !d2)
return strict & COMPARE_REDECLARATION; return allow_redeclaration;
/* Check that the dimensions are the same. */ /* Check that the dimensions are the same. */
return (cp_tree_equal (TYPE_MIN_VALUE (d1), TYPE_MIN_VALUE (d2)) return (cp_tree_equal (TYPE_MIN_VALUE (d1), TYPE_MIN_VALUE (d2))
...@@ -884,18 +872,11 @@ comp_array_types (t1, t2, strict) ...@@ -884,18 +872,11 @@ comp_array_types (t1, t2, strict)
is a bitwise-or of the COMPARE_* flags. */ is a bitwise-or of the COMPARE_* flags. */
bool bool
comptypes (t1, t2, strict) comptypes (tree t1, tree t2, int strict)
tree t1;
tree t2;
int strict;
{ {
int orig_strict = strict;
if (t1 == t2) if (t1 == t2)
return true; return true;
strict &= ~(COMPARE_REDECLARATION | COMPARE_BASE | COMPARE_DERIVED);
/* This should never happen. */ /* This should never happen. */
my_friendly_assert (t1 != error_mark_node, 307); my_friendly_assert (t1 != error_mark_node, 307);
...@@ -970,7 +951,7 @@ comptypes (t1, t2, strict) ...@@ -970,7 +951,7 @@ comptypes (t1, t2, strict)
if (TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM) if (TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM)
return true; return true;
/* Don't check inheritance. */ /* Don't check inheritance. */
orig_strict = COMPARE_STRICT; strict = COMPARE_STRICT;
/* fall through */ /* fall through */
case RECORD_TYPE: case RECORD_TYPE:
...@@ -981,34 +962,32 @@ comptypes (t1, t2, strict) ...@@ -981,34 +962,32 @@ comptypes (t1, t2, strict)
&& comp_template_args (TYPE_TI_ARGS (t1), TYPE_TI_ARGS (t2))) && comp_template_args (TYPE_TI_ARGS (t1), TYPE_TI_ARGS (t2)))
return true; return true;
if ((orig_strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2)) if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2))
return true; return true;
else if ((orig_strict & COMPARE_DERIVED) && DERIVED_FROM_P (t2, t1)) else if ((strict & COMPARE_DERIVED) && DERIVED_FROM_P (t2, t1))
return true; return true;
return false; return false;
case OFFSET_TYPE: case OFFSET_TYPE:
if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2), if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2),
orig_strict)) strict & ~COMPARE_REDECLARATION))
return false; return false;
return comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict); /* FALLTHROUGH*/
case POINTER_TYPE: case POINTER_TYPE:
case REFERENCE_TYPE: case REFERENCE_TYPE:
return comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict); return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
case METHOD_TYPE: case METHOD_TYPE:
case FUNCTION_TYPE: case FUNCTION_TYPE:
if (!comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict)) if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
return false; return false;
return compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2)); return compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2));
case ARRAY_TYPE: case ARRAY_TYPE:
/* Target types must match incl. qualifiers. We use ORIG_STRICT /* Target types must match incl. qualifiers. */
here since this is the one place where return comp_array_types (t1, t2, !!(strict & COMPARE_REDECLARATION));
COMPARE_REDECLARATION should be used. */
return comp_array_types (t1, t2, orig_strict & COMPARE_REDECLARATION);
case TEMPLATE_TYPE_PARM: case TEMPLATE_TYPE_PARM:
return (TEMPLATE_TYPE_IDX (t1) == TEMPLATE_TYPE_IDX (t2) return (TEMPLATE_TYPE_IDX (t1) == TEMPLATE_TYPE_IDX (t2)
...@@ -1038,9 +1017,7 @@ comptypes (t1, t2, strict) ...@@ -1038,9 +1017,7 @@ comptypes (t1, t2, strict)
only in the same direction as the target type. */ only in the same direction as the target type. */
static int static int
comp_cv_target_types (ttl, ttr, nptrs) comp_cv_target_types (tree ttl, tree ttr, int nptrs)
tree ttl, ttr;
int nptrs;
{ {
int t; int t;
...@@ -1073,9 +1050,7 @@ comp_cv_target_types (ttl, ttr, nptrs) ...@@ -1073,9 +1050,7 @@ comp_cv_target_types (ttl, ttr, nptrs)
similar instead. (jason 17 Apr 1997) */ similar instead. (jason 17 Apr 1997) */
int int
comp_target_types (ttl, ttr, nptrs) comp_target_types (tree ttl, tree ttr, int nptrs)
tree ttl, ttr;
int nptrs;
{ {
ttl = TYPE_MAIN_VARIANT (ttl); ttl = TYPE_MAIN_VARIANT (ttl);
ttr = TYPE_MAIN_VARIANT (ttr); ttr = TYPE_MAIN_VARIANT (ttr);
...@@ -1240,42 +1215,42 @@ comp_target_types (ttl, ttr, nptrs) ...@@ -1240,42 +1215,42 @@ comp_target_types (ttl, ttr, nptrs)
/* Returns 1 if TYPE1 is at least as qualified as TYPE2. */ /* Returns 1 if TYPE1 is at least as qualified as TYPE2. */
int bool
at_least_as_qualified_p (type1, type2) at_least_as_qualified_p (tree type1, tree type2)
tree type1;
tree type2;
{ {
int q1 = cp_type_quals (type1);
int q2 = cp_type_quals (type2);
/* All qualifiers for TYPE2 must also appear in TYPE1. */ /* All qualifiers for TYPE2 must also appear in TYPE1. */
return ((cp_type_quals (type1) & cp_type_quals (type2)) return (q1 & q2) == q2;
== cp_type_quals (type2));
} }
/* Returns 1 if TYPE1 is more qualified than TYPE2. */ /* Returns 1 if TYPE1 is more qualified than TYPE2. */
int bool
more_qualified_p (type1, type2) more_qualified_p (tree type1, tree type2)
tree type1;
tree type2;
{ {
return (cp_type_quals (type1) != cp_type_quals (type2) int q1 = cp_type_quals (type1);
&& at_least_as_qualified_p (type1, type2)); int q2 = cp_type_quals (type2);
return q1 != q2 && (q1 & q2) == q2;
} }
/* Returns 1 if TYPE1 is more cv-qualified than TYPE2, -1 if TYPE2 is /* Returns 1 if TYPE1 is more cv-qualified than TYPE2, -1 if TYPE2 is
more cv-qualified that TYPE1, and 0 otherwise. */ more cv-qualified that TYPE1, and 0 otherwise. */
int int
comp_cv_qualification (type1, type2) comp_cv_qualification (tree type1, tree type2)
tree type1;
tree type2;
{ {
if (cp_type_quals (type1) == cp_type_quals (type2)) int q1 = cp_type_quals (type1);
int q2 = cp_type_quals (type2);
if (q1 == q2)
return 0; return 0;
if (at_least_as_qualified_p (type1, type2)) if ((q1 & q2) == q2)
return 1; return 1;
else if ((q1 & q2) == q1)
else if (at_least_as_qualified_p (type2, type1))
return -1; return -1;
return 0; return 0;
...@@ -1286,9 +1261,7 @@ comp_cv_qualification (type1, type2) ...@@ -1286,9 +1261,7 @@ comp_cv_qualification (type1, type2)
are similar. Returns -1 if the other way 'round, and 0 otherwise. */ are similar. Returns -1 if the other way 'round, and 0 otherwise. */
int int
comp_cv_qual_signature (type1, type2) comp_cv_qual_signature (tree type1, tree type2)
tree type1;
tree type2;
{ {
if (comp_ptr_ttypes_real (type2, type1, -1)) if (comp_ptr_ttypes_real (type2, type1, -1))
return 1; return 1;
...@@ -1303,8 +1276,7 @@ comp_cv_qual_signature (type1, type2) ...@@ -1303,8 +1276,7 @@ comp_cv_qual_signature (type1, type2)
returns ERROR_MARK_NODE. */ returns ERROR_MARK_NODE. */
static tree static tree
common_base_type (tt1, tt2) common_base_type (tree tt1, tree tt2)
tree tt1, tt2;
{ {
tree best = NULL_TREE; tree best = NULL_TREE;
int i; int i;
...@@ -1352,36 +1324,31 @@ common_base_type (tt1, tt2) ...@@ -1352,36 +1324,31 @@ common_base_type (tt1, tt2)
/* Subroutines of `comptypes'. */ /* Subroutines of `comptypes'. */
/* Return 1 if two parameter type lists PARMS1 and PARMS2 are /* Return true if two parameter type lists PARMS1 and PARMS2 are
equivalent in the sense that functions with those parameter types equivalent in the sense that functions with those parameter types
can have equivalent types. The two lists must be equivalent, can have equivalent types. The two lists must be equivalent,
element by element. element by element. */
C++: See comment above about TYPE1, TYPE2. */ bool
compparms (tree parms1, tree parms2)
int
compparms (parms1, parms2)
tree parms1, parms2;
{ {
register tree t1 = parms1, t2 = parms2; tree t1, t2;
/* An unspecified parmlist matches any specified parmlist /* An unspecified parmlist matches any specified parmlist
whose argument types don't need default promotions. */ whose argument types don't need default promotions. */
while (1) for (t1 = parms1, t2 = parms2;
t1 || t2;
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
{ {
if (t1 == 0 && t2 == 0)
return 1;
/* If one parmlist is shorter than the other, /* If one parmlist is shorter than the other,
they fail to match. */ they fail to match. */
if (t1 == 0 || t2 == 0) if (!t1 || !t2)
return 0; return false;
if (!same_type_p (TREE_VALUE (t2), TREE_VALUE (t1))) if (!same_type_p (TREE_VALUE (t2), TREE_VALUE (t1)))
return 0; return false;
t1 = TREE_CHAIN (t1);
t2 = TREE_CHAIN (t2);
} }
return true;
} }
/* This really wants return whether or not parameter type lists /* This really wants return whether or not parameter type lists
...@@ -1394,8 +1361,7 @@ compparms (parms1, parms2) ...@@ -1394,8 +1361,7 @@ compparms (parms1, parms2)
(jason 17 Apr 1997) */ (jason 17 Apr 1997) */
static int static int
comp_target_parms (parms1, parms2) comp_target_parms (tree parms1, tree parms2)
tree parms1, parms2;
{ {
register tree t1 = parms1, t2 = parms2; register tree t1 = parms1, t2 = parms2;
int warn_contravariance = 0; int warn_contravariance = 0;
...@@ -1461,10 +1427,7 @@ comp_target_parms (parms1, parms2) ...@@ -1461,10 +1427,7 @@ comp_target_parms (parms1, parms2)
} }
tree tree
cxx_sizeof_or_alignof_type (type, op, complain) cxx_sizeof_or_alignof_type (tree type, enum tree_code op, int complain)
tree type;
enum tree_code op;
int complain;
{ {
enum tree_code type_code; enum tree_code type_code;
tree value; tree value;
...@@ -1499,8 +1462,7 @@ cxx_sizeof_or_alignof_type (type, op, complain) ...@@ -1499,8 +1462,7 @@ cxx_sizeof_or_alignof_type (type, op, complain)
} }
tree tree
expr_sizeof (e) expr_sizeof (tree e)
tree e;
{ {
if (processing_template_decl) if (processing_template_decl)
return build_min_nt (SIZEOF_EXPR, e); return build_min_nt (SIZEOF_EXPR, e);
...@@ -1538,8 +1500,7 @@ expr_sizeof (e) ...@@ -1538,8 +1500,7 @@ expr_sizeof (e)
constants are replaced by their values. */ constants are replaced by their values. */
tree tree
decay_conversion (exp) decay_conversion (tree exp)
tree exp;
{ {
register tree type; register tree type;
register enum tree_code code; register enum tree_code code;
...@@ -1656,8 +1617,7 @@ decay_conversion (exp) ...@@ -1656,8 +1617,7 @@ decay_conversion (exp)
} }
tree tree
default_conversion (exp) default_conversion (tree exp)
tree exp;
{ {
tree type; tree type;
enum tree_code code; enum tree_code code;
...@@ -1681,8 +1641,7 @@ default_conversion (exp) ...@@ -1681,8 +1641,7 @@ default_conversion (exp)
or TREE_USED. */ or TREE_USED. */
tree tree
inline_conversion (exp) inline_conversion (tree exp)
tree exp;
{ {
if (TREE_CODE (exp) == FUNCTION_DECL) if (TREE_CODE (exp) == FUNCTION_DECL)
exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp); exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp);
...@@ -1694,9 +1653,7 @@ inline_conversion (exp) ...@@ -1694,9 +1653,7 @@ inline_conversion (exp)
decay_conversion to one. */ decay_conversion to one. */
int int
string_conv_p (totype, exp, warn) string_conv_p (tree totype, tree exp, int warn)
tree totype, exp;
int warn;
{ {
tree t; tree t;
...@@ -1742,9 +1699,7 @@ string_conv_p (totype, exp, warn) ...@@ -1742,9 +1699,7 @@ string_conv_p (totype, exp, warn)
get it there. */ get it there. */
static tree static tree
rationalize_conditional_expr (code, t) rationalize_conditional_expr (enum tree_code code, tree t)
enum tree_code code;
tree t;
{ {
/* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that /* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that
the first operand is always the one to be used if both operands the first operand is always the one to be used if both operands
...@@ -1772,8 +1727,7 @@ rationalize_conditional_expr (code, t) ...@@ -1772,8 +1727,7 @@ rationalize_conditional_expr (code, t)
that are directly reachable. */ that are directly reachable. */
static tree static tree
lookup_anon_field (t, type) lookup_anon_field (tree t, tree type)
tree t, type;
{ {
tree field; tree field;
...@@ -4068,10 +4022,7 @@ build_nop (tree type, tree expr) ...@@ -4068,10 +4022,7 @@ build_nop (tree type, tree expr)
(such as from short to int). */ (such as from short to int). */
tree tree
build_unary_op (code, xarg, noconvert) build_unary_op (enum tree_code code, tree xarg, int noconvert)
enum tree_code code;
tree xarg;
int noconvert;
{ {
/* No default_conversion here. It causes trouble for ADDR_EXPR. */ /* No default_conversion here. It causes trouble for ADDR_EXPR. */
register tree arg = xarg; register tree arg = xarg;
...@@ -4522,9 +4473,7 @@ build_unary_op (code, xarg, noconvert) ...@@ -4522,9 +4473,7 @@ build_unary_op (code, xarg, noconvert)
If ARG is not a kind of expression we can handle, return zero. */ If ARG is not a kind of expression we can handle, return zero. */
tree tree
unary_complex_lvalue (code, arg) unary_complex_lvalue (enum tree_code code, tree arg)
enum tree_code code;
tree arg;
{ {
/* Handle (a, b) used as an "lvalue". */ /* Handle (a, b) used as an "lvalue". */
if (TREE_CODE (arg) == COMPOUND_EXPR) if (TREE_CODE (arg) == COMPOUND_EXPR)
...@@ -4661,8 +4610,7 @@ unary_complex_lvalue (code, arg) ...@@ -4661,8 +4610,7 @@ unary_complex_lvalue (code, arg)
C++: we do not allow `current_class_ptr' to be addressable. */ C++: we do not allow `current_class_ptr' to be addressable. */
bool bool
cxx_mark_addressable (exp) cxx_mark_addressable (tree exp)
tree exp;
{ {
register tree x = exp; register tree x = exp;
...@@ -4727,8 +4675,7 @@ cxx_mark_addressable (exp) ...@@ -4727,8 +4675,7 @@ cxx_mark_addressable (exp)
/* Build and return a conditional expression IFEXP ? OP1 : OP2. */ /* Build and return a conditional expression IFEXP ? OP1 : OP2. */
tree tree
build_x_conditional_expr (ifexp, op1, op2) build_x_conditional_expr (tree ifexp, tree op1, tree op2)
tree ifexp, op1, op2;
{ {
if (processing_template_decl) if (processing_template_decl)
return build_min_nt (COND_EXPR, ifexp, op1, op2); return build_min_nt (COND_EXPR, ifexp, op1, op2);
...@@ -4740,8 +4687,7 @@ build_x_conditional_expr (ifexp, op1, op2) ...@@ -4740,8 +4687,7 @@ build_x_conditional_expr (ifexp, op1, op2)
this function just builds an expression list. */ this function just builds an expression list. */
tree tree
build_x_compound_expr (list) build_x_compound_expr (tree list)
tree list;
{ {
tree rest = TREE_CHAIN (list); tree rest = TREE_CHAIN (list);
tree result; tree result;
...@@ -4784,8 +4730,7 @@ build_x_compound_expr (list) ...@@ -4784,8 +4730,7 @@ build_x_compound_expr (list)
that performs them all and returns the value of the last of them. */ that performs them all and returns the value of the last of them. */
tree tree
build_compound_expr (list) build_compound_expr (tree list)
tree list;
{ {
register tree rest; register tree rest;
tree first; tree first;
...@@ -4820,8 +4765,7 @@ build_compound_expr (list) ...@@ -4820,8 +4765,7 @@ build_compound_expr (list)
} }
tree tree
build_static_cast (type, expr) build_static_cast (tree type, tree expr)
tree type, expr;
{ {
tree intype; tree intype;
int ok; int ok;
...@@ -4933,8 +4877,7 @@ build_static_cast (type, expr) ...@@ -4933,8 +4877,7 @@ build_static_cast (type, expr)
} }
tree tree
build_reinterpret_cast (type, expr) build_reinterpret_cast (tree type, tree expr)
tree type, expr;
{ {
tree intype; tree intype;
...@@ -5024,8 +4967,7 @@ build_reinterpret_cast (type, expr) ...@@ -5024,8 +4967,7 @@ build_reinterpret_cast (type, expr)
} }
tree tree
build_const_cast (type, expr) build_const_cast (tree type, tree expr)
tree type, expr;
{ {
tree intype; tree intype;
...@@ -5094,8 +5036,7 @@ build_const_cast (type, expr) ...@@ -5094,8 +5036,7 @@ build_const_cast (type, expr)
when doing the cast. */ when doing the cast. */
tree tree
build_c_cast (type, expr) build_c_cast (tree type, tree expr)
tree type, expr;
{ {
register tree value = expr; register tree value = expr;
tree otype; tree otype;
...@@ -5261,10 +5202,7 @@ build_c_cast (type, expr) ...@@ -5261,10 +5202,7 @@ build_c_cast (type, expr)
C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed. */ C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed. */
tree tree
build_modify_expr (lhs, modifycode, rhs) build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
tree lhs;
enum tree_code modifycode;
tree rhs;
{ {
register tree result; register tree result;
tree newrhs = rhs; tree newrhs = rhs;
...@@ -5627,10 +5565,7 @@ build_modify_expr (lhs, modifycode, rhs) ...@@ -5627,10 +5565,7 @@ build_modify_expr (lhs, modifycode, rhs)
} }
tree tree
build_x_modify_expr (lhs, modifycode, rhs) build_x_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
tree lhs;
enum tree_code modifycode;
tree rhs;
{ {
if (processing_template_decl) if (processing_template_decl)
return build_min_nt (MODOP_EXPR, lhs, return build_min_nt (MODOP_EXPR, lhs,
...@@ -5657,9 +5592,7 @@ build_x_modify_expr (lhs, modifycode, rhs) ...@@ -5657,9 +5592,7 @@ build_x_modify_expr (lhs, modifycode, rhs)
a pointer to member of FROM to a pointer to member of TO. */ a pointer to member of FROM to a pointer to member of TO. */
static tree static tree
get_delta_difference (from, to, force) get_delta_difference (tree from, tree to, int force)
tree from, to;
int force;
{ {
tree delta = integer_zero_node; tree delta = integer_zero_node;
tree binfo; tree binfo;
...@@ -5722,8 +5655,7 @@ get_delta_difference (from, to, force) ...@@ -5722,8 +5655,7 @@ get_delta_difference (from, to, force)
the other components as specified. */ the other components as specified. */
tree tree
build_ptrmemfunc1 (type, delta, pfn) build_ptrmemfunc1 (tree type, tree delta, tree pfn)
tree type, delta, pfn;
{ {
tree u = NULL_TREE; tree u = NULL_TREE;
tree delta_field; tree delta_field;
...@@ -5761,9 +5693,7 @@ build_ptrmemfunc1 (type, delta, pfn) ...@@ -5761,9 +5693,7 @@ build_ptrmemfunc1 (type, delta, pfn)
Return error_mark_node, if something goes wrong. */ Return error_mark_node, if something goes wrong. */
tree tree
build_ptrmemfunc (type, pfn, force) build_ptrmemfunc (tree type, tree pfn, int force)
tree type, pfn;
int force;
{ {
tree fn; tree fn;
tree pfn_type; tree pfn_type;
...@@ -5848,10 +5778,7 @@ build_ptrmemfunc (type, pfn, force) ...@@ -5848,10 +5778,7 @@ build_ptrmemfunc (type, pfn, force)
integer_type_node. */ integer_type_node. */
void void
expand_ptrmemfunc_cst (cst, delta, pfn) expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn)
tree cst;
tree *delta;
tree *pfn;
{ {
tree type = TREE_TYPE (cst); tree type = TREE_TYPE (cst);
tree fn = PTRMEM_CST_MEMBER (cst); tree fn = PTRMEM_CST_MEMBER (cst);
...@@ -5914,8 +5841,7 @@ expand_ptrmemfunc_cst (cst, delta, pfn) ...@@ -5914,8 +5841,7 @@ expand_ptrmemfunc_cst (cst, delta, pfn)
given by T. */ given by T. */
tree tree
pfn_from_ptrmemfunc (t) pfn_from_ptrmemfunc (tree t)
tree t;
{ {
if (TREE_CODE (t) == PTRMEM_CST) if (TREE_CODE (t) == PTRMEM_CST)
{ {
...@@ -5935,12 +5861,8 @@ pfn_from_ptrmemfunc (t) ...@@ -5935,12 +5861,8 @@ pfn_from_ptrmemfunc (t)
marked EXPR. */ marked EXPR. */
tree tree
dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum) dubious_conversion_warnings (tree type, tree expr,
tree type; const char *errtype, tree fndecl, int parmnum)
tree expr;
const char *errtype;
tree fndecl;
int parmnum;
{ {
if (TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type); type = TREE_TYPE (type);
...@@ -5995,11 +5917,8 @@ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum) ...@@ -5995,11 +5917,8 @@ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
FNDECL. */ FNDECL. */
static tree static tree
convert_for_assignment (type, rhs, errtype, fndecl, parmnum) convert_for_assignment (tree type, tree rhs,
tree type, rhs; const char *errtype, tree fndecl, int parmnum)
const char *errtype;
tree fndecl;
int parmnum;
{ {
register enum tree_code codel = TREE_CODE (type); register enum tree_code codel = TREE_CODE (type);
register tree rhstype; register tree rhstype;
...@@ -6099,12 +6018,8 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) ...@@ -6099,12 +6018,8 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
If flags doesn't include LOOKUP_COMPLAIN, don't complain about anything. */ If flags doesn't include LOOKUP_COMPLAIN, don't complain about anything. */
tree tree
convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum) convert_for_initialization (tree exp, tree type, tree rhs, int flags,
tree exp, type, rhs; const char *errtype, tree fndecl, int parmnum)
int flags;
const char *errtype;
tree fndecl;
int parmnum;
{ {
register enum tree_code codel = TREE_CODE (type); register enum tree_code codel = TREE_CODE (type);
register tree rhstype; register tree rhstype;
...@@ -6194,11 +6109,8 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum) ...@@ -6194,11 +6109,8 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
up operands that are expected to be in memory. */ up operands that are expected to be in memory. */
void void
c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) c_expand_asm_operands (tree string, tree outputs, tree inputs, tree clobbers,
tree string, outputs, inputs, clobbers; int vol, const char *filename, int line)
int vol;
const char *filename;
int line;
{ {
int noutputs = list_length (outputs); int noutputs = list_length (outputs);
register int i; register int i;
...@@ -6248,8 +6160,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) ...@@ -6248,8 +6160,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
temporary give an appropraite warning. */ temporary give an appropraite warning. */
static void static void
maybe_warn_about_returning_address_of_local (retval) maybe_warn_about_returning_address_of_local (tree retval)
tree retval;
{ {
tree valtype = TREE_TYPE (DECL_RESULT (current_function_decl)); tree valtype = TREE_TYPE (DECL_RESULT (current_function_decl));
tree whats_returned = retval; tree whats_returned = retval;
...@@ -6309,8 +6220,7 @@ maybe_warn_about_returning_address_of_local (retval) ...@@ -6309,8 +6220,7 @@ maybe_warn_about_returning_address_of_local (retval)
the DECL_RESULT for the function. */ the DECL_RESULT for the function. */
tree tree
check_return_expr (retval) check_return_expr (tree retval)
tree retval;
{ {
tree result; tree result;
/* The type actually returned by the function, after any /* The type actually returned by the function, after any
...@@ -6500,9 +6410,7 @@ check_return_expr (retval) ...@@ -6500,9 +6410,7 @@ check_return_expr (retval)
const-qualified. */ const-qualified. */
static int static int
comp_ptr_ttypes_real (to, from, constp) comp_ptr_ttypes_real (tree to, tree from, int constp)
tree to, from;
int constp;
{ {
int to_more_cv_qualified = 0; int to_more_cv_qualified = 0;
...@@ -6546,8 +6454,7 @@ comp_ptr_ttypes_real (to, from, constp) ...@@ -6546,8 +6454,7 @@ comp_ptr_ttypes_real (to, from, constp)
types to this function. */ types to this function. */
int int
comp_ptr_ttypes (to, from) comp_ptr_ttypes (tree to, tree from)
tree to, from;
{ {
return comp_ptr_ttypes_real (to, from, 1); return comp_ptr_ttypes_real (to, from, 1);
} }
...@@ -6556,8 +6463,7 @@ comp_ptr_ttypes (to, from) ...@@ -6556,8 +6463,7 @@ comp_ptr_ttypes (to, from)
type or inheritance-related types, regardless of cv-quals. */ type or inheritance-related types, regardless of cv-quals. */
int int
ptr_reasonably_similar (to, from) ptr_reasonably_similar (tree to, tree from)
tree to, from;
{ {
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from)) for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{ {
...@@ -6592,8 +6498,7 @@ ptr_reasonably_similar (to, from) ...@@ -6592,8 +6498,7 @@ ptr_reasonably_similar (to, from)
/* Like comp_ptr_ttypes, for const_cast. */ /* Like comp_ptr_ttypes, for const_cast. */
static int static int
comp_ptr_ttypes_const (to, from) comp_ptr_ttypes_const (tree to, tree from)
tree to, from;
{ {
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from)) for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{ {
...@@ -6613,8 +6518,7 @@ comp_ptr_ttypes_const (to, from) ...@@ -6613,8 +6518,7 @@ comp_ptr_ttypes_const (to, from)
/* Like comp_ptr_ttypes, for reinterpret_cast. */ /* Like comp_ptr_ttypes, for reinterpret_cast. */
static int static int
comp_ptr_ttypes_reinterpret (to, from) comp_ptr_ttypes_reinterpret (tree to, tree from)
tree to, from;
{ {
int constp = 1; int constp = 1;
...@@ -6649,8 +6553,7 @@ comp_ptr_ttypes_reinterpret (to, from) ...@@ -6649,8 +6553,7 @@ comp_ptr_ttypes_reinterpret (to, from)
elements for an array type. */ elements for an array type. */
int int
cp_type_quals (type) cp_type_quals (tree type)
tree type;
{ {
type = strip_array_types (type); type = strip_array_types (type);
if (type == error_mark_node) if (type == error_mark_node)
...@@ -6660,9 +6563,8 @@ cp_type_quals (type) ...@@ -6660,9 +6563,8 @@ cp_type_quals (type)
/* Returns nonzero if the TYPE contains a mutable member */ /* Returns nonzero if the TYPE contains a mutable member */
int bool
cp_has_mutable_p (type) cp_has_mutable_p (tree type)
tree type;
{ {
type = strip_array_types (type); type = strip_array_types (type);
...@@ -6674,9 +6576,7 @@ cp_has_mutable_p (type) ...@@ -6674,9 +6576,7 @@ cp_has_mutable_p (type)
if and only if there is no implicit conversion from T1 to T2. */ if and only if there is no implicit conversion from T1 to T2. */
static void static void
casts_away_constness_r (t1, t2) casts_away_constness_r (tree *t1, tree *t2)
tree *t1;
tree *t2;
{ {
int quals1; int quals1;
int quals2; int quals2;
...@@ -6734,10 +6634,8 @@ casts_away_constness_r (t1, t2) ...@@ -6734,10 +6634,8 @@ casts_away_constness_r (t1, t2)
/* Returns nonzero if casting from TYPE1 to TYPE2 casts away /* Returns nonzero if casting from TYPE1 to TYPE2 casts away
constness. */ constness. */
static int static bool
casts_away_constness (t1, t2) casts_away_constness (tree t1, tree t2)
tree t1;
tree t2;
{ {
if (TREE_CODE (t2) == REFERENCE_TYPE) if (TREE_CODE (t2) == REFERENCE_TYPE)
{ {
...@@ -6747,8 +6645,7 @@ casts_away_constness (t1, t2) ...@@ -6747,8 +6645,7 @@ casts_away_constness (t1, t2)
using a reference cast casts away constness if a cast from an using a reference cast casts away constness if a cast from an
rvalue of type "pointer to T1" to the type "pointer to T2" rvalue of type "pointer to T1" to the type "pointer to T2"
casts away constness. */ casts away constness. */
t1 = (TREE_CODE (t1) == REFERENCE_TYPE t1 = (TREE_CODE (t1) == REFERENCE_TYPE ? TREE_TYPE (t1) : t1);
? TREE_TYPE (t1) : t1);
return casts_away_constness (build_pointer_type (t1), return casts_away_constness (build_pointer_type (t1),
build_pointer_type (TREE_TYPE (t2))); build_pointer_type (TREE_TYPE (t2)));
} }
...@@ -6769,16 +6666,16 @@ casts_away_constness (t1, t2) ...@@ -6769,16 +6666,16 @@ casts_away_constness (t1, t2)
pointer or reference types. */ pointer or reference types. */
if (TREE_CODE (t1) != POINTER_TYPE if (TREE_CODE (t1) != POINTER_TYPE
|| TREE_CODE (t2) != POINTER_TYPE) || TREE_CODE (t2) != POINTER_TYPE)
return 0; return false;
/* Top-level qualifiers don't matter. */ /* Top-level qualifiers don't matter. */
t1 = TYPE_MAIN_VARIANT (t1); t1 = TYPE_MAIN_VARIANT (t1);
t2 = TYPE_MAIN_VARIANT (t2); t2 = TYPE_MAIN_VARIANT (t2);
casts_away_constness_r (&t1, &t2); casts_away_constness_r (&t1, &t2);
if (!can_convert (t2, t1)) if (!can_convert (t2, t1))
return 1; return true;
return 0; return false;
} }
/* Returns TYPE with its cv qualifiers removed /* Returns TYPE with its cv qualifiers removed
...@@ -6787,8 +6684,7 @@ casts_away_constness (t1, t2) ...@@ -6787,8 +6684,7 @@ casts_away_constness (t1, t2)
above are those of the array members.) */ above are those of the array members.) */
static tree static tree
strip_all_pointer_quals (type) strip_all_pointer_quals (tree type)
tree type;
{ {
if (TREE_CODE (type) == POINTER_TYPE) if (TREE_CODE (type) == POINTER_TYPE)
return build_pointer_type (strip_all_pointer_quals (TREE_TYPE (type))); return build_pointer_type (strip_all_pointer_quals (TREE_TYPE (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