Commit 94be8403 by Gabriel Dos Reis Committed by Gabriel Dos Reis

* call.c (tourney, build_field_call, equal_functions, joust)

	(compare_ics, build_over_call, build_java_interface_fn_ref)
	(convert_like_real, op_error, build_object_call, resolve_args)
	(build_vfield_ref, check_dtor_name, build_scoped_method_call)
	(build_addr_func, build_call, build_method_call, null_ptr_cst_p)
	(sufficient_parms_p, build_conv, non_reference, strip_top_quals)
	(standard_conversion, reference_related_p)
	(reference_compatible_p, convert_class_to_reference)
	(direct_reference_binding, reference_binding)
	(implicit_conversion, is_complete, promoted_arithmetic_type_p)
	(add_template_conv_candidate, any_viable, any_strictly_viable)
	(build_this, splice_viable, print_z_candidates)
	(build_user_type_conversion, build_new_function_call)
	(conditional_conversion, build_conditional_expr, build_new_op)
	(build_op_delete_call, enforce_access, call_builtin_trap)
	(convert_arg_to_ellipsis, build_x_va_arg, cxx_type_promotes_to)
	(convert_default_arg, type_passed_as, convert_for_arg_passing)
	(in_charge_arg_for_name, is_properly_derived_from)
	(maybe_handle_implicit_object, maybe_handle_ref_bind)
	(source_type, add_warning, can_convert, can_convert_arg)
	(perform_implicit_conversion, can_convert_arg_bad)
	(initialize_reference, add_conv_candidate)
	(add_template_candidate_real, add_template_candidate): Ansify.

