Commit d11ad92e by Mike Stump

88 Cygnus<->FSF merge

From-SVN: r12674
parent 9d8757d4
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1520,6 +1520,8 @@ extern tree long_long_integer_type_node, long_long_unsigned_type_node;
extern tree integer_two_node, integer_three_node;
extern tree boolean_type_node, boolean_true_node, boolean_false_node;
extern tree null_node;
/* in pt.c */
extern tree current_template_parms;
......@@ -2410,6 +2412,8 @@ extern tree break_out_target_exprs PROTO((tree));
extern tree get_type_decl PROTO((tree));
extern tree vec_binfo_member PROTO((tree, tree));
extern tree hack_decl_function_context PROTO((tree));
extern tree lvalue_type PROTO((tree));
extern tree error_type PROTO((tree));
/* in typeck.c */
extern tree condition_conversion PROTO((tree));
......
......@@ -341,6 +341,11 @@ tree static_aggregates;
tree integer_zero_node;
tree null_pointer_node;
/* The value for __null (NULL), either of type `void *' or, with -ansi,
an integer type of the same size. */
tree null_node;
/* A node for the integer constants 1, 2, and 3. */
tree integer_one_node, integer_two_node, integer_three_node;
......@@ -4911,7 +4916,14 @@ init_decl_processing ()
void_list_node = build_tree_list (NULL_TREE, void_type_node);
TREE_PARMLIST (void_list_node) = 1;
null_pointer_node = build_int_2 (0, 0);
TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
layout_type (TREE_TYPE (null_pointer_node));
if (flag_ansi)
TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0);
else
TREE_TYPE (null_node) = build_pointer_type (void_type_node);
/* Used for expressions that do nothing, but are not errors. */
void_zero_node = build_int_2 (0, 0);
......@@ -11086,7 +11098,7 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
It doesn't matter whether it's inline or not. */
else if (interface_unknown == 0
&& (! DECL_TEMPLATE_INSTANTIATION (decl1)
|| flag_external_templates))
|| flag_alt_external_templates))
{
if (DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1)
|| current_template_parms)
......
......@@ -128,11 +128,7 @@ int flag_ansi;
/* Nonzero means do argument matching for overloading according to the
ANSI rules, rather than what g++ used to believe to be correct. */
#ifdef NEW_OVER
int flag_ansi_overloading = 1;
#else
int flag_ansi_overloading;
#endif
/* Nonzero means do emit exported implementations of functions even if
they can be inlined. */
......@@ -2481,6 +2477,31 @@ mark_vtable_entries (decl)
}
}
/* Set DECL up to have the closest approximation of "initialized common"
linkage available. */
void
comdat_linkage (decl)
tree decl;
{
TREE_PUBLIC (decl) = 0;
#ifdef DECL_ONE_ONLY
if (SUPPORTS_ONE_ONLY)
{
DECL_ONE_ONLY (decl) = 1;
TREE_PUBLIC (decl) = 1;
}
#endif
if (flag_weak)
{
DECL_WEAK (decl) = 1;
TREE_PUBLIC (decl) = 1;
}
}
/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL,
based on TYPE and other static flags.
......@@ -2532,21 +2553,7 @@ import_export_vtable (decl, type, final)
if (final || ! found)
{
#ifdef DECL_ONE_ONLY
if (SUPPORTS_ONE_ONLY)
{
TREE_PUBLIC (decl) = 1;
DECL_ONE_ONLY (decl) = 1;
}
else
#endif
if (flag_weak)
{
TREE_PUBLIC (decl) = 1;
DECL_WEAK (decl) = 1;
}
else
TREE_PUBLIC (decl) = 0;
comdat_linkage (decl);
DECL_EXTERNAL (decl) = 0;
}
else
......@@ -2764,17 +2771,7 @@ import_export_decl (decl)
&& (flag_implicit_templates || DECL_THIS_INLINE (decl)))
{
if (TREE_CODE (decl) == FUNCTION_DECL)
{
#ifdef DECL_ONE_ONLY
if (SUPPORTS_ONE_ONLY)
DECL_ONE_ONLY (decl) = 1;
else
#endif
if (flag_weak)
DECL_WEAK (decl) = 1;
else
TREE_PUBLIC (decl) = 0;
}
comdat_linkage (decl);
/* Dynamically initialized vars go into common. */
else if (DECL_INITIAL (decl) == NULL_TREE
|| DECL_INITIAL (decl) == error_mark_node)
......@@ -2784,14 +2781,18 @@ import_export_decl (decl)
DECL_COMMON (decl) = 1;
DECL_INITIAL (decl) = error_mark_node;
}
else
{
/* Statically initialized vars are weak or comdat, if
supported. */
#ifdef DECL_ONE_ONLY
else if (SUPPORTS_ONE_ONLY)
DECL_ONE_ONLY (decl) = 1;
if (SUPPORTS_ONE_ONLY)
DECL_ONE_ONLY (decl) = 1;
#endif
/* Statically initialized vars are weak or comdat, if supported. */
else if (flag_weak)
DECL_WEAK (decl) = 1;
/* else leave vars public so multiple defs will break. */
if (flag_weak)
DECL_WEAK (decl) = 1;
/* else leave vars public so multiple defs will break. */
}
}
else
DECL_NOT_REALLY_EXTERN (decl) = 0;
......@@ -2805,20 +2806,15 @@ import_export_decl (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
|| (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
}
#ifdef DECL_ONE_ONLY
else if (SUPPORTS_ONE_ONLY)
DECL_ONE_ONLY (decl) = 1;
#endif
else if (flag_weak)
DECL_WEAK (decl) = 1;
else
TREE_PUBLIC (decl) = 0;
comdat_linkage (decl);
}
/* tinfo function */
else if (DECL_ARTIFICIAL (decl) && DECL_MUTABLE_P (decl))
{
tree ctype = TREE_TYPE (DECL_NAME (decl));
if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype))
if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype)
&& TYPE_VIRTUAL_P (ctype))
{
DECL_NOT_REALLY_EXTERN (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
......@@ -2826,25 +2822,13 @@ import_export_decl (decl)
}
else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype))
DECL_NOT_REALLY_EXTERN (decl) = 0;
#ifdef DECL_ONE_ONLY
else if (SUPPORTS_ONE_ONLY)
DECL_ONE_ONLY (decl) = 1;
#endif
else if (flag_weak)
DECL_WEAK (decl) = 1;
else
TREE_PUBLIC (decl) = 0;
comdat_linkage (decl);
}
else if (DECL_C_STATIC (decl))
TREE_PUBLIC (decl) = 0;
#ifdef DECL_ONE_ONLY
else if (SUPPORTS_ONE_ONLY)
DECL_ONE_ONLY (decl) = 1;
#endif
else if (flag_weak)
DECL_WEAK (decl) = 1;
else
TREE_PUBLIC (decl) = 0;
comdat_linkage (decl);
DECL_INTERFACE_KNOWN (decl) = 1;
}
......
......@@ -1547,7 +1547,7 @@ args_as_string (p, v)
OB_INIT ();
for (; p; p = TREE_CHAIN (p))
{
dump_type (TREE_TYPE (TREE_VALUE (p)), v);
dump_type (error_type (TREE_VALUE (p)), v);
if (TREE_CHAIN (p))
OB_PUTS (", ");
}
......
......@@ -592,6 +592,7 @@ do_unwind (inner_throw_label)
temp = gen_reg_rtx (Pmode);
emit_move_insn (temp, inner_throw_label);
emit_move_insn (return_val_rtx, plus_constant (temp, -8));
emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, 31)));
easy_expand_asm ("ret");
easy_expand_asm ("restore");
emit_barrier ();
......
......@@ -3261,7 +3261,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
tree type = TREE_TYPE (TREE_TYPE (base));
tree size;
maxindex = convert (integer_type_node, maxindex);
maxindex = convert (ptrdiff_type_node, maxindex);
if (maxindex == error_mark_node)
return error_mark_node;
......@@ -3318,7 +3318,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
goto done_init;
}
iterator = get_temp_regvar (integer_type_node,
iterator = get_temp_regvar (ptrdiff_type_node,
build_int_2 (host_i, 0));
init = NULL_TREE;
goto init_by_default;
......@@ -3340,7 +3340,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
{
tree itype;
iterator = get_temp_regvar (integer_type_node, maxindex);
iterator = get_temp_regvar (ptrdiff_type_node, maxindex);
init_by_default:
......@@ -3424,7 +3424,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
build (PLUS_EXPR, build_pointer_type (type), base2, size), 0, 0);
expand_loop_continue_here ();
expand_exit_loop_if_false (0, build (NE_EXPR, boolean_type_node,
build (PREDECREMENT_EXPR, integer_type_node, iterator, integer_one_node), minus_one));
build (PREDECREMENT_EXPR, ptrdiff_type_node, iterator, integer_one_node), minus_one));
if (obey_regdecls)
{
......
......@@ -673,8 +673,8 @@ init_lex ()
TREE_TYPE (signature_type_node) = signature_type_node;
ridpointers[(int) RID_SIGNATURE] = signature_type_node;
null_pointer_node = build_int_2 (0, 0);
ridpointers[RID_NULL] = null_pointer_node;
null_node = build_int_2 (0, 0);
ridpointers[RID_NULL] = null_node;
opname_tab[(int) COMPONENT_REF] = "->";
opname_tab[(int) MEMBER_REF] = "->*";
......@@ -1692,6 +1692,9 @@ cons_up_default_function (type, full_name, kind)
if (fn == void_type_node)
return fn;
if (kind > 2)
SET_DECL_ARTIFICIAL (TREE_CHAIN (DECL_ARGUMENTS (fn)));
#if 0
if (processing_template_defn)
{
......
......@@ -1713,15 +1713,7 @@ make_thunk (function, delta)
DECL_INITIAL (thunk) = function;
THUNK_DELTA (thunk) = delta;
DECL_EXTERNAL (thunk) = 1;
#ifdef DECL_ONE_ONLY
if (SUPPORTS_ONE_ONLY)
{
DECL_ONE_ONLY (thunk) = 1;
TREE_PUBLIC (thunk) = 1;
}
else
#endif
TREE_PUBLIC (thunk) = 0;
comdat_linkage (thunk);
/* So that finish_file can write out any thunks that need to be: */
pushdecl_top_level (thunk);
}
......
......@@ -1240,6 +1240,8 @@ instantiate_class_template (type)
TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern);
TYPE_USES_COMPLEX_INHERITANCE (type)
= TYPE_USES_COMPLEX_INHERITANCE (pattern);
TYPE_USES_MULTIPLE_INHERITANCE (type)
= TYPE_USES_MULTIPLE_INHERITANCE (pattern);
TYPE_USES_VIRTUAL_BASECLASSES (type)
= TYPE_USES_VIRTUAL_BASECLASSES (pattern);
TYPE_PACKED (type) = TYPE_PACKED (pattern);
......@@ -1627,8 +1629,10 @@ tsubst (t, args, nargs, in_decl)
if (TREE_STATIC (r))
DECL_ASSEMBLER_NAME (r)
= build_static_name (DECL_CONTEXT (r), DECL_NAME (r));
DECL_INITIAL (r) = tsubst_expr
(DECL_INITIAL (t), args, nargs, in_decl);
/* Don't try to expand the initializer until someone tries to use
this variable; otherwise we run into circular dependencies. */
DECL_INITIAL (r) = NULL_TREE;
DECL_RTL (r) = 0;
DECL_SIZE (r) = 0;
......@@ -3283,6 +3287,14 @@ instantiate_decl (d)
import_export_decl (d);
}
/* We need to set up DECL_INITIAL regardless of pattern_defined if the
variable is a static const initialized in the class body. */
if (TREE_CODE (d) == VAR_DECL
&& ! DECL_INITIAL (d) && DECL_INITIAL (pattern))
DECL_INITIAL (d) = tsubst_expr
(DECL_INITIAL (pattern), &TREE_VEC_ELT (args, 0),
TREE_VEC_LENGTH (args), tmpl);
if (! pattern_defined
|| (TREE_CODE (d) == FUNCTION_DECL && ! DECL_INLINE (d)
&& (! DECL_INTERFACE_KNOWN (d)
......@@ -3308,6 +3320,12 @@ instantiate_decl (d)
td = tsubst (pattern, &TREE_VEC_ELT (args, 0), TREE_VEC_LENGTH (args), tmpl);
DECL_TEMPLATE_INFO (pattern) = save_ti;
/* And set up DECL_INITIAL, since tsubst doesn't. */
if (TREE_CODE (td) == VAR_DECL)
DECL_INITIAL (td) = tsubst_expr
(DECL_INITIAL (pattern), &TREE_VEC_ELT (args, 0),
TREE_VEC_LENGTH (args), tmpl);
/* Convince duplicate_decls to use the DECL_ARGUMENTS from the new decl. */
if (TREE_CODE (d) == FUNCTION_DECL)
DECL_INITIAL (td) = error_mark_node;
......
......@@ -2105,3 +2105,31 @@ make_temp_vec (len)
pop_obstacks ();
return node;
}
/* The type of ARG when used as an lvalue. */
tree
lvalue_type (arg)
tree arg;
{
return cp_build_type_variant
(TREE_TYPE (arg), TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
}
/* The type of ARG for printing error messages; denote lvalues with
reference types. */
tree
error_type (arg)
tree arg;
{
tree type = TREE_TYPE (arg);
if (TREE_CODE (type) == ARRAY_TYPE)
;
else if (real_lvalue_p (arg))
type = build_reference_type (lvalue_type (arg));
else if (IS_AGGR_TYPE (type))
type = lvalue_type (arg);
return type;
}
......@@ -1792,7 +1792,8 @@ build_component_ref (datum, component, basetype_path, protect)
hierarchy, the compiler will abort (because vptr lookups are
not supposed to be ambiguous. */
field = CLASSTYPE_VFIELD (basetype);
else if (TREE_CODE (component) == FIELD_DECL)
else if (TREE_CODE (component) == FIELD_DECL
|| TREE_CODE (component) == TYPE_DECL)
{
field = component;
}
......@@ -4829,16 +4830,14 @@ build_conditional_expr (ifexp, op1, op2)
pedwarn ("ANSI C++ forbids conditional expr with only one void side");
result_type = void_type_node;
}
else if (code1 == POINTER_TYPE && null_ptr_cst_p (op2))
result_type = qualify_type (type1, type2);
else if (code2 == POINTER_TYPE && null_ptr_cst_p (op1))
result_type = qualify_type (type2, type1);
else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE)
{
if (comp_target_types (type1, type2, 1))
result_type = common_type (type1, type2);
else if (integer_zerop (op1) && TREE_TYPE (type1) == void_type_node
&& TREE_CODE (orig_op1) != NOP_EXPR)
result_type = qualify_type (type2, type1);
else if (integer_zerop (op2) && TREE_TYPE (type2) == void_type_node
&& TREE_CODE (orig_op2) != NOP_EXPR)
result_type = qualify_type (type1, type2);
else if (TYPE_MAIN_VARIANT (TREE_TYPE (type1)) == void_type_node)
{
if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE)
......@@ -4883,20 +4882,12 @@ build_conditional_expr (ifexp, op1, op2)
}
else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE)
{
if (!integer_zerop (op2))
pedwarn ("pointer/integer type mismatch in conditional expression");
else
op2 = null_pointer_node;
pedwarn ("pointer/integer type mismatch in conditional expression");
result_type = type1;
}
else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
if (!integer_zerop (op1))
pedwarn ("pointer/integer type mismatch in conditional expression");
else
op1 = null_pointer_node;
pedwarn ("pointer/integer type mismatch in conditional expression");
result_type = type2;
}
......@@ -6376,7 +6367,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
return error_mark_node;
}
if (ctt < 0)
if (ctt < 0 && TYPE_MAIN_VARIANT (ttl) != TYPE_MAIN_VARIANT (ttr))
cp_pedwarn ("converting `%T' to `%T' is a contravariance violation",
rhstype, type);
......@@ -7269,6 +7260,10 @@ comp_ptr_ttypes_real (to, from, constp)
if (TREE_CODE (to) != TREE_CODE (from))
return 0;
if (TREE_CODE (from) == OFFSET_TYPE
&& TYPE_OFFSET_BASETYPE (from) == TYPE_OFFSET_BASETYPE (to))
continue;
/* Const and volatile mean something different for function types,
so the usual checks are not appropriate. */
if (TREE_CODE (to) != FUNCTION_TYPE && TREE_CODE (to) != METHOD_TYPE)
......@@ -7299,3 +7294,26 @@ comp_ptr_ttypes (to, from)
{
return comp_ptr_ttypes_real (to, from, 1);
}
/* Returns 1 if to and from are (possibly multi-level) pointers to the same
type or inheritance-related types, regardless of cv-quals. */
int
ptr_reasonably_similar (to, from)
tree to, from;
{
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
if (TREE_CODE (to) != TREE_CODE (from))
return 0;
if (TREE_CODE (from) == OFFSET_TYPE
&& comptypes (TYPE_OFFSET_BASETYPE (to),
TYPE_OFFSET_BASETYPE (from), -1))
continue;
if (TREE_CODE (to) != POINTER_TYPE)
return comptypes
(TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from), -1);
}
}
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