Commit c2ea3a40 by Nathan Sidwell Committed by Nathan Sidwell

Rename instantiate_type_flags to tsubst_flags_t & expand use.

	* cp-tree.h (instantiate_type_flags): Rename to ...
	(tsubst_flags_t): ... here. Rename itf_complain to tf_error,
	add tf_warning flag.
	(instantiate_type): Adjust prototype.
	(tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
	do_type_instantiation, cp_build_qualified_type_real): Likewise.
	cp_build_qualified_type: Adjust.
	* class.c (instantiate_type): Adjust parameter. Rename itf_* to
	tf_*.
	* call.c (standard_conversion): Rename itf_* to tf_*.
	(reference_binding): Likewise.
	(convert_like_real): Likewise.
	* cvt.c (cp_convert_to_pointer): Likewise.
	(convert_to_reference): Likewise.
	* decl.c (lookup_namespace_name): Use tf_* flags.
	(make_typename_type): Likewise.
	(grokdeclarator): Likewise.
	* pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
	(coerce_template_template_parms, convert_template_argument,
	coerce_template_parms, maybe_get_template_decl_from_type_decl,
	lookup_template_class, tsubst_friend_function, tsubst_friend_class,
	instantiate_class_template, tsubst_template_arg_vector,
	tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
	tsubst_decl, tsubst_arg_types, tsubst_function_type,
	tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
	instantiate_template, fn_type_unification,
	resolve_overloaded_unification, verify_class_unification,
	unify, get_bindings_real, do_type_instantiation,
	regenerate_decl_from_template, instantiate_decl,
	tsubst_initializer_list, tsubst_enum,
	get_mostly_instantiated_function_type,
	invalid_nontype_parm_type_p): Likewise.
	* tree.c (cp_build_qualified_type_real): Likewise.
	* typeck.c (build_binary_op): Rename itf_* to tf_*.
	(build_ptrmemfunc): Likewise.
	(convert_for_assignment): Likewise.