From-SVN: r60458
parent c9693e96
2002-12-23 Gabriel Dos Reis <gdr@integrable-solutions.net>
* call.c (tourney, build_field_call, equal_functions, joust)
(compare_ics, build_over_call, build_java_interface_fn_ref)
(convert_like_real, op_error, build_object_call, resolve_args)
(build_vfield_ref, check_dtor_name, build_scoped_method_call)
(build_addr_func, build_call, build_method_call, null_ptr_cst_p)
(sufficient_parms_p, build_conv, non_reference, strip_top_quals)
(standard_conversion, reference_related_p)
(reference_compatible_p, convert_class_to_reference)
(direct_reference_binding, reference_binding)
(implicit_conversion, is_complete, promoted_arithmetic_type_p)
(add_template_conv_candidate, any_viable, any_strictly_viable)
(build_this, splice_viable, print_z_candidates)
(build_user_type_conversion, build_new_function_call)
(conditional_conversion, build_conditional_expr, build_new_op)
(build_op_delete_call, enforce_access, call_builtin_trap)
(convert_arg_to_ellipsis, build_x_va_arg, cxx_type_promotes_to)
(convert_default_arg, type_passed_as, convert_for_arg_passing)
(in_charge_arg_for_name, is_properly_derived_from)
(maybe_handle_implicit_object, maybe_handle_ref_bind)
(source_type, add_warning, can_convert, can_convert_arg)
(perform_implicit_conversion, can_convert_arg_bad)
(initialize_reference, add_conv_candidate)
(add_template_candidate_real, add_template_candidate): Ansify.
2002-12-22 Nathan Sidwell <nathan@codesourcery.com>
PR c++/8572
......
......@@ -40,74 +40,72 @@ Boston, MA 02111-1307, USA. */
extern int inhibit_warnings;
static tree build_field_call PARAMS ((tree, tree, tree));
static struct z_candidate * tourney PARAMS ((struct z_candidate *));
static int equal_functions PARAMS ((tree, tree));
static int joust PARAMS ((struct z_candidate *, struct z_candidate *, int));
static int compare_ics PARAMS ((tree, tree));
static tree build_over_call PARAMS ((struct z_candidate *, tree, int));
static tree build_java_interface_fn_ref PARAMS ((tree, tree));
static tree build_field_call (tree, tree, tree);
static struct z_candidate * tourney (struct z_candidate *);
static int equal_functions (tree, tree);
static int joust (struct z_candidate *, struct z_candidate *, bool);
static int compare_ics (tree, tree);
static tree build_over_call (struct z_candidate *, tree, int);
static tree build_java_interface_fn_ref (tree, tree);
#define convert_like(CONV, EXPR) \
convert_like_real ((CONV), (EXPR), NULL_TREE, 0, 0)
#define convert_like_with_context(CONV, EXPR, FN, ARGNO) \
convert_like_real ((CONV), (EXPR), (FN), (ARGNO), 0)
static tree convert_like_real PARAMS ((tree, tree, tree, int, int));
static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree,
tree, const char *));
static tree build_object_call PARAMS ((tree, tree));
static tree resolve_args PARAMS ((tree));
static struct z_candidate * build_user_type_conversion_1
PARAMS ((tree, tree, int));
static void print_z_candidates PARAMS ((struct z_candidate *));
static tree build_this PARAMS ((tree));
static struct z_candidate * splice_viable PARAMS ((struct z_candidate *));
static int any_viable PARAMS ((struct z_candidate *));
static int any_strictly_viable PARAMS ((struct z_candidate *));
static struct z_candidate * add_template_candidate
PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree,
tree, tree, int, unification_kind_t));
static struct z_candidate * add_template_candidate_real
PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree,
tree, tree, int, tree, unification_kind_t));
static struct z_candidate * add_template_conv_candidate
PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree, tree));
static struct z_candidate * add_builtin_candidates
PARAMS ((struct z_candidate *, enum tree_code, enum tree_code,
tree, tree *, int));
static struct z_candidate * add_builtin_candidate
PARAMS ((struct z_candidate *, enum tree_code, enum tree_code,
tree, tree, tree, tree *, tree *, int));
static int is_complete PARAMS ((tree));
static struct z_candidate * build_builtin_candidate
PARAMS ((struct z_candidate *, tree, tree, tree, tree *, tree *,
int));
static struct z_candidate * add_conv_candidate
PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree));
static struct z_candidate * add_function_candidate
static tree convert_like_real (tree, tree, tree, int, int);
static void op_error (enum tree_code, enum tree_code, tree, tree,
tree, const char *);
static tree build_object_call (tree, tree);
static tree resolve_args (tree);
static struct z_candidate *build_user_type_conversion_1 (tree, tree, int);
static void print_z_candidates (struct z_candidate *);
static tree build_this (tree);
static struct z_candidate *splice_viable (struct z_candidate *);
static bool any_viable (struct z_candidate *);
static bool any_strictly_viable (struct z_candidate *);
static struct z_candidate *add_template_candidate
(struct z_candidate *, tree, tree, tree, tree, tree,
tree, tree, int, unification_kind_t);
static struct z_candidate *add_template_candidate_real
(struct z_candidate *, tree, tree, tree, tree, tree,
tree, tree, int, tree, unification_kind_t);
static struct z_candidate *add_template_conv_candidate
(struct z_candidate *, tree, tree, tree, tree, tree, tree);
static struct z_candidate *add_builtin_candidates
(struct z_candidate *, enum tree_code, enum tree_code,
tree, tree *, int);
static struct z_candidate *add_builtin_candidate
(struct z_candidate *, enum tree_code, enum tree_code,
tree, tree, tree, tree *, tree *, int);
static bool is_complete (tree);
static struct z_candidate *build_builtin_candidate
(struct z_candidate *, tree, tree, tree, tree *, tree *,
int);
static struct z_candidate *add_conv_candidate
(struct z_candidate *, tree, tree, tree, tree, tree);
static struct z_candidate *add_function_candidate
(struct z_candidate *, tree, tree, tree, tree, tree, int);
static tree implicit_conversion PARAMS ((tree, tree, tree, int));
static tree standard_conversion PARAMS ((tree, tree, tree));
static tree reference_binding PARAMS ((tree, tree, tree, int));
static tree non_reference PARAMS ((tree));
static tree build_conv PARAMS ((enum tree_code, tree, tree));
static int is_subseq PARAMS ((tree, tree));
static tree maybe_handle_ref_bind PARAMS ((tree*));
static void maybe_handle_implicit_object PARAMS ((tree*));
static tree implicit_conversion (tree, tree, tree, int);
static tree standard_conversion (tree, tree, tree);
static tree reference_binding (tree, tree, tree, int);
static tree non_reference (tree);
static tree build_conv (enum tree_code, tree, tree);
static bool is_subseq (tree, tree);
static tree maybe_handle_ref_bind (tree *);
static void maybe_handle_implicit_object (tree *);
static struct z_candidate *add_candidate
(struct z_candidate *, tree, tree, tree, tree, int);
static tree source_type PARAMS ((tree));
static void add_warning PARAMS ((struct z_candidate *, struct z_candidate *));
static int reference_related_p PARAMS ((tree, tree));
static int reference_compatible_p PARAMS ((tree, tree));
static tree convert_class_to_reference PARAMS ((tree, tree, tree));
static tree direct_reference_binding PARAMS ((tree, tree));
static int promoted_arithmetic_type_p PARAMS ((tree));
static tree conditional_conversion PARAMS ((tree, tree));
static tree call_builtin_trap PARAMS ((void));
static tree source_type (tree);
static void add_warning (struct z_candidate *, struct z_candidate *);
static bool reference_related_p (tree, tree);
static bool reference_compatible_p (tree, tree);
static tree convert_class_to_reference (tree, tree, tree);
static tree direct_reference_binding (tree, tree);
static bool promoted_arithmetic_type_p (tree);
static tree conditional_conversion (tree, tree);
static tree call_builtin_trap (void);
tree
build_vfield_ref (datum, type)
tree datum, type;
build_vfield_ref (tree datum, tree type)
{
if (datum == error_mark_node)
return error_mark_node;
......@@ -163,15 +161,14 @@ build_field_call (tree instance_ptr, tree decl, tree parms)
(a BIT_NOT_EXPR) matches BASETYPE. The operand of NAME can take many
forms... */
int
check_dtor_name (basetype, name)
tree basetype, name;
bool
check_dtor_name (tree basetype, tree name)
{
name = TREE_OPERAND (name, 0);
/* Just accept something we've already complained about. */
if (name == error_mark_node)
return 1;
return true;
if (TREE_CODE (name) == TYPE_DECL)
name = TREE_TYPE (name);
......@@ -194,21 +191,20 @@ check_dtor_name (basetype, name)
NAME will be a class template. */
else if (DECL_CLASS_TEMPLATE_P (name))
return 0;
return false;
else
abort ();
if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name))
return 1;
return 0;
return true;
return false;
}
/* Build a method call of the form `EXP->SCOPES::NAME (PARMS)'.
This is how virtual function calls are avoided. */
tree
build_scoped_method_call (exp, basetype, name, parms)
tree exp, basetype, name, parms;
build_scoped_method_call (tree exp, tree basetype, tree name, tree parms)
{
/* Because this syntactic form does not allow
a pointer to a base class to be `stolen',
......@@ -315,8 +311,7 @@ build_scoped_method_call (exp, basetype, name, parms)
pointer-to-member function. */
tree
build_addr_func (function)
tree function;
build_addr_func (tree function)
{
tree type = TREE_TYPE (function);
......@@ -351,8 +346,7 @@ build_addr_func (function)
(TYPE_PTRMEMFUNC_P) must be handled by our callers. */
tree
build_call (function, parms)
tree function, parms;
build_call (tree function, tree parms)
{
int is_constructor = 0;
int nothrow;
......@@ -464,9 +458,8 @@ extern int n_build_method_call;
#endif
tree
build_method_call (instance, name, parms, basetype_path, flags)
tree instance, name, parms, basetype_path;
int flags;
build_method_call (tree instance, tree name, tree parms,
tree basetype_path, int flags)
{
tree fn;
tree object_type;
......@@ -635,9 +628,8 @@ struct z_candidate GTY(()) {
#define USER_CONV_CAND(NODE) WRAPPER_ZC (TREE_OPERAND (NODE, 1))
#define USER_CONV_FN(NODE) (USER_CONV_CAND (NODE)->fn)
int
null_ptr_cst_p (t)
tree t;
bool
null_ptr_cst_p (tree t)
{
/* [conv.ptr]
......@@ -645,29 +637,26 @@ null_ptr_cst_p (t)
(_expr.const_) rvalue of integer type that evaluates to zero. */
if (t == null_node
|| (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t)))
return 1;
return 0;
return true;
return false;
}
/* Returns nonzero if PARMLIST consists of only default parms and/or
ellipsis. */
int
sufficient_parms_p (parmlist)
tree parmlist;
bool
sufficient_parms_p (tree parmlist)
{
for (; parmlist && parmlist != void_list_node;
parmlist = TREE_CHAIN (parmlist))
if (!TREE_PURPOSE (parmlist))
return 0;
return 1;
return false;
return true;
}
static tree
build_conv (code, type, from)
enum tree_code code;
tree type, from;
build_conv (enum tree_code code, tree type, tree from)
{
tree t;
int rank = ICS_STD_RANK (from);
......@@ -706,8 +695,7 @@ build_conv (code, type, from)
Otherwise, return T itself. */
static tree
non_reference (t)
tree t;
non_reference (tree t)
{
if (TREE_CODE (t) == REFERENCE_TYPE)
t = TREE_TYPE (t);
......@@ -715,8 +703,7 @@ non_reference (t)
}
tree
strip_top_quals (t)
tree t;
strip_top_quals (tree t)
{
if (TREE_CODE (t) == ARRAY_TYPE)
return t;
......@@ -728,18 +715,17 @@ strip_top_quals (t)
also pass the expression EXPR to convert from. */
static tree
standard_conversion (to, from, expr)
tree to, from, expr;
standard_conversion (tree to, tree from, tree expr)
{
enum tree_code fcode, tcode;
tree conv;
int fromref = 0;
bool fromref = false;
if (TREE_CODE (to) == REFERENCE_TYPE)
to = TREE_TYPE (to);
if (TREE_CODE (from) == REFERENCE_TYPE)
{
fromref = 1;
fromref = true;
from = TREE_TYPE (from);
}
to = strip_top_quals (to);
......@@ -943,10 +929,8 @@ standard_conversion (to, from, expr)
/* Returns nonzero if T1 is reference-related to T2. */
static int
reference_related_p (t1, t2)
tree t1;
tree t2;
static bool
reference_related_p (tree t1, tree t2)
{
t1 = TYPE_MAIN_VARIANT (t1);
t2 = TYPE_MAIN_VARIANT (t2);
......@@ -963,10 +947,8 @@ reference_related_p (t1, t2)
/* Returns nonzero if T1 is reference-compatible with T2. */
static int
reference_compatible_p (t1, t2)
tree t1;
tree t2;
static bool
reference_compatible_p (tree t1, tree t2)
{
/* [dcl.init.ref]
......@@ -981,10 +963,7 @@ reference_compatible_p (t1, t2)
converted to T as in [over.match.ref]. */
static tree
convert_class_to_reference (t, s, expr)
tree t;
tree s;
tree expr;
convert_class_to_reference (tree t, tree s, tree expr)
{
tree conversions;
tree arglist;
......@@ -1095,9 +1074,7 @@ convert_class_to_reference (t, s, expr)
Return a conversion sequence for this binding. */
static tree
direct_reference_binding (type, conv)
tree type;
tree conv;
direct_reference_binding (tree type, tree conv)
{
tree t = TREE_TYPE (type);
......@@ -1136,15 +1113,13 @@ direct_reference_binding (type, conv)
the conversion returned. */
static tree
reference_binding (rto, rfrom, expr, flags)
tree rto, rfrom, expr;
int flags;
reference_binding (tree rto, tree rfrom, tree expr, int flags)
{
tree conv = NULL_TREE;
tree to = TREE_TYPE (rto);
tree from = rfrom;
int related_p;
int compatible_p;
bool related_p;
bool compatible_p;
cp_lvalue_kind lvalue_p = clk_none;
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
......@@ -1289,9 +1264,7 @@ reference_binding (rto, rfrom, expr, flags)
significant. */
static tree
implicit_conversion (to, from, expr, flags)
tree to, from, expr;
int flags;
implicit_conversion (tree to, tree from, tree expr, int flags)
{
tree conv;
struct z_candidate *cand;
......@@ -1498,12 +1471,8 @@ add_function_candidate (struct z_candidate *candidates,
instead of the function. */
static struct z_candidate *
add_conv_candidate (candidates, fn, obj, arglist, access_path,
conversion_path)
struct z_candidate *candidates;
tree fn, obj, arglist;
tree access_path;
tree conversion_path;
add_conv_candidate (struct z_candidate *candidates, tree fn, tree obj,
tree arglist, tree access_path, tree conversion_path)
{
tree totype = TREE_TYPE (TREE_TYPE (fn));
int i, len, viable, flags;
......@@ -1568,12 +1537,9 @@ add_conv_candidate (candidates, fn, obj, arglist, access_path,
}
static struct z_candidate *
build_builtin_candidate (candidates, fnname, type1, type2,
args, argtypes, flags)
struct z_candidate *candidates;
tree fnname, type1, type2, *args, *argtypes;
int flags;
build_builtin_candidate (struct z_candidate *candidates, tree fnname,
tree type1, tree type2, tree *args, tree *argtypes,
int flags)
{
tree t, convs;
int viable = 1, i;
......@@ -1619,18 +1585,16 @@ build_builtin_candidate (candidates, fnname, type1, type2,
viable);
}
static int
is_complete (t)
tree t;
static bool
is_complete (tree t)
{
return COMPLETE_TYPE_P (complete_type (t));
}
/* Returns nonzero if TYPE is a promoted arithmetic type. */
static int
promoted_arithmetic_type_p (type)
tree type;
static bool
promoted_arithmetic_type_p (tree type)
{
/* [over.built]
......@@ -1655,12 +1619,9 @@ promoted_arithmetic_type_p (type)
CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */
static struct z_candidate *
add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
args, argtypes, flags)
struct z_candidate *candidates;
enum tree_code code, code2;
tree fnname, type1, type2, *args, *argtypes;
int flags;
add_builtin_candidate (struct z_candidate *candidates, enum tree_code code,
enum tree_code code2, tree fnname, tree type1,
tree type2, tree *args, tree *argtypes, int flags)
{
switch (code)
{
......@@ -2054,8 +2015,7 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
}
tree
type_decays_to (type)
tree type;
type_decays_to (tree type)
{
if (TREE_CODE (type) == ARRAY_TYPE)
return build_pointer_type (TREE_TYPE (type));
......@@ -2078,11 +2038,9 @@ type_decays_to (type)
filter out the invalid set. */
static struct z_candidate *
add_builtin_candidates (candidates, code, code2, fnname, args, flags)
struct z_candidate *candidates;
enum tree_code code, code2;
tree fnname, *args;
int flags;
add_builtin_candidates (struct z_candidate *candidates, enum tree_code code,
enum tree_code code2, tree fnname, tree *args,
int flags)
{
int ref1, i;
int enum_p = 0;
......@@ -2253,16 +2211,11 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
add_conv_candidate. */
static struct z_candidate*
add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
arglist, return_type, access_path,
conversion_path, flags, obj, strict)
struct z_candidate *candidates;
tree tmpl, ctype, explicit_targs, arglist, return_type;
tree access_path;
tree conversion_path;
int flags;
tree obj;
unification_kind_t strict;
add_template_candidate_real (struct z_candidate *candidates, tree tmpl,
tree ctype, tree explicit_targs, tree arglist,
tree return_type, tree access_path,
tree conversion_path, int flags, tree obj,
unification_kind_t strict)
{
int ntparms = DECL_NTPARMS (tmpl);
tree targs = make_tree_vec (ntparms);
......@@ -2357,15 +2310,10 @@ add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
static struct z_candidate *
add_template_candidate (candidates, tmpl, ctype, explicit_targs,
arglist, return_type, access_path,
conversion_path, flags, strict)
struct z_candidate *candidates;
tree tmpl, ctype, explicit_targs, arglist, return_type;
tree access_path;
tree conversion_path;
int flags;
unification_kind_t strict;
add_template_candidate (struct z_candidate *candidates, tree tmpl, tree ctype,
tree explicit_targs, tree arglist, tree return_type,
tree access_path, tree conversion_path, int flags,
unification_kind_t strict)
{
return
add_template_candidate_real (candidates, tmpl, ctype,
......@@ -2376,12 +2324,9 @@ add_template_candidate (candidates, tmpl, ctype, explicit_targs,
static struct z_candidate *
add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type,
access_path, conversion_path)
struct z_candidate *candidates;
tree tmpl, obj, arglist, return_type;
tree access_path;
tree conversion_path;
add_template_conv_candidate (struct z_candidate *candidates, tree tmpl,
tree obj, tree arglist, tree return_type,
tree access_path, tree conversion_path)
{
return
add_template_candidate_real (candidates, tmpl, NULL_TREE, NULL_TREE,
......@@ -2390,29 +2335,26 @@ add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type,
}
static int
any_viable (cands)
struct z_candidate *cands;
static bool
any_viable (struct z_candidate *cands)
{
for (; cands; cands = cands->next)
if (pedantic ? cands->viable == 1 : cands->viable)
return 1;
return 0;
return true;
return false;
}
static int
any_strictly_viable (cands)
struct z_candidate *cands;
static bool
any_strictly_viable (struct z_candidate *cands)
{
for (; cands; cands = cands->next)
if (cands->viable == 1)
return 1;
return 0;
return true;
return false;
}
static struct z_candidate *
splice_viable (cands)
struct z_candidate *cands;
splice_viable (struct z_candidate *cands)
{
struct z_candidate **p = &cands;
......@@ -2428,16 +2370,14 @@ splice_viable (cands)
}
static tree
build_this (obj)
tree obj;
build_this (tree obj)
{
/* Fix this to work on non-lvalues. */
return build_unary_op (ADDR_EXPR, obj, 0);
}
static void
print_z_candidates (candidates)
struct z_candidate *candidates;
print_z_candidates (struct z_candidate *candidates)
{
const char *str = "candidates are:";
for (; candidates; candidates = candidates->next)
......@@ -2473,9 +2413,7 @@ print_z_candidates (candidates)
per [dcl.init.ref], so we ignore temporary bindings. */
static struct z_candidate *
build_user_type_conversion_1 (totype, expr, flags)
tree totype, expr;
int flags;
build_user_type_conversion_1 (tree totype, tree expr, int flags)
{
struct z_candidate *candidates, *cand;
tree fromtype = TREE_TYPE (expr);
......@@ -2645,9 +2583,7 @@ build_user_type_conversion_1 (totype, expr, flags)
}
tree
build_user_type_conversion (totype, expr, flags)
tree totype, expr;
int flags;
build_user_type_conversion (tree totype, tree expr, int flags)
{
struct z_candidate *cand
= build_user_type_conversion_1 (totype, expr, flags);
......@@ -2664,8 +2600,7 @@ build_user_type_conversion (totype, expr, flags)
/* Do any initial processing on the arguments to a function call. */
static tree
resolve_args (args)
tree args;
resolve_args (tree args)
{
tree t;
for (t = args; t; t = TREE_CHAIN (t))
......@@ -2691,8 +2626,7 @@ resolve_args (args)
with the ARGS. */
tree
build_new_function_call (fn, args)
tree fn, args;
build_new_function_call (tree fn, tree args)
{
struct z_candidate *candidates = 0, *cand;
tree explicit_targs = NULL_TREE;
......@@ -2775,8 +2709,7 @@ build_new_function_call (fn, args)
}
static tree
build_object_call (obj, args)
tree obj, args;
build_object_call (tree obj, tree args)
{
struct z_candidate *candidates = 0, *cand;
tree fns, convs, mem_args = NULL_TREE;
......@@ -2886,10 +2819,8 @@ build_object_call (obj, args)
}
static void
op_error (code, code2, arg1, arg2, arg3, problem)
enum tree_code code, code2;
tree arg1, arg2, arg3;
const char *problem;
op_error (enum tree_code code, enum tree_code code2,
tree arg1, tree arg2, tree arg3, const char *problem)
{
const char *opname;
......@@ -2925,9 +2856,7 @@ op_error (code, code2, arg1, arg2, arg3, problem)
convert E1 to E2 in [expr.cond]. */
static tree
conditional_conversion (e1, e2)
tree e1;
tree e2;
conditional_conversion (tree e1, tree e2)
{
tree t1 = non_reference (TREE_TYPE (e1));
tree t2 = non_reference (TREE_TYPE (e2));
......@@ -2987,16 +2916,13 @@ conditional_conversion (e1, e2)
arguments to the conditional expression. */
tree
build_conditional_expr (arg1, arg2, arg3)
tree arg1;
tree arg2;
tree arg3;
build_conditional_expr (tree arg1, tree arg2, tree arg3)
{
tree arg2_type;
tree arg3_type;
tree result;
tree result_type = NULL_TREE;
int lvalue_p = 1;
bool lvalue_p = true;
struct z_candidate *candidates = 0;
struct z_candidate *cand;
......@@ -3071,7 +2997,7 @@ build_conditional_expr (arg1, arg2, arg3)
return error_mark_node;
}
lvalue_p = 0;
lvalue_p = false;
goto valid_operands;
}
/* [expr.cond]
......@@ -3145,7 +3071,7 @@ build_conditional_expr (arg1, arg2, arg3)
cv-qualified) class type, overload resolution is used to
determine the conversions (if any) to be applied to the operands
(_over.match.oper_, _over.built_). */
lvalue_p = 0;
lvalue_p = false;
if (!same_type_p (arg2_type, arg3_type)
&& (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)))
{
......@@ -3320,10 +3246,7 @@ build_conditional_expr (arg1, arg2, arg3)
}
tree
build_new_op (code, flags, arg1, arg2, arg3)
enum tree_code code;
int flags;
tree arg1, arg2, arg3;
build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3)
{
struct z_candidate *candidates = 0, *cand;
tree fns, mem_arglist = NULL_TREE, arglist, fnname;
......@@ -3714,10 +3637,8 @@ builtin:
PLACEMENT is the corresponding placement new call, or NULL_TREE. */
tree
build_op_delete_call (code, addr, size, flags, placement)
enum tree_code code;
tree addr, size, placement;
int flags;
build_op_delete_call (enum tree_code code, tree addr, tree size,
int flags, tree placement)
{
tree fn = NULL_TREE;
tree fns, fnname, fntype, argtypes, args, type;
......@@ -3853,15 +3774,10 @@ build_op_delete_call (code, addr, size, flags, placement)
BASETYPE_PATH, give an error. The most derived class in
BASETYPE_PATH is the one used to qualify DECL. */
int
enforce_access (basetype_path, decl)
tree basetype_path;
tree decl;
bool
enforce_access (tree basetype_path, tree decl)
{
int accessible;
accessible = accessible_p (basetype_path, decl);
if (!accessible)
if (!accessible_p (basetype_path, decl))
{
if (TREE_PRIVATE (decl))
cp_error_at ("`%+#D' is private", decl);
......@@ -3870,10 +3786,10 @@ enforce_access (basetype_path, decl)
else
cp_error_at ("`%+#D' is inaccessible", decl);
error ("within this context");
return 0;
return false;
}
return 1;
return true;
}
/* Perform the conversions in CONVS on the expression EXPR.
......@@ -3883,11 +3799,7 @@ enforce_access (basetype_path, decl)
reference binding will be applied, positive otherwise. */
static tree
convert_like_real (convs, expr, fn, argnum, inner)
tree convs, expr;
tree fn;
int argnum;
int inner;
convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner)
{
int savew, savee;
......@@ -4104,7 +4016,7 @@ convert_like_real (convs, expr, fn, argnum, inner)
/* Build a call to __builtin_trap which can be used in an expression. */
static tree
call_builtin_trap ()
call_builtin_trap (void)
{
tree fn = get_identifier ("__builtin_trap");
if (IDENTIFIER_GLOBAL_VALUE (fn))
......@@ -4122,8 +4034,7 @@ call_builtin_trap ()
Return the converted value. */
tree
convert_arg_to_ellipsis (arg)
tree arg;
convert_arg_to_ellipsis (tree arg)
{
if (TREE_CODE (TREE_TYPE (arg)) == REAL_TYPE
&& (TYPE_PRECISION (TREE_TYPE (arg))
......@@ -4153,9 +4064,7 @@ call will abort at runtime",
/* va_arg (EXPR, TYPE) is a builtin. Make sure it is not abused. */
tree
build_x_va_arg (expr, type)
tree expr;
tree type;
build_x_va_arg (tree expr, tree type)
{
if (processing_template_decl)
return build_min (VA_ARG_EXPR, type, expr);
......@@ -4180,8 +4089,7 @@ build_x_va_arg (expr, type)
type, or the passed type if there is no change. */
tree
cxx_type_promotes_to (type)
tree type;
cxx_type_promotes_to (tree type)
{
tree promote;
......@@ -4203,11 +4111,7 @@ cxx_type_promotes_to (type)
conversions. Return the converted value. */
tree
convert_default_arg (type, arg, fn, parmnum)
tree type;
tree arg;
tree fn;
int parmnum;
convert_default_arg (tree type, tree arg, tree fn, int parmnum)
{
if (TREE_CODE (arg) == DEFAULT_ARG)
{
......@@ -4258,8 +4162,7 @@ convert_default_arg (type, arg, fn, parmnum)
type TYPE. */
tree
type_passed_as (type)
tree type;
type_passed_as (tree type)
{
/* Pass classes with copy ctors by invisible reference. */
if (TREE_ADDRESSABLE (type))
......@@ -4275,8 +4178,7 @@ type_passed_as (type)
/* Actually perform the appropriate conversion. */
tree
convert_for_arg_passing (type, val)
tree type, val;
convert_for_arg_passing (tree type, tree val)
{
if (val == error_mark_node)
;
......@@ -4296,10 +4198,7 @@ convert_for_arg_passing (type, val)
bitmask of various LOOKUP_* flags which apply to the call itself. */
static tree
build_over_call (cand, args, flags)
struct z_candidate *cand;
tree args;
int flags;
build_over_call (struct z_candidate *cand, tree args, int flags)
{
tree fn = cand->fn;
tree convs = cand->convs;
......@@ -4551,8 +4450,7 @@ static GTY(()) tree java_iface_lookup_fn;
_Jv_LookupInterfaceMethodIdx(). */
static tree
build_java_interface_fn_ref (fn, instance)
tree fn, instance;
build_java_interface_fn_ref (tree fn, tree instance)
{
tree lookup_args, lookup_fn, method, idx;
tree klass_ref, iface, iface_ref;
......@@ -4613,8 +4511,7 @@ build_java_interface_fn_ref (fn, instance)
call to a function with the indicated NAME. */
tree
in_charge_arg_for_name (name)
tree name;
in_charge_arg_for_name (tree name)
{
if (name == base_ctor_identifier
|| name == base_dtor_identifier)
......@@ -4915,12 +4812,11 @@ build_new_method_call (tree instance, tree fns, tree args,
return call;
}
/* Returns nonzero iff standard conversion sequence ICS1 is a proper
/* Returns true iff standard conversion sequence ICS1 is a proper
subsequence of ICS2. */
static int
is_subseq (ics1, ics2)
tree ics1, ics2;
static bool
is_subseq (tree ics1, tree ics2)
{
/* We can assume that a conversion of the same code
between the same types indicates a subsequence since we only get
......@@ -4943,7 +4839,7 @@ is_subseq (ics1, ics2)
ICS2. We can get a USER_CONV when we are comparing the
second standard conversion sequence of two user conversion
sequences. */
return 0;
return false;
ics2 = TREE_OPERAND (ics2, 0);
......@@ -4951,21 +4847,19 @@ is_subseq (ics1, ics2)
&& same_type_p (TREE_TYPE (ics2), TREE_TYPE (ics1))
&& same_type_p (TREE_TYPE (TREE_OPERAND (ics2, 0)),
TREE_TYPE (TREE_OPERAND (ics1, 0))))
return 1;
return true;
}
}
/* Returns nonzero iff DERIVED is derived from BASE. The inputs may
be any _TYPE nodes. */
int
is_properly_derived_from (derived, base)
tree derived;
tree base;
bool
is_properly_derived_from (tree derived, tree base)
{
if (!IS_AGGR_TYPE_CODE (TREE_CODE (derived))
|| !IS_AGGR_TYPE_CODE (TREE_CODE (base)))
return 0;
return false;
/* We only allow proper derivation here. The DERIVED_FROM_P macro
considers every class derived from itself. */
......@@ -4980,8 +4874,7 @@ is_properly_derived_from (derived, base)
modify it accordingly. */
static void
maybe_handle_implicit_object (ics)
tree* ics;
maybe_handle_implicit_object (tree *ics)
{
if (ICS_THIS_FLAG (*ics))
{
......@@ -5016,8 +4909,7 @@ maybe_handle_implicit_object (ics)
leave *ICS unchanged and return NULL_TREE. */
static tree
maybe_handle_ref_bind (ics)
tree* ics;
maybe_handle_ref_bind (tree *ics)
{
if (TREE_CODE (*ics) == REF_BIND)
{
......@@ -5040,8 +4932,7 @@ maybe_handle_ref_bind (ics)
0: ics1 and ics2 are indistinguishable */
static int
compare_ics (ics1, ics2)
tree ics1, ics2;
compare_ics (tree ics1, tree ics2)
{
tree from_type1;
tree from_type2;
......@@ -5377,8 +5268,7 @@ compare_ics (ics1, ics2)
/* The source type for this standard conversion sequence. */
static tree
source_type (t)
tree t;
source_type (tree t)
{
for (;; t = TREE_OPERAND (t, 0))
{
......@@ -5395,8 +5285,7 @@ source_type (t)
is actually used. */
static void
add_warning (winner, loser)
struct z_candidate *winner, *loser;
add_warning (struct z_candidate *winner, struct z_candidate *loser)
{
winner->warnings = tree_cons (NULL_TREE,
build_zc_wrapper (loser),
......@@ -5408,9 +5297,7 @@ add_warning (winner, loser)
both are extern "C". */
static inline int
equal_functions (fn1, fn2)
tree fn1;
tree fn2;
equal_functions (tree fn1, tree fn2)
{
if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2)
|| DECL_EXTERN_C_FUNCTION_P (fn1))
......@@ -5426,9 +5313,7 @@ equal_functions (fn1, fn2)
0: cand1 and cand2 are indistinguishable */
static int
joust (cand1, cand2, warn)
struct z_candidate *cand1, *cand2;
int warn;
joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
{
int winner = 0;
int i, off1 = 0, off2 = 0, len;
......@@ -5702,8 +5587,7 @@ tweak:
algorithm. */
static struct z_candidate *
tourney (candidates)
struct z_candidate *candidates;
tourney (struct z_candidate *candidates)
{
struct z_candidate *champ = candidates, *challenger;
int fate;
......@@ -5754,18 +5638,16 @@ tourney (candidates)
/* Returns nonzero if things of type FROM can be converted to TO. */
int
can_convert (to, from)
tree to, from;
bool
can_convert (tree to, tree from)
{
return can_convert_arg (to, from, NULL_TREE);
}
/* Returns nonzero if ARG (of type FROM) can be converted to TO. */
int
can_convert_arg (to, from, arg)
tree to, from, arg;
bool
can_convert_arg (tree to, tree from, tree arg)
{
tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
return (t && ! ICS_BAD_FLAG (t));
......@@ -5773,12 +5655,10 @@ can_convert_arg (to, from, arg)
/* Like can_convert_arg, but allows dubious conversions as well. */
int
can_convert_arg_bad (to, from, arg)
tree to, from, arg;
bool
can_convert_arg_bad (tree to, tree from, tree arg)
{
tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
return !!t;
return implicit_conversion (to, from, arg, LOOKUP_NORMAL) != 0;
}
/* Convert EXPR to TYPE. Return the converted expression.
......@@ -5788,9 +5668,7 @@ can_convert_arg_bad (to, from, arg)
doing a bad conversion, convert_like will complain. */
tree
perform_implicit_conversion (type, expr)
tree type;
tree expr;
perform_implicit_conversion (tree type, tree expr)
{
tree conv;
......@@ -5812,9 +5690,7 @@ perform_implicit_conversion (type, expr)
expression. */
tree
initialize_reference (type, expr)
tree type;
tree expr;
initialize_reference (tree type, tree expr)
{
tree conv;
......
......@@ -3535,39 +3535,40 @@ extern operator_name_info_t operator_name_info[];
extern operator_name_info_t assignment_operator_name_info[];
/* in call.c */
extern int check_dtor_name PARAMS ((tree, tree));
extern bool check_dtor_name (tree, tree);
extern int get_arglist_len_in_bytes PARAMS ((tree));
extern tree build_vfield_ref PARAMS ((tree, tree));
extern tree build_scoped_method_call PARAMS ((tree, tree, tree, tree));
extern tree build_scoped_method_call (tree, tree, tree, tree);
extern tree build_conditional_expr PARAMS ((tree, tree, tree));
extern tree build_addr_func PARAMS ((tree));
extern tree build_call PARAMS ((tree, tree));
extern tree build_method_call PARAMS ((tree, tree, tree, tree, int));
extern int null_ptr_cst_p PARAMS ((tree));
extern int sufficient_parms_p PARAMS ((tree));
extern tree type_decays_to PARAMS ((tree));
extern tree build_user_type_conversion PARAMS ((tree, tree, int));
extern tree build_new_function_call PARAMS ((tree, tree));
extern tree build_new_method_call (tree, tree, tree, tree, int);
extern tree build_special_member_call (tree, tree, tree, tree, int);
extern tree build_new_op PARAMS ((enum tree_code, int, tree, tree, tree));
extern tree build_op_delete_call PARAMS ((enum tree_code, tree, tree, int, tree));
extern int can_convert PARAMS ((tree, tree));
extern int can_convert_arg PARAMS ((tree, tree, tree));
extern int can_convert_arg_bad PARAMS ((tree, tree, tree));
extern int enforce_access PARAMS ((tree, tree));
extern tree convert_default_arg PARAMS ((tree, tree, tree, int));
extern tree convert_arg_to_ellipsis PARAMS ((tree));
extern tree build_x_va_arg PARAMS ((tree, tree));
extern tree cxx_type_promotes_to PARAMS ((tree));
extern tree type_passed_as PARAMS ((tree));
extern tree convert_for_arg_passing PARAMS ((tree, tree));
extern tree build_addr_func (tree);
extern tree build_call (tree, tree);
extern tree build_method_call (tree, tree, tree, tree, int);
extern bool null_ptr_cst_p (tree);
extern bool sufficient_parms_p (tree);
extern tree type_decays_to (tree);
extern tree build_user_type_conversion (tree, tree, int);
extern tree build_new_function_call (tree, tree);
extern tree build_new_method_call (tree, tree, tree, tree, int);
extern tree build_special_member_call (tree, tree, tree, tree, int);
extern tree build_new_op (enum tree_code, int, tree, tree, tree);
extern tree build_op_delete_call (enum tree_code, tree, tree, int, tree);
extern bool can_convert (tree, tree);
extern bool can_convert_arg (tree, tree, tree);
extern bool can_convert_arg_bad (tree, tree, tree);
extern bool enforce_access (tree, tree);
extern tree convert_default_arg (tree, tree, tree, int);
extern tree convert_arg_to_ellipsis (tree);
extern tree build_x_va_arg (tree, tree);
extern tree cxx_type_promotes_to (tree);
extern tree type_passed_as (tree);
extern tree convert_for_arg_passing (tree, tree);
extern tree cp_convert_parm_for_inlining PARAMS ((tree, tree, tree));
extern int is_properly_derived_from PARAMS ((tree, tree));
extern tree initialize_reference PARAMS ((tree, tree));
extern tree strip_top_quals PARAMS ((tree));
extern tree perform_implicit_conversion PARAMS ((tree, tree));
extern bool is_properly_derived_from (tree, tree);
extern tree initialize_reference (tree, tree);
extern tree strip_top_quals (tree);
extern tree perform_implicit_conversion (tree, tree);
extern tree in_charge_arg_for_name (tree);
/* in class.c */
extern tree build_base_path PARAMS ((enum tree_code, tree, tree, int));
......@@ -3611,7 +3612,6 @@ extern void invalidate_class_lookup_cache PARAMS ((void));
extern void maybe_note_name_used_in_class PARAMS ((tree, tree));
extern void note_name_declared_in_class PARAMS ((tree, tree));
extern tree get_vtbl_decl_for_binfo PARAMS ((tree));
extern tree in_charge_arg_for_name PARAMS ((tree));
extern tree get_vtt_name PARAMS ((tree));
extern tree get_primary_binfo PARAMS ((tree));
......
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