Remove traditional C constructs 3/n.
* cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, warn_ref_binding, convert_to_reference, convert_from_reference, convert_lvalue, cp_convert, ocp_convert, convert_to_void, convert, convert_force, build_type_conversion, build_expr_type_conversion, type_promotes_to, perform_qualification_conversions): Use C90 prototyping style. * decl2.c (grok_array_decl): Use boolean constant. (delete_sanity): Likewise. * typeck.c (build_unary_op): Likewise. * semantics.c (finish_switch_cond): Likewise. * parser.c (cp_parser_direct_new_declarator): Likewise. * init.c (build_new): Likewise. From-SVN: r60574
This commit is contained in:
parent
b9b21a05ce
commit
b746c5dc67
@ -1,3 +1,19 @@
|
||||
2002-12-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
Remove traditional C constructs 3/n.
|
||||
* cvt.c (cp_convert_to_pointer, convert_to_pointer_force,
|
||||
build_up_reference, warn_ref_binding, convert_to_reference,
|
||||
convert_from_reference, convert_lvalue, cp_convert, ocp_convert,
|
||||
convert_to_void, convert, convert_force, build_type_conversion,
|
||||
build_expr_type_conversion, type_promotes_to,
|
||||
perform_qualification_conversions): Use C90 prototyping style.
|
||||
* decl2.c (grok_array_decl): Use boolean constant.
|
||||
(delete_sanity): Likewise.
|
||||
* typeck.c (build_unary_op): Likewise.
|
||||
* semantics.c (finish_switch_cond): Likewise.
|
||||
* parser.c (cp_parser_direct_new_declarator): Likewise.
|
||||
* init.c (build_new): Likewise.
|
||||
|
||||
2002-12-27 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* Make-lang.in (po-generated): Remove parse.c.
|
||||
@ -196,29 +212,30 @@
|
||||
|
||||
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.
|
||||
Remove traditional C constructs 2/n.
|
||||
* 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>
|
||||
|
||||
|
@ -3641,17 +3641,17 @@ extern tree get_vtt_name PARAMS ((tree));
|
||||
extern tree get_primary_binfo PARAMS ((tree));
|
||||
|
||||
/* in cvt.c */
|
||||
extern tree convert_to_reference PARAMS ((tree, tree, int, int, tree));
|
||||
extern tree convert_from_reference PARAMS ((tree));
|
||||
extern tree convert_lvalue PARAMS ((tree, tree));
|
||||
extern tree ocp_convert PARAMS ((tree, tree, int, int));
|
||||
extern tree cp_convert PARAMS ((tree, tree));
|
||||
extern tree convert_to_void PARAMS ((tree, const char */*implicit context*/));
|
||||
extern tree convert_force PARAMS ((tree, tree, int));
|
||||
extern tree build_type_conversion PARAMS ((tree, tree, int));
|
||||
extern tree build_expr_type_conversion PARAMS ((int, tree, int));
|
||||
extern tree type_promotes_to PARAMS ((tree));
|
||||
extern tree perform_qualification_conversions PARAMS ((tree, tree));
|
||||
extern tree convert_to_reference (tree, tree, int, int, tree);
|
||||
extern tree convert_from_reference (tree);
|
||||
extern tree convert_lvalue (tree, tree);
|
||||
extern tree ocp_convert (tree, tree, int, int);
|
||||
extern tree cp_convert (tree, tree);
|
||||
extern tree convert_to_void (tree, const char */*implicit context*/);
|
||||
extern tree convert_force (tree, tree, int);
|
||||
extern tree build_type_conversion (tree, tree, int);
|
||||
extern tree build_expr_type_conversion (int, tree, bool);
|
||||
extern tree type_promotes_to (tree);
|
||||
extern tree perform_qualification_conversions (tree, tree);
|
||||
extern void clone_function_decl PARAMS ((tree, int));
|
||||
extern void adjust_clone_args PARAMS ((tree));
|
||||
|
||||
|
77
gcc/cp/cvt.c
77
gcc/cp/cvt.c
@ -37,10 +37,10 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "toplev.h"
|
||||
#include "decl.h"
|
||||
|
||||
static tree cp_convert_to_pointer PARAMS ((tree, tree, int));
|
||||
static tree convert_to_pointer_force PARAMS ((tree, tree));
|
||||
static tree build_up_reference PARAMS ((tree, tree, int, tree));
|
||||
static void warn_ref_binding PARAMS ((tree, tree, tree));
|
||||
static tree cp_convert_to_pointer (tree, tree, bool);
|
||||
static tree convert_to_pointer_force (tree, tree);
|
||||
static tree build_up_reference (tree, tree, int, tree);
|
||||
static void warn_ref_binding (tree, tree, tree);
|
||||
|
||||
/* Change of width--truncation and extension of integers or reals--
|
||||
is represented with NOP_EXPR. Proper functioning of many things
|
||||
@ -74,9 +74,7 @@ static void warn_ref_binding PARAMS ((tree, tree, tree));
|
||||
but not static_cast). */
|
||||
|
||||
static tree
|
||||
cp_convert_to_pointer (type, expr, force)
|
||||
tree type, expr;
|
||||
int force;
|
||||
cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
{
|
||||
register tree intype = TREE_TYPE (expr);
|
||||
register enum tree_code form;
|
||||
@ -92,7 +90,7 @@ cp_convert_to_pointer (type, expr, force)
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
rval = build_type_conversion (type, expr, 1);
|
||||
rval = build_type_conversion (type, expr, true);
|
||||
if (rval)
|
||||
{
|
||||
if (rval == error_mark_node)
|
||||
@ -292,8 +290,7 @@ cp_convert_to_pointer (type, expr, force)
|
||||
(such as conversion from sub-type to private super-type). */
|
||||
|
||||
static tree
|
||||
convert_to_pointer_force (type, expr)
|
||||
tree type, expr;
|
||||
convert_to_pointer_force (tree type, tree expr)
|
||||
{
|
||||
register tree intype = TREE_TYPE (expr);
|
||||
register enum tree_code form = TREE_CODE (intype);
|
||||
@ -340,7 +337,7 @@ convert_to_pointer_force (type, expr)
|
||||
}
|
||||
}
|
||||
|
||||
return cp_convert_to_pointer (type, expr, 1);
|
||||
return cp_convert_to_pointer (type, expr, true);
|
||||
}
|
||||
|
||||
/* We are passing something to a function which requires a reference.
|
||||
@ -352,9 +349,7 @@ convert_to_pointer_force (type, expr)
|
||||
If DIRECT_BIND is set, DECL is the reference we're binding to. */
|
||||
|
||||
static tree
|
||||
build_up_reference (type, arg, flags, decl)
|
||||
tree type, arg, decl;
|
||||
int flags;
|
||||
build_up_reference (tree type, tree arg, int flags, tree decl)
|
||||
{
|
||||
tree rval;
|
||||
tree argtype = TREE_TYPE (arg);
|
||||
@ -441,8 +436,7 @@ build_up_reference (type, arg, flags, decl)
|
||||
non-volatile const type. */
|
||||
|
||||
static void
|
||||
warn_ref_binding (reftype, intype, decl)
|
||||
tree reftype, intype, decl;
|
||||
warn_ref_binding (tree reftype, tree intype, tree decl)
|
||||
{
|
||||
tree ttl = TREE_TYPE (reftype);
|
||||
|
||||
@ -471,10 +465,8 @@ warn_ref_binding (reftype, intype, decl)
|
||||
we know it's an initialization. */
|
||||
|
||||
tree
|
||||
convert_to_reference (reftype, expr, convtype, flags, decl)
|
||||
tree reftype, expr;
|
||||
int convtype, flags;
|
||||
tree decl;
|
||||
convert_to_reference (tree reftype, tree expr, int convtype,
|
||||
int flags, tree decl)
|
||||
{
|
||||
register tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype));
|
||||
register tree intype;
|
||||
@ -591,8 +583,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
|
||||
way down to its lowest form. */
|
||||
|
||||
tree
|
||||
convert_from_reference (val)
|
||||
tree val;
|
||||
convert_from_reference (tree val)
|
||||
{
|
||||
tree type = TREE_TYPE (val);
|
||||
|
||||
@ -607,8 +598,7 @@ convert_from_reference (val)
|
||||
preserving cv-qualification. */
|
||||
|
||||
tree
|
||||
convert_lvalue (totype, expr)
|
||||
tree totype, expr;
|
||||
convert_lvalue (tree totype, tree expr)
|
||||
{
|
||||
totype = cp_build_qualified_type (totype, TYPE_QUALS (TREE_TYPE (expr)));
|
||||
totype = build_reference_type (totype);
|
||||
@ -620,8 +610,7 @@ convert_lvalue (totype, expr)
|
||||
/* C++ conversions, preference to static cast conversions. */
|
||||
|
||||
tree
|
||||
cp_convert (type, expr)
|
||||
tree type, expr;
|
||||
cp_convert (tree type, tree expr)
|
||||
{
|
||||
return ocp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL);
|
||||
}
|
||||
@ -631,9 +620,7 @@ cp_convert (type, expr)
|
||||
FLAGS indicates how we should behave. */
|
||||
|
||||
tree
|
||||
ocp_convert (type, expr, convtype, flags)
|
||||
tree type, expr;
|
||||
int convtype, flags;
|
||||
ocp_convert (tree type, tree expr, int convtype, int flags)
|
||||
{
|
||||
register tree e = expr;
|
||||
register enum tree_code code = TREE_CODE (type);
|
||||
@ -732,7 +719,7 @@ ocp_convert (type, expr, convtype, flags)
|
||||
}
|
||||
if (code == POINTER_TYPE || code == REFERENCE_TYPE
|
||||
|| TYPE_PTRMEMFUNC_P (type))
|
||||
return fold (cp_convert_to_pointer (type, e, 0));
|
||||
return fold (cp_convert_to_pointer (type, e, false));
|
||||
if (code == VECTOR_TYPE)
|
||||
return fold (convert_to_vector (type, e));
|
||||
if (code == REAL_TYPE || code == COMPLEX_TYPE)
|
||||
@ -817,9 +804,7 @@ ocp_convert (type, expr, convtype, flags)
|
||||
IMPLICIT is tells us the context of an implicit void conversion. */
|
||||
|
||||
tree
|
||||
convert_to_void (expr, implicit)
|
||||
tree expr;
|
||||
const char *implicit;
|
||||
convert_to_void (tree expr, const char *implicit)
|
||||
{
|
||||
if (expr == error_mark_node
|
||||
|| TREE_TYPE (expr) == error_mark_node)
|
||||
@ -957,8 +942,7 @@ convert_to_void (expr, implicit)
|
||||
do a little bit more work. */
|
||||
|
||||
tree
|
||||
convert (type, expr)
|
||||
tree type, expr;
|
||||
convert (tree type, tree expr)
|
||||
{
|
||||
tree intype;
|
||||
|
||||
@ -982,10 +966,7 @@ convert (type, expr)
|
||||
(such as conversion from sub-type to private super-type). */
|
||||
|
||||
tree
|
||||
convert_force (type, expr, convtype)
|
||||
tree type;
|
||||
tree expr;
|
||||
int convtype;
|
||||
convert_force (tree type, tree expr, int convtype)
|
||||
{
|
||||
register tree e = expr;
|
||||
register enum tree_code code = TREE_CODE (type);
|
||||
@ -1032,9 +1013,7 @@ convert_force (type, expr, convtype)
|
||||
(jason 8/9/95) */
|
||||
|
||||
tree
|
||||
build_type_conversion (xtype, expr, for_sure)
|
||||
tree xtype, expr;
|
||||
int for_sure;
|
||||
build_type_conversion (tree xtype, tree expr, int for_sure)
|
||||
{
|
||||
/* C++: check to see if we can convert this aggregate type
|
||||
into the required type. */
|
||||
@ -1044,14 +1023,11 @@ build_type_conversion (xtype, expr, for_sure)
|
||||
|
||||
/* Convert the given EXPR to one of a group of types suitable for use in an
|
||||
expression. DESIRES is a combination of various WANT_* flags (q.v.)
|
||||
which indicates which types are suitable. If COMPLAIN is 1, complain
|
||||
which indicates which types are suitable. If COMPLAIN is true, complain
|
||||
about ambiguity; otherwise, the caller will deal with it. */
|
||||
|
||||
tree
|
||||
build_expr_type_conversion (desires, expr, complain)
|
||||
int desires;
|
||||
tree expr;
|
||||
int complain;
|
||||
build_expr_type_conversion (int desires, tree expr, bool complain)
|
||||
{
|
||||
tree basetype = TREE_TYPE (expr);
|
||||
tree conv = NULL_TREE;
|
||||
@ -1162,8 +1138,7 @@ build_expr_type_conversion (desires, expr, complain)
|
||||
/* Implements integral promotion (4.1) and float->double promotion. */
|
||||
|
||||
tree
|
||||
type_promotes_to (type)
|
||||
tree type;
|
||||
type_promotes_to (tree type)
|
||||
{
|
||||
int type_quals;
|
||||
|
||||
@ -1217,9 +1192,7 @@ type_promotes_to (type)
|
||||
the conversion was impossible. */
|
||||
|
||||
tree
|
||||
perform_qualification_conversions (type, expr)
|
||||
tree type;
|
||||
tree expr;
|
||||
perform_qualification_conversions (tree type, tree expr)
|
||||
{
|
||||
if (TREE_CODE (type) == POINTER_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE
|
||||
|
@ -448,15 +448,15 @@ grok_array_decl (array_expr, index_exp)
|
||||
if (TREE_CODE (type) == ARRAY_TYPE)
|
||||
p1 = array_expr;
|
||||
else
|
||||
p1 = build_expr_type_conversion (WANT_POINTER, array_expr, 0);
|
||||
p1 = build_expr_type_conversion (WANT_POINTER, array_expr, false);
|
||||
|
||||
if (TREE_CODE (TREE_TYPE (index_exp)) == ARRAY_TYPE)
|
||||
p2 = index_exp;
|
||||
else
|
||||
p2 = build_expr_type_conversion (WANT_POINTER, index_exp, 0);
|
||||
p2 = build_expr_type_conversion (WANT_POINTER, index_exp, false);
|
||||
|
||||
i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr, 0);
|
||||
i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, 0);
|
||||
i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr, false);
|
||||
i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, false);
|
||||
|
||||
if ((p1 && i2) && (i1 && p2))
|
||||
error ("ambiguous conversion for array subscript");
|
||||
@ -511,7 +511,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
|
||||
exp = resolve_offset_ref (exp);
|
||||
exp = convert_from_reference (exp);
|
||||
t = stabilize_reference (exp);
|
||||
t = build_expr_type_conversion (WANT_POINTER, t, 1);
|
||||
t = build_expr_type_conversion (WANT_POINTER, t, true);
|
||||
|
||||
if (t == NULL_TREE || t == error_mark_node)
|
||||
{
|
||||
|
@ -1958,7 +1958,7 @@ build_new (placement, decl, init, use_global_new)
|
||||
else
|
||||
{
|
||||
if (build_expr_type_conversion (WANT_INT | WANT_ENUM,
|
||||
this_nelts, 0)
|
||||
this_nelts, false)
|
||||
== NULL_TREE)
|
||||
pedwarn ("size in array new must have integral type");
|
||||
|
||||
|
@ -4863,7 +4863,7 @@ cp_parser_direct_new_declarator (parser)
|
||||
expression
|
||||
= build_expr_type_conversion (WANT_INT | WANT_ENUM,
|
||||
expression,
|
||||
/*complain=*/1);
|
||||
/*complain=*/true);
|
||||
if (!expression)
|
||||
{
|
||||
error ("expression in new-declarator must have integral or enumeration type");
|
||||
|
@ -553,7 +553,7 @@ finish_switch_cond (cond, switch_stmt)
|
||||
tree index;
|
||||
|
||||
/* Convert the condition to an integer or enumeration type. */
|
||||
cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, 1);
|
||||
cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, true);
|
||||
if (cond == NULL_TREE)
|
||||
{
|
||||
error ("switch quantity not an integer");
|
||||
|
@ -3951,7 +3951,7 @@ build_unary_op (code, xarg, noconvert)
|
||||
is enough to prevent anybody from looking inside for
|
||||
associativity, but won't generate any code. */
|
||||
if (!(arg = build_expr_type_conversion
|
||||
(WANT_ARITH | WANT_ENUM | WANT_POINTER, arg, 1)))
|
||||
(WANT_ARITH | WANT_ENUM | WANT_POINTER, arg, true)))
|
||||
errstring = "wrong type argument to unary plus";
|
||||
else
|
||||
{
|
||||
@ -3963,7 +3963,7 @@ build_unary_op (code, xarg, noconvert)
|
||||
break;
|
||||
|
||||
case NEGATE_EXPR:
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, true)))
|
||||
errstring = "wrong type argument to unary minus";
|
||||
else if (!noconvert)
|
||||
arg = default_conversion (arg);
|
||||
@ -3977,14 +3977,14 @@ build_unary_op (code, xarg, noconvert)
|
||||
arg = default_conversion (arg);
|
||||
}
|
||||
else if (!(arg = build_expr_type_conversion (WANT_INT | WANT_ENUM,
|
||||
arg, 1)))
|
||||
arg, true)))
|
||||
errstring = "wrong type argument to bit-complement";
|
||||
else if (!noconvert)
|
||||
arg = default_conversion (arg);
|
||||
break;
|
||||
|
||||
case ABS_EXPR:
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, true)))
|
||||
errstring = "wrong type argument to abs";
|
||||
else if (!noconvert)
|
||||
arg = default_conversion (arg);
|
||||
@ -3992,7 +3992,7 @@ build_unary_op (code, xarg, noconvert)
|
||||
|
||||
case CONJ_EXPR:
|
||||
/* Conjugating a real value is a no-op, but allow it anyway. */
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, true)))
|
||||
errstring = "wrong type argument to conjugation";
|
||||
else if (!noconvert)
|
||||
arg = default_conversion (arg);
|
||||
@ -4052,7 +4052,7 @@ build_unary_op (code, xarg, noconvert)
|
||||
/* Report invalid types. */
|
||||
|
||||
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_POINTER,
|
||||
arg, 1)))
|
||||
arg, true)))
|
||||
{
|
||||
if (code == PREINCREMENT_EXPR)
|
||||
errstring ="no pre-increment operator for type";
|
||||
|
Loading…
Reference in New Issue
Block a user