From-SVN: r49591
parent 3ab57fab
2002-02-07 Nathan Sidwell <nathan@codesourcery.com>
Rename instantiate_type_flags to tsubst_flags_t & expand use.
* cp-tree.h (instantiate_type_flags): Rename to ...
(tsubst_flags_t): ... here. Rename itf_complain to tf_error,
add tf_warning flag.
(instantiate_type): Adjust prototype.
(tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
do_type_instantiation, cp_build_qualified_type_real): Likewise.
cp_build_qualified_type: Adjust.
* class.c (instantiate_type): Adjust parameter. Rename itf_* to
tf_*.
* call.c (standard_conversion): Rename itf_* to tf_*.
(reference_binding): Likewise.
(convert_like_real): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
* decl.c (lookup_namespace_name): Use tf_* flags.
(make_typename_type): Likewise.
(grokdeclarator): Likewise.
* pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
(coerce_template_template_parms, convert_template_argument,
coerce_template_parms, maybe_get_template_decl_from_type_decl,
lookup_template_class, tsubst_friend_function, tsubst_friend_class,
instantiate_class_template, tsubst_template_arg_vector,
tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
tsubst_decl, tsubst_arg_types, tsubst_function_type,
tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
instantiate_template, fn_type_unification,
resolve_overloaded_unification, verify_class_unification,
unify, get_bindings_real, do_type_instantiation,
regenerate_decl_from_template, instantiate_decl,
tsubst_initializer_list, tsubst_enum,
get_mostly_instantiated_function_type,
invalid_nontype_parm_type_p): Likewise.
* tree.c (cp_build_qualified_type_real): Likewise.
* typeck.c (build_binary_op): Rename itf_* to tf_*.
(build_ptrmemfunc): Likewise.
(convert_for_assignment): Likewise.
2002-02-07 Nathan Sidwell <nathan@codesourcery.com>
PR c++/109
* decl.c (grokdeclarator): Allow friend declarations from
dependant types.
......
......@@ -705,7 +705,7 @@ standard_conversion (to, from, expr)
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
{
expr = instantiate_type (to, expr, itf_none);
expr = instantiate_type (to, expr, tf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
......@@ -1108,7 +1108,7 @@ reference_binding (rto, rfrom, expr, flags)
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
{
expr = instantiate_type (to, expr, itf_none);
expr = instantiate_type (to, expr, tf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
......@@ -3864,7 +3864,7 @@ convert_like_real (convs, expr, fn, argnum, inner)
}
case IDENTITY_CONV:
if (type_unknown_p (expr))
expr = instantiate_type (totype, expr, itf_complain);
expr = instantiate_type (totype, expr, tf_error | tf_warning);
return expr;
case AMBIG_CONV:
/* Call build_user_type_conversion again for the error. */
......
......@@ -6043,14 +6043,14 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
tree
instantiate_type (lhstype, rhs, flags)
tree lhstype, rhs;
enum instantiate_type_flags flags;
tsubst_flags_t flags;
{
int complain = (flags & itf_complain);
int strict = (flags & itf_no_attributes)
int complain = (flags & tf_error);
int strict = (flags & tf_no_attributes)
? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
int allow_ptrmem = flags & itf_ptrmem_ok;
int allow_ptrmem = flags & tf_ptrmem_ok;
flags &= ~itf_ptrmem_ok;
flags &= ~tf_ptrmem_ok;
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
......@@ -6257,7 +6257,7 @@ instantiate_type (lhstype, rhs, flags)
case ADDR_EXPR:
{
if (PTRMEM_OK_P (rhs))
flags |= itf_ptrmem_ok;
flags |= tf_ptrmem_ok;
return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
}
......
......@@ -3063,13 +3063,16 @@ typedef enum linkage_kind {
lk_external /* External linkage. */
} linkage_kind;
/* Bitmask flags to pass to instantiate_type. */
typedef enum instantiate_type_flags {
itf_none = 0, /* nothing special */
itf_complain = 1 << 0, /* complain about errors */
itf_no_attributes = 1 << 1, /* ignore attributes on comparisons */
itf_ptrmem_ok = 1 << 2, /* pointers to member ok (internal use) */
} instantiate_type_flags;
/* Bitmask flags to control type substitution. */
typedef enum tsubst_flags_t {
tf_none = 0, /* nothing special */
tf_error = 1 << 0, /* give error messages */
tf_warning = 1 << 1, /* give warnings too */
tf_no_attributes = 1 << 2, /* ignore attributes on comparisons
(instantiate_type use) */
tf_ptrmem_ok = 1 << 3 /* pointers to member ok (internal
instantiate_type use) */
} tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */
typedef enum base_access {
......@@ -3598,7 +3601,7 @@ extern void pop_nested_class PARAMS ((void));
extern int current_lang_depth PARAMS ((void));
extern void push_lang_context PARAMS ((tree));
extern void pop_lang_context PARAMS ((void));
extern tree instantiate_type PARAMS ((tree, tree, enum instantiate_type_flags));
extern tree instantiate_type PARAMS ((tree, tree, tsubst_flags_t));
extern void print_class_statistics PARAMS ((void));
extern void cxx_print_statistics PARAMS ((void));
extern void cxx_print_xnode PARAMS ((FILE *, tree, int));
......@@ -3972,9 +3975,9 @@ extern int maybe_clone_body PARAMS ((tree));
extern void init_pt PARAMS ((void));
extern void check_template_shadow PARAMS ((tree));
extern tree get_innermost_template_args PARAMS ((tree, int));
extern tree tsubst PARAMS ((tree, tree, int, tree));
extern tree tsubst_expr PARAMS ((tree, tree, int, tree));
extern tree tsubst_copy PARAMS ((tree, tree, int, tree));
extern tree tsubst PARAMS ((tree, tree, tsubst_flags_t, tree));
extern tree tsubst_expr PARAMS ((tree, tree, tsubst_flags_t, tree));
extern tree tsubst_copy PARAMS ((tree, tree, tsubst_flags_t, tree));
extern void maybe_begin_member_template_processing PARAMS ((tree));
extern void maybe_end_member_template_processing PARAMS ((void));
extern tree finish_member_template_decl PARAMS ((tree));
......@@ -3992,7 +3995,7 @@ extern tree current_template_args PARAMS ((void));
extern tree push_template_decl PARAMS ((tree));
extern tree push_template_decl_real PARAMS ((tree, int));
extern void redeclare_class_template PARAMS ((tree, tree));
extern tree lookup_template_class PARAMS ((tree, tree, tree, tree, int, int));
extern tree lookup_template_class PARAMS ((tree, tree, tree, tree, int, tsubst_flags_t));
extern tree lookup_template_function PARAMS ((tree, tree));
extern int uses_template_parms PARAMS ((tree));
extern tree instantiate_class_template PARAMS ((tree));
......@@ -4003,7 +4006,7 @@ extern void mark_decl_instantiated PARAMS ((tree, int));
extern int more_specialized PARAMS ((tree, tree, int, int));
extern void mark_class_instantiated PARAMS ((tree, int));
extern void do_decl_instantiation PARAMS ((tree, tree, tree));
extern void do_type_instantiation PARAMS ((tree, tree, int));
extern void do_type_instantiation PARAMS ((tree, tree, tsubst_flags_t));
extern tree instantiate_decl PARAMS ((tree, int));
extern tree get_bindings PARAMS ((tree, tree, tree));
extern int push_tinst_level PARAMS ((tree));
......@@ -4262,9 +4265,9 @@ extern tree maybe_dummy_object PARAMS ((tree, tree *));
extern int is_dummy_object PARAMS ((tree));
extern const struct attribute_spec cp_attribute_table[];
extern tree make_ptrmem_cst PARAMS ((tree, tree));
extern tree cp_build_qualified_type_real PARAMS ((tree, int, int));
extern tree cp_build_qualified_type_real PARAMS ((tree, int, tsubst_flags_t));
#define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1)
cp_build_qualified_type_real ((TYPE), (QUALS), tf_error | tf_warning)
extern tree build_shared_int_cst PARAMS ((int));
extern special_function_kind special_function_p PARAMS ((tree));
extern int count_trees PARAMS ((tree));
......
......@@ -267,7 +267,7 @@ cp_convert_to_pointer (type, expr, force)
}
if (type_unknown_p (expr))
return instantiate_type (type, expr, itf_complain);
return instantiate_type (type, expr, tf_error | tf_warning);
error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
......@@ -478,7 +478,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
{
expr = instantiate_type (type, expr,
(flags & LOOKUP_COMPLAIN)
? itf_complain : itf_none);
? tf_error | tf_warning : tf_none);
if (expr == error_mark_node)
return error_mark_node;
......
......@@ -5491,7 +5491,7 @@ lookup_namespace_name (namespace, name)
/*in_decl=*/NULL_TREE,
/*context=*/NULL_TREE,
/*entering_scope=*/0,
/*complain=*/1);
tf_error | tf_warning);
else if (DECL_FUNCTION_TEMPLATE_P (val)
|| TREE_CODE (val) == OVERLOAD)
val = lookup_template_function (val,
......@@ -5680,7 +5680,7 @@ make_typename_type (context, name, complain)
TREE_OPERAND (fullname, 1),
NULL_TREE, context,
/*entering_scope=*/0,
/*complain=*/1);
tf_error | tf_warning);
}
else
{
......@@ -10906,7 +10906,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& uses_template_parms (current_class_type))
{
tree args = current_template_args ();
type = tsubst (type, args, /*complain=*/1, NULL_TREE);
type = tsubst (type, args, tf_error | tf_warning,
NULL_TREE);
}
/* This pop_nested_class corresponds to the
......
......@@ -505,16 +505,15 @@ build_cplus_array_type (elt_type, index_type)
/* Make a variant of TYPE, qualified with the TYPE_QUALS. Handles
arrays correctly. In particular, if TYPE is an array of T's, and
TYPE_QUALS is non-empty, returns an array of qualified T's. If
at attempt is made to qualify a type illegally, and COMPLAIN is
non-zero, an error is issued. If COMPLAIN is zero, error_mark_node
is returned. */
TYPE_QUALS is non-empty, returns an array of qualified T's.
Errors are emitted under control of COMPLAIN. If COMPLAIN is zero,
error_mark_node is returned for bad qualifiers. */
tree
cp_build_qualified_type_real (type, type_quals, complain)
tree type;
int type_quals;
int complain;
tsubst_flags_t complain;
{
tree result;
......@@ -532,7 +531,7 @@ cp_build_qualified_type_real (type, type_quals, complain)
|| TYPE_PTRMEM_P (type)
|| TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE))
{
if (complain)
if (complain & tf_error)
error ("`%T' cannot be `restrict'-qualified", type);
else
return error_mark_node;
......@@ -543,7 +542,7 @@ cp_build_qualified_type_real (type, type_quals, complain)
if (type_quals != TYPE_UNQUALIFIED
&& TREE_CODE (type) == FUNCTION_TYPE)
{
if (complain)
if (complain & tf_error)
error ("`%T' cannot be `const'-, `volatile'-, or `restrict'-qualified", type);
else
return error_mark_node;
......
......@@ -3414,7 +3414,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
/* DTRT if one side is an overloaded function, but complain about it. */
if (type_unknown_p (op0))
{
tree t = instantiate_type (TREE_TYPE (op1), op0, itf_none);
tree t = instantiate_type (TREE_TYPE (op1), op0, tf_none);
if (t != error_mark_node)
{
pedwarn ("assuming cast to type `%T' from overloaded function",
......@@ -3424,7 +3424,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
}
if (type_unknown_p (op1))
{
tree t = instantiate_type (TREE_TYPE (op0), op1, itf_none);
tree t = instantiate_type (TREE_TYPE (op0), op1, tf_none);
if (t != error_mark_node)
{
pedwarn ("assuming cast to type `%T' from overloaded function",
......@@ -6106,7 +6106,7 @@ build_ptrmemfunc (type, pfn, force)
}
if (type_unknown_p (pfn))
return instantiate_type (type, pfn, itf_complain);
return instantiate_type (type, pfn, tf_error | tf_warning);
fn = TREE_OPERAND (pfn, 0);
my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0);
......@@ -6334,7 +6334,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
overloaded function. Call instantiate_type to get error
messages. */
if (rhstype == unknown_type_node)
instantiate_type (type, rhs, itf_complain);
instantiate_type (type, rhs, tf_error | tf_warning);
else if (fndecl)
error ("cannot convert `%T' to `%T' for argument `%P' to `%D'",
rhstype, type, parmnum, fndecl);
......
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