tree.h (COMPLETE_TYPE_P): New macro.

gcc
	* tree.h (COMPLETE_TYPE_P): New macro.
	(COMPLETE_OR_VOID_TYPE_P): New macro.
	(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
	* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
	* c-aux-info.c (gen_type): Use them.
	* c-common.c (c_expand_expr_stmt): Likewise.
	* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
	grokdeclarator, grokparms, finish_struct, start_function,
	store_parm_decls, combine_parm_decls): Likewise.
	* c-parse.y (cast_expr): Likewise.
	* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
	c_size_in_bytes, c_alignof, build_component_ref,
	build_indirect_ref, build_array_ref, convert_arguments,
	build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
	* calls.c (initialize_argument_information): Likewise.
	* convert.c (convert_to_integer): Likewise.
	* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
	* dwarfout.c (location_or_const_value_attribute,
	output_enumeration_type_die, output_structure_type_die,
	output_union_type_die, output_type): Likewise.
	* expr.c (safe_from_p, expand_expr): Likewise.
	* function.c (assign_parms): Likewise.
	* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
	* tree.c (build_array_type, build_function_type,
	build_method_type, build_offset_type, build_complex_type): Likewise.
	* c-parse.c, c-parse.h: Regenerated.
gcc/cp
	* typeck.c (require_complete_type, complete_type,
	complete_type_or_else, c_sizeof, c_sizeof_nowarn,
	build_array_ref, convert_arguments, pointer_diff,
	build_x_unary_op, build_unary_op, build_c_cast,
	build_modify_expr): Use COMPLETE_TYPE_P etc.
	* call.c (is_complete, convert_like_real,
	build_new_method_call): Likewise.
	* class.c (build_vbase_pointer_fields, check_bases,
	build_base_field, finish_struct_1, pushclass): Likewise.
	* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
	* decl.c (maybe_process_template_type_declaration, pushtag,
	pushdecl, redeclaration_error_message, start_decl, start_decl_1,
	layout_var_decl, check_initializer, cp_finish_decl,
	grokdeclarator, require_complete_types_for_parms,
	grok_op_properties, xref_tag, xref_basetypes,
	check_function_type): Likewise.
	* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
	* friend.c (do_friend): Likewise.
	* init.c (build_offset_ref): Likewise.
	* parse.y (structsp): Likewise.
	* pt.c (maybe_process_partial_specialization,
	tsubst_friend_function, instantiate_class_template, tsubst,
	do_type_instantiation, instantiate_pending_templates): Likewise.
	* repo.c (repo_get_id): Likewise.
	* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
	synthesize_tinfo_var, emit_support_tinfos): Likewise.
	* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
	* semantics.c (begin_class_definition): Likewise.
	* tree.c (build_cplus_method_type): Likewise.
	* typeck2.c (digest_init, build_functional_cast,
	add_exception_specifier): Likewise.
	* parse.h, parse.c: Regenerated.

From-SVN: r32671
This commit is contained in:
Nathan Sidwell 2000-03-21 18:10:48 +00:00
parent b9712646fb
commit d0f062fbb3
35 changed files with 232 additions and 159 deletions

View File

@ -1,3 +1,32 @@
2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
2000-03-21 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/rtems.h: Include config/rtems.h.
@ -17161,7 +17190,7 @@ Fri Aug 20 18:53:43 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
@ -18001,7 +18030,7 @@ Mon Aug 9 10:08:50 1999 Bernd Schmidt <bernds@cygnus.co.uk>
(unroll_loop): Access regno_pointer_* variables through
current_function.
* tree.h (struct tree_decl): Add elt f to saved_insns member.
* tree.h (struct tree_decl): Add elt f to saved_insns member.
(DECL_SAVED_INSNS): use it.
(expand_dummy_function_end): Declare.
(init_function_for_compilation): Declare.
@ -18904,7 +18933,7 @@ Wed Jul 28 11:22:21 1999 Richard Henderson <rth@cygnus.com>
Wed Jul 28 11:20:19 1999 Richard Henderson <rth@cygnus.com>
* mn10200.c (mn10200_va_arg): New.
* mn10200.c (mn10200_va_arg): New.
* mn10200.h (EXPAND_BUILTIN_VA_ARG): New.
Wed Jul 28 11:19:06 1999 Richard Henderson <rth@cygnus.com>

View File

@ -334,7 +334,7 @@ gen_type (ret_val, t, style)
return ret_val;
case ARRAY_TYPE:
if (TYPE_SIZE (t) == 0 || TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
if (!COMPLETE_TYPE_P (t) || TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
ret_val = gen_type (concat (ret_val, "[]", NULL_PTR),
TREE_TYPE (t), style);
else if (int_size_in_bytes (t) == 0)

View File

@ -2139,7 +2139,7 @@ c_expand_expr_stmt (expr)
expr = default_conversion (expr);
if (TREE_TYPE (expr) != error_mark_node
&& TYPE_SIZE (TREE_TYPE (expr)) == 0
&& !COMPLETE_TYPE_P (TREE_TYPE (expr))
&& TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
error ("expression statement has incomplete type");

View File

@ -985,7 +985,7 @@ poplevel (keep, reverse, functionbody)
#if 0
/* Warn about incomplete structure types in this level. */
for (link = tags; link; link = TREE_CHAIN (link))
if (TYPE_SIZE (TREE_VALUE (link)) == 0)
if (!COMPLETE_TYPE_P (TREE_VALUE (link)))
{
tree type = TREE_VALUE (link);
tree type_name = TYPE_NAME (type);
@ -2409,7 +2409,7 @@ pushdecl (x)
}
/* Keep count of variables in this level with incomplete type. */
if (TYPE_SIZE (TREE_TYPE (x)) == 0)
if (!COMPLETE_TYPE_P (TREE_TYPE (x)))
++b->n_incomplete;
}
@ -3338,7 +3338,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
default:
/* Don't allow initializations for incomplete types
except for arrays which might be completed by the initialization. */
if (TYPE_SIZE (TREE_TYPE (decl)) != 0)
if (COMPLETE_TYPE_P (TREE_TYPE (decl)))
{
/* A complete type is ok if size is fixed. */
@ -3355,7 +3355,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
IDENTIFIER_POINTER (DECL_NAME (decl)));
initialized = 0;
}
else if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl))) == 0)
else if (!COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
{
error ("elements of array `%s' have incomplete type",
IDENTIFIER_POINTER (DECL_NAME (decl)));
@ -3414,7 +3414,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
(which may or may not happen). */
&& DECL_RTL (tem) == 0)
{
if (TYPE_SIZE (TREE_TYPE (tem)) != 0)
if (COMPLETE_TYPE_P (TREE_TYPE (tem)))
expand_decl (tem);
else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
&& DECL_INITIAL (tem) != 0)
@ -3517,7 +3517,7 @@ finish_decl (decl, init, asmspec_tree)
if (TREE_CODE (decl) == VAR_DECL)
{
if (DECL_SIZE (decl) == 0 && TYPE_SIZE (TREE_TYPE (decl)) != 0)
if (DECL_SIZE (decl) == 0 && COMPLETE_TYPE_P (TREE_TYPE (decl)))
layout_decl (decl, 0);
if (DECL_SIZE (decl) == 0
@ -4319,7 +4319,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
union incomplete (*foo)[4]; */
/* Complain about arrays of incomplete types, except in typedefs. */
if (TYPE_SIZE (type) == 0
if (!COMPLETE_TYPE_P (type)
/* Avoid multiple warnings for nested array types. */
&& TREE_CODE (type) != ARRAY_TYPE
&& !(specbits & (1 << (int) RID_TYPEDEF))
@ -4480,7 +4480,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
/* Did array size calculations overflow? */
if (TREE_CODE (type) == ARRAY_TYPE
&& TYPE_SIZE (type)
&& COMPLETE_TYPE_P (type)
&& TREE_OVERFLOW (TYPE_SIZE (type)))
error ("size of array `%s' is too large", name);
@ -4614,7 +4614,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
error ("field `%s' declared as a function", name);
type = build_pointer_type (type);
}
else if (TREE_CODE (type) != ERROR_MARK && TYPE_SIZE (type) == 0)
else if (TREE_CODE (type) != ERROR_MARK
&& !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type))
{
error ("field `%s' has incomplete type", name);
type = error_mark_node;
@ -4822,7 +4823,7 @@ grokparms (parms_info, funcdef_flag)
{
/* Barf if the parameter itself has an incomplete type. */
tree type = TREE_VALUE (typelt);
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
{
if (funcdef_flag && DECL_NAME (parm) != 0)
error ("parameter `%s' has incomplete type",
@ -4844,7 +4845,7 @@ grokparms (parms_info, funcdef_flag)
|| TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
type = TYPE_MAIN_VARIANT (type);
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
{
if (DECL_NAME (parm) != 0)
warning ("parameter `%s' points to incomplete type",
@ -5361,7 +5362,7 @@ finish_struct (t, fieldlist, attributes)
expand_decl (decl);
--current_binding_level->n_incomplete;
}
else if (TYPE_SIZE (TREE_TYPE (decl)) == 0
else if (!COMPLETE_TYPE_P (TREE_TYPE (decl))
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
{
tree element = TREE_TYPE (decl);
@ -5660,7 +5661,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
announce_function (decl1);
if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl1))) == 0)
if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1))))
{
error ("return-type is an incomplete type");
/* Make it return void instead. */
@ -6086,7 +6087,7 @@ store_parm_decls ()
else
{
/* Complain about args with incomplete types. */
if (TYPE_SIZE (TREE_TYPE (parm)) == 0)
if (!COMPLETE_TYPE_P (TREE_TYPE (parm)))
{
error_with_decl (parm, "parameter `%s' has incomplete type");
TREE_TYPE (parm) = error_mark_node;
@ -6376,7 +6377,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
TREE_CHAIN (parm) = 0;
/* Complain about args with incomplete types. */
if (TYPE_SIZE (TREE_TYPE (parm)) == 0)
if (!COMPLETE_TYPE_P (TREE_TYPE (parm)))
{
error_with_decl (parm, "parameter `%s' has incomplete type");
TREE_TYPE (parm) = error_mark_node;

View File

@ -1,7 +1,6 @@
/* A Bison parser, made from c-parse.y
by GNU Bison version 1.27
*/
by GNU Bison version 1.28 */
#define YYBISON 1 /* Identify Bison output. */
@ -1275,8 +1274,8 @@ static const short yycheck[] = { 38,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/bison.simple"
/* This file comes from bison-1.27. */
#line 3 "/usr/lib/bison.simple"
/* This file comes from bison-1.28. */
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@ -1489,7 +1488,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
#endif
#endif
#line 216 "/usr/share/bison.simple"
#line 217 "/usr/lib/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@ -2110,7 +2109,7 @@ case 62:
else
name = "";
yyval.ttype = result;
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{
int failure = complete_array_type (type, yyval.ttype, 1);
if (failure)
@ -3836,7 +3835,7 @@ case 407:
break;}
}
/* the action file gets copied in in place of this dollarsign */
#line 542 "/usr/share/bison.simple"
#line 543 "/usr/lib/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;

View File

@ -488,7 +488,7 @@ cast_expr:
else
name = "";
$$ = result;
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{
int failure = complete_array_type (type, $$, 1);
if (failure)

View File

@ -90,8 +90,7 @@ require_complete_type (value)
return error_mark_node;
/* First, detect a valid value with a complete type. */
if (TYPE_SIZE (type) != 0
&& type != void_type_node)
if (COMPLETE_TYPE_P (type))
return value;
incomplete_type_error (value, type);
@ -713,7 +712,7 @@ c_sizeof (type)
if (code == ERROR_MARK)
return size_one_node;
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
{
error ("sizeof applied to an incomplete type");
return size_zero_node;
@ -734,7 +733,7 @@ c_sizeof_nowarn (type)
if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK)
return size_one_node;
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
return size_zero_node;
/* Convert in case a char is more than one unit. */
@ -754,7 +753,7 @@ c_size_in_bytes (type)
if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK)
return size_one_node;
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_OR_VOID_TYPE_P (type))
{
error ("arithmetic on pointer to an incomplete type");
return size_one_node;
@ -781,7 +780,7 @@ c_alignof (type)
if (code == VOID_TYPE || code == ERROR_MARK)
return size_one_node;
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
{
error ("__alignof__ applied to an incomplete type");
return size_zero_node;
@ -1144,7 +1143,7 @@ build_component_ref (datum, component)
{
tree indirect = 0;
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
{
incomplete_type_error (NULL_TREE, type);
return error_mark_node;
@ -1216,7 +1215,7 @@ build_indirect_ref (ptr, errorstring)
register tree ref = build1 (INDIRECT_REF,
TYPE_MAIN_VARIANT (t), pointer);
if (TYPE_SIZE (t) == 0 && TREE_CODE (t) != ARRAY_TYPE)
if (!COMPLETE_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE)
{
error ("dereferencing pointer to incomplete type");
return error_mark_node;
@ -1296,7 +1295,7 @@ build_array_ref (array, index)
address arithmetic on its address.
Likewise an array of elements of variable size. */
if (TREE_CODE (index) != INTEGER_CST
|| (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0
|| (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST))
{
if (mark_addressable (array) == 0)
@ -1537,7 +1536,7 @@ convert_arguments (typelist, values, name, fundecl)
/* Formal parm type is specified by a function prototype. */
tree parmval;
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
{
error ("type of formal parameter %d is incomplete", parmnum + 1);
parmval = val;
@ -2176,8 +2175,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
if (comp_target_types (type0, type1))
{
result_type = common_type (type0, type1);
if ((TYPE_SIZE (TREE_TYPE (type0)) != 0)
!= (TYPE_SIZE (TREE_TYPE (type1)) != 0))
if (!COMPLETE_TYPE_P (TREE_TYPE (type0))
!= !COMPLETE_TYPE_P (TREE_TYPE (type1)))
pedwarn ("comparison of complete and incomplete pointers");
else if (pedantic
&& TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
@ -2653,7 +2652,7 @@ pointer_diff (op0, op1)
op0 = build_binary_op (MINUS_EXPR, convert (restype, op0),
convert (restype, op1), 0);
/* This generates an error if op1 is pointer to incomplete type. */
if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
error ("arithmetic on pointer to an incomplete type");
/* This generates an error if op0 is pointer to incomplete type. */
@ -2837,7 +2836,7 @@ build_unary_op (code, xarg, noconvert)
{
/* If pointer target is an undefined struct,
we just cannot know how to do the arithmetic. */
if (TYPE_SIZE (TREE_TYPE (result_type)) == 0)
if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (result_type)))
error ("%s of pointer to unknown structure",
code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
? "increment" : "decrement");
@ -4666,7 +4665,7 @@ digest_init (type, init, require_constant, constructor_constant)
/* Come here only for records and arrays. */
if (TYPE_SIZE (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
if (COMPLETE_TYPE_P (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{
error_init ("variable-sized object may not be initialized");
return error_mark_node;

View File

@ -1026,7 +1026,7 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args,
args[i].tree_value = TREE_VALUE (p);
/* Replace erroneous argument with constant zero. */
if (type == error_mark_node || TYPE_SIZE (type) == 0)
if (type == error_mark_node || !COMPLETE_TYPE_P (type))
args[i].tree_value = integer_zero_node, type = integer_type_node;
/* If TYPE is a transparent union, pass things the way we would
@ -1100,7 +1100,7 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args,
function being called. */
rtx copy;
if (TYPE_SIZE (type) == 0
if (!COMPLETE_TYPE_P (type)
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
|| (flag_stack_check && ! STACK_CHECK_BUILTIN
&& (0 < compare_tree_int (TYPE_SIZE_UNIT (type),

View File

@ -125,7 +125,7 @@ convert_to_integer (type, expr)
/* An INTEGER_TYPE cannot be incomplete, but an ENUMERAL_TYPE can
be. Consider `enum E = { a, b = (enum E) 3 };'. */
if (!TYPE_SIZE (type))
if (!COMPLETE_TYPE_P (type))
{
error ("conversion to incomplete type");
return error_mark_node;

View File

@ -1,3 +1,38 @@
2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
* inc/cxxabi.h: New header file. Define new-abi entry points.

View File

@ -1514,7 +1514,7 @@ static int
is_complete (t)
tree t;
{
return TYPE_SIZE (complete_type (t)) != NULL_TREE;
return COMPLETE_TYPE_P (complete_type (t));
}
/* Returns non-zero if TYPE is a promoted arithmetic type. */
@ -3736,7 +3736,7 @@ convert_like_real (convs, expr, fn, argnum, inner)
conversion because the type might be an incomplete
array type, which is OK if some constructor for the
destination type takes a pointer argument. */
if (TYPE_SIZE (TREE_TYPE (expr)) == 0)
if (!COMPLETE_TYPE_P (TREE_TYPE (expr)))
{
if (same_type_p (TREE_TYPE (expr), TREE_TYPE (convs)))
incomplete_type_error (expr, TREE_TYPE (expr));
@ -4313,7 +4313,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
/* XXX will LOOKUP_SPECULATIVELY be needed when this is done? */
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
if (TYPE_SIZE (basetype) == 0)
if (!COMPLETE_TYPE_P (basetype))
incomplete_type_error (instance_ptr, basetype);
else
cp_error ("no matching function for call to `%T::%D (%A)%V'",

View File

@ -200,7 +200,7 @@ build_vbase_pointer_fields (rli, empty_p)
register tree base_binfo = TREE_VEC_ELT (binfos, i);
register tree basetype = BINFO_TYPE (base_binfo);
if (TYPE_SIZE (basetype) == 0)
if (!COMPLETE_TYPE_P (basetype))
/* This error is now reported in xref_tag, thus giving better
location information. */
continue;
@ -1876,7 +1876,7 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p,
/* If the type of basetype is incomplete, then we already
complained about that fact (and we should have fixed it up as
well). */
if (TYPE_SIZE (basetype) == 0)
if (!COMPLETE_TYPE_P (basetype))
{
int j;
/* The base type is of incomplete type. It is
@ -4246,7 +4246,7 @@ build_base_field (rli, binfo, empty_p, base_align, v)
tree basetype = BINFO_TYPE (binfo);
tree decl;
if (TYPE_SIZE (basetype) == 0)
if (!COMPLETE_TYPE_P (basetype))
/* This error is now reported in xref_tag, thus giving better
location information. */
return;
@ -5133,7 +5133,7 @@ finish_struct_1 (t)
tree vfield;
int empty = 1;
if (TYPE_SIZE (t))
if (COMPLETE_TYPE_P (t))
{
if (IS_AGGR_TYPE (t))
cp_error ("redefinition of `%#T'", t);
@ -5642,7 +5642,7 @@ pushclass (type, modify)
if (previous_class_type != NULL_TREE
&& (type != previous_class_type
|| TYPE_SIZE (previous_class_type) == NULL_TREE)
|| !COMPLETE_TYPE_P (previous_class_type))
&& current_class_depth == 1)
{
/* Forcibly remove any old class remnants. */

View File

@ -79,7 +79,7 @@ cp_convert_to_pointer (type, expr)
if (IS_AGGR_TYPE (intype))
{
intype = complete_type (intype);
if (TYPE_SIZE (intype) == NULL_TREE)
if (!COMPLETE_TYPE_P (intype))
{
cp_error ("can't convert from incomplete type `%T' to `%T'",
intype, type);
@ -901,7 +901,7 @@ convert_to_void (expr, implicit)
int is_reference = TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0)))
== REFERENCE_TYPE;
int is_volatile = TYPE_VOLATILE (type);
int is_complete = TYPE_SIZE (complete_type (type)) != NULL_TREE;
int is_complete = COMPLETE_TYPE_P (complete_type (type));
if (is_volatile && !is_complete)
cp_warning ("object of incomplete type `%T' will not be accessed in %s",
@ -920,7 +920,7 @@ convert_to_void (expr, implicit)
{
/* External variables might be incomplete. */
tree type = TREE_TYPE (expr);
int is_complete = TYPE_SIZE (complete_type (type)) != NULL_TREE;
int is_complete = COMPLETE_TYPE_P (complete_type (type));
if (TYPE_VOLATILE (type) && !is_complete)
cp_warning ("object `%E' of incomplete type `%T' will not be accessed in %s",

View File

@ -2722,7 +2722,7 @@ maybe_process_template_type_declaration (type, globalize, b)
binding level, but is instead the pseudo-global level. */
b->level_chain->tags =
tree_cons (name, type, b->level_chain->tags);
if (TYPE_SIZE (current_class_type) == NULL_TREE)
if (!COMPLETE_TYPE_P (current_class_type))
CLASSTYPE_TAGS (current_class_type) = b->level_chain->tags;
}
}
@ -2838,7 +2838,7 @@ pushtag (name, type, globalize)
}
if (b->parm_flag == 2)
{
if (TYPE_SIZE (current_class_type) == NULL_TREE)
if (!COMPLETE_TYPE_P (current_class_type))
CLASSTYPE_TAGS (current_class_type) = b->tags;
}
}
@ -4144,7 +4144,7 @@ pushdecl (x)
/* Keep count of variables in this level with incomplete type. */
if (TREE_CODE (x) == VAR_DECL
&& TREE_TYPE (x) != error_mark_node
&& ((TYPE_SIZE (TREE_TYPE (x)) == NULL_TREE
&& ((!COMPLETE_TYPE_P (TREE_TYPE (x))
&& PROMOTES_TO_AGGR_TYPE (TREE_TYPE (x), ARRAY_TYPE))
/* RTTI TD entries are created while defining the type_info. */
|| (TYPE_LANG_SPECIFIC (TREE_TYPE (x))
@ -4668,8 +4668,8 @@ redeclaration_error_message (newdecl, olddecl)
&& DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl))
&& DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)))
|| (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL
&& TYPE_SIZE (TREE_TYPE (newdecl))
&& TYPE_SIZE (TREE_TYPE (olddecl))))
&& COMPLETE_TYPE_P (TREE_TYPE (newdecl))
&& COMPLETE_TYPE_P (TREE_TYPE (olddecl))))
return "redefinition of `%#D'";
return 0;
}
@ -7003,7 +7003,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
/* Set attributes here so if duplicate decl, will have proper attributes. */
cplus_decl_attributes (decl, attributes, prefix_attributes);
if (context && TYPE_SIZE (complete_type (context)) != NULL_TREE)
if (context && COMPLETE_TYPE_P (complete_type (context)))
{
push_nested_class (context, 2);
@ -7110,7 +7110,7 @@ start_decl_1 (decl)
{
/* Don't allow initializations for incomplete types except for
arrays which might be completed by the initialization. */
if (TYPE_SIZE (complete_type (type)) != NULL_TREE)
if (COMPLETE_TYPE_P (complete_type (type)))
; /* A complete type is ok. */
else if (TREE_CODE (type) != ARRAY_TYPE)
{
@ -7119,7 +7119,7 @@ start_decl_1 (decl)
initialized = 0;
type = TREE_TYPE (decl) = error_mark_node;
}
else if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
else if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{
if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl))
cp_error ("elements of array `%#D' have incomplete type", decl);
@ -7136,7 +7136,7 @@ start_decl_1 (decl)
&& ! DECL_EXTERNAL (decl))
{
if ((! processing_template_decl || ! uses_template_parms (type))
&& TYPE_SIZE (complete_type (type)) == NULL_TREE)
&& !COMPLETE_TYPE_P (complete_type (type)))
{
cp_error ("aggregate `%#D' has incomplete type and cannot be initialized",
decl);
@ -7337,7 +7337,7 @@ layout_var_decl (decl)
`extern X x' for some incomplete type `X'.) */
if (!DECL_EXTERNAL (decl))
complete_type (type);
if (!DECL_SIZE (decl) && TYPE_SIZE (type))
if (!DECL_SIZE (decl) && COMPLETE_TYPE_P (type))
layout_decl (decl, 0);
if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE)
@ -7480,18 +7480,18 @@ check_initializer (decl, init)
if (type == error_mark_node)
/* We will have already complained. */
init = NULL_TREE;
else if (TYPE_SIZE (type) && !TREE_CONSTANT (TYPE_SIZE (type)))
else if (COMPLETE_TYPE_P (type) && !TREE_CONSTANT (TYPE_SIZE (type)))
{
cp_error ("variable-sized object `%D' may not be initialized", decl);
init = NULL_TREE;
}
else if (TREE_CODE (type) == ARRAY_TYPE
&& !TYPE_SIZE (TREE_TYPE (type)))
&& !COMPLETE_TYPE_P (TREE_TYPE (type)))
{
cp_error ("elements of array `%#D' have incomplete type", decl);
init = NULL_TREE;
}
else if (!TYPE_SIZE (type))
else if (!COMPLETE_TYPE_P (type))
{
cp_error ("`%D' has incomplete type", decl);
TREE_TYPE (decl) = error_mark_node;
@ -7565,8 +7565,7 @@ check_initializer (decl, init)
check_for_uninitialized_const_var (decl);
if (TYPE_SIZE (type) != NULL_TREE
&& TYPE_NEEDS_CONSTRUCTING (type))
if (COMPLETE_TYPE_P (type) && TYPE_NEEDS_CONSTRUCTING (type))
init = obscure_complex_init (decl, NULL_TREE);
}
@ -7944,7 +7943,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
type, and that type has not been defined yet, delay emitting
the debug information for it, as we will emit it later. */
if (TYPE_MAIN_DECL (TREE_TYPE (decl)) == decl
&& TYPE_SIZE (TREE_TYPE (decl)) == NULL_TREE)
&& !COMPLETE_TYPE_P (TREE_TYPE (decl)))
TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
rest_of_decl_compilation (decl, NULL_PTR,
@ -8059,7 +8058,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
/* If size hasn't been set, we're still defining it,
and therefore inside the class body; don't pop
the binding level.. */
&& TYPE_SIZE (context) != NULL_TREE
&& COMPLETE_TYPE_P (context)
&& context == current_class_type)
pop_nested_class ();
}
@ -10695,7 +10694,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
}
else if (RIDBIT_SETP (RID_TYPEDEF, specbits)
|| TYPE_SIZE (complete_type (ctype)) != NULL_TREE)
|| COMPLETE_TYPE_P (complete_type (ctype)))
{
/* Have to move this code elsewhere in this function.
this code is used for i.e., typedef int A::M; M *pm;
@ -11212,7 +11211,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
return NULL_TREE;
}
else if (!staticp && ! processing_template_decl
&& TYPE_SIZE (complete_type (type)) == NULL_TREE
&& !COMPLETE_TYPE_P (complete_type (type))
&& (TREE_CODE (type) != ARRAY_TYPE || initialized == 0))
{
if (declarator)
@ -11532,7 +11531,7 @@ require_complete_types_for_parms (parms)
if (type == error_mark_node)
continue;
if (TYPE_SIZE (type) == NULL_TREE)
if (!COMPLETE_TYPE_P (type))
{
if (DECL_NAME (parms))
error ("parameter `%s' has incomplete type",
@ -12160,7 +12159,7 @@ grok_op_properties (decl, virtualp, friendp)
what = "the same type";
/* Don't force t to be complete here. */
else if (IS_AGGR_TYPE (t)
&& TYPE_SIZE (t)
&& COMPLETE_TYPE_P (t)
&& DERIVED_FROM_P (t, current_class_type))
what = "a base class";
@ -12533,7 +12532,7 @@ xref_tag (code_type_node, name, globalize)
/* Until the type is defined, tentatively accept whatever
structure tag the user hands us. */
if (TYPE_SIZE (ref) == NULL_TREE
if (!COMPLETE_TYPE_P (ref)
&& ref != current_class_type
/* Have to check this, in case we have contradictory tag info. */
&& IS_AGGR_TYPE_CODE (TREE_CODE (ref)))
@ -12643,7 +12642,7 @@ xref_basetypes (code_type_node, name, ref, binfo)
/* This code replaces similar code in layout_basetypes.
We put the complete_type first for implicit `typename'. */
if (TYPE_SIZE (basetype) == NULL_TREE
if (!COMPLETE_TYPE_P (basetype)
&& ! (current_template_parms && uses_template_parms (basetype)))
{
cp_error ("base class `%T' has incomplete type", basetype);
@ -13058,11 +13057,12 @@ check_function_type (decl)
tree decl;
{
tree fntype = TREE_TYPE (decl);
tree return_type = complete_type (TREE_TYPE (fntype));
/* In a function definition, arg types must be complete. */
require_complete_types_for_parms (current_function_parms);
if (TYPE_SIZE (complete_type (TREE_TYPE (fntype))) == NULL_TREE)
if (!COMPLETE_OR_VOID_TYPE_P (return_type))
{
cp_error ("return type `%#T' is incomplete", TREE_TYPE (fntype));

View File

@ -1457,7 +1457,7 @@ check_classfn (ctype, function)
else
{
methods = 0;
if (TYPE_SIZE (ctype) == 0)
if (!COMPLETE_TYPE_P (ctype))
incomplete_type_error (function, ctype);
else
cp_error ("no `%#D' member function declared in class `%T'",
@ -1468,7 +1468,7 @@ check_classfn (ctype, function)
spurious errors (unless the CTYPE is not yet defined, in which
case we'll only confuse ourselves when the function is declared
properly within the class. */
if (TYPE_SIZE (ctype))
if (COMPLETE_TYPE_P (ctype))
add_method (ctype, methods, function);
return NULL_TREE;
}
@ -3734,7 +3734,7 @@ reparse_absdcl_as_casts (decl, expr)
decl = TREE_OPERAND (decl, 0);
expr = digest_init (type, expr, (tree *) 0);
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{
int failure = complete_array_type (type, expr, 1);
if (failure)

View File

@ -362,7 +362,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
/* A nested class may declare a member of an enclosing class
to be a friend, so we do lookup here even if CTYPE is in
the process of being defined. */
else if (TYPE_SIZE (ctype) != 0 || TYPE_BEING_DEFINED (ctype))
else if (COMPLETE_TYPE_P (ctype) || TYPE_BEING_DEFINED (ctype))
{
decl = check_classfn (ctype, decl);

View File

@ -1610,7 +1610,7 @@ build_offset_ref (type, name)
name = ctor_identifier;
#endif
if (TYPE_SIZE (complete_type (type)) == 0
if (!COMPLETE_TYPE_P (complete_type (type))
&& !TYPE_BEING_DEFINED (type))
{
cp_error ("incomplete type `%T' does not have member `%D'", type,

View File

@ -1,7 +1,6 @@
/* A Bison parser, made from parse.y
by GNU Bison version 1.27
*/
by GNU Bison version 1.28 */
#define YYBISON 1 /* Identify Bison output. */
@ -4031,8 +4030,8 @@ static const short yycheck[] = { 4,
78, 79, 80, 81, 82, 83, 84, 85
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/bison.simple"
/* This file comes from bison-1.27. */
#line 3 "/usr/lib/bison.simple"
/* This file comes from bison-1.28. */
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@ -4245,7 +4244,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
#endif
#endif
#line 216 "/usr/share/bison.simple"
#line 217 "/usr/lib/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@ -6543,7 +6542,7 @@ case 480:
/* struct B: public A; is not accepted by the standard grammar. */
if (CLASS_TYPE_P (yyval.ftype.t)
&& TYPE_BINFO_BASETYPES (yyval.ftype.t)
&& !TYPE_SIZE (yyval.ftype.t)
&& !COMPLETE_TYPE_P (yyval.ftype.t)
&& ! TYPE_BEING_DEFINED (yyval.ftype.t))
cp_error ("base clause without member specification for `%#T'",
yyval.ftype.t);
@ -8230,7 +8229,7 @@ case 878:
break;}
}
/* the action file gets copied in in place of this dollarsign */
#line 542 "/usr/share/bison.simple"
#line 543 "/usr/lib/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;

View File

@ -2206,7 +2206,7 @@ structsp:
/* struct B: public A; is not accepted by the standard grammar. */
if (CLASS_TYPE_P ($$.t)
&& TYPE_BINFO_BASETYPES ($$.t)
&& !TYPE_SIZE ($$.t)
&& !COMPLETE_TYPE_P ($$.t)
&& ! TYPE_BEING_DEFINED ($$.t))
cp_error ("base clause without member specification for `%#T'",
$$.t);

View File

@ -657,7 +657,7 @@ maybe_process_partial_specialization (type)
if (IS_AGGR_TYPE (type) && CLASSTYPE_USE_TEMPLATE (type))
{
if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
&& TYPE_SIZE (type) == NULL_TREE)
&& !COMPLETE_TYPE_P (type))
{
if (current_namespace
!= decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type)))
@ -4577,7 +4577,7 @@ tsubst_friend_function (decl, args)
new_friend = old_decl;
}
}
else if (TYPE_SIZE (DECL_CONTEXT (new_friend)))
else if (COMPLETE_TYPE_P (DECL_CONTEXT (new_friend)))
{
/* Check to see that the declaration is really present, and,
possibly obtain an improved declaration. */
@ -4673,7 +4673,7 @@ instantiate_class_template (type)
if (type == error_mark_node)
return error_mark_node;
if (TYPE_BEING_DEFINED (type) || TYPE_SIZE (type))
if (TYPE_BEING_DEFINED (type) || COMPLETE_TYPE_P (type))
return type;
/* Figure out which template is being instantiated. */
@ -4749,7 +4749,7 @@ instantiate_class_template (type)
/* If the template we're instantiating is incomplete, then clearly
there's nothing we can do. */
if (TYPE_SIZE (pattern) == NULL_TREE)
if (!COMPLETE_TYPE_P (pattern))
return type;
/* If this is a partial instantiation, don't tsubst anything. We will
@ -6623,7 +6623,7 @@ tsubst (t, args, complain, in_decl)
point, so here CTX really should have complete type, unless
it's a partial instantiation. */
ctx = complete_type (ctx);
if (!TYPE_SIZE (ctx))
if (!COMPLETE_TYPE_P (ctx))
{
if (complain)
incomplete_type_error (NULL_TREE, ctx);
@ -9177,7 +9177,7 @@ do_type_instantiation (t, storage)
if (flag_external_templates)
return;
if (TYPE_SIZE (t) == NULL_TREE)
if (!COMPLETE_TYPE_P (t))
{
cp_error ("explicit instantiation of `%#T' before definition of template",
t);
@ -9653,7 +9653,7 @@ instantiate_pending_templates ()
{
tree fn;
if (!TYPE_SIZE (instantiation))
if (!COMPLETE_TYPE_P (instantiation))
{
instantiate_class_template (instantiation);
if (CLASSTYPE_TEMPLATE_INSTANTIATION (instantiation))
@ -9662,14 +9662,14 @@ instantiate_pending_templates ()
fn = TREE_CHAIN (fn))
if (! DECL_ARTIFICIAL (fn))
instantiate_decl (fn);
if (TYPE_SIZE (instantiation))
if (COMPLETE_TYPE_P (instantiation))
{
instantiated_something = 1;
reconsider = 1;
}
}
if (TYPE_SIZE (instantiation))
if (COMPLETE_TYPE_P (instantiation))
/* If INSTANTIATION has been instantiated, then we don't
need to consider it again in the future. */
*t = TREE_CHAIN (*t);

View File

@ -100,7 +100,7 @@ repo_get_id (t)
/* If we're not done setting up the class, we may not have set up
the vtable, so going ahead would give the wrong answer.
See g++.pt/instantiate4.C. */
if (TYPE_SIZE (t) == NULL_TREE || TYPE_BEING_DEFINED (t))
if (!COMPLETE_TYPE_P (t) || TYPE_BEING_DEFINED (t))
my_friendly_abort (981113);
t = TYPE_BINFO_VTABLE (t);

View File

@ -273,7 +273,7 @@ build_typeid (exp)
return error_mark_node;
}
if (TYPE_SIZE (type_info_type_node) == NULL_TREE)
if (!COMPLETE_TYPE_P (type_info_type_node))
{
error ("must #include <typeinfo> before using typeid");
return error_mark_node;
@ -462,7 +462,7 @@ get_typeid (type)
if (type == error_mark_node)
return error_mark_node;
if (TYPE_SIZE (type_info_type_node) == NULL_TREE)
if (!COMPLETE_TYPE_P (type_info_type_node))
{
error ("must #include <typeinfo> before using typeid");
return error_mark_node;
@ -564,7 +564,7 @@ build_dynamic_cast_1 (type, expr)
errstr = "target is not pointer or reference to class";
goto fail;
}
if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{
errstr = "target is not pointer or reference to complete type";
goto fail;
@ -609,7 +609,7 @@ build_dynamic_cast_1 (type, expr)
errstr = "source is not a pointer to class";
goto fail;
}
if (TYPE_SIZE (complete_type (TREE_TYPE (exprtype))) == NULL_TREE)
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
{
errstr = "source is a pointer to incomplete type";
goto fail;
@ -625,7 +625,7 @@ build_dynamic_cast_1 (type, expr)
errstr = "source is not of class type";
goto fail;
}
if (TYPE_SIZE (complete_type (TREE_TYPE (exprtype))) == NULL_TREE)
if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
{
errstr = "source is of incomplete class type";
goto fail;
@ -1466,7 +1466,7 @@ synthesize_tinfo_var (target_type, real_name)
break;
case UNION_TYPE:
case RECORD_TYPE:
if (!TYPE_SIZE (target_type))
if (!COMPLETE_TYPE_P (target_type))
{
/* FIXME: incomplete type. Awaiting specification. */
return NULL_TREE;
@ -1820,7 +1820,7 @@ emit_support_tinfos ()
bltn_type = xref_tag (class_type_node,
get_identifier ("__fundamental_type_info"), 1);
pop_nested_namespace (abi_node);
if (!TYPE_SIZE (bltn_type))
if (!COMPLETE_TYPE_P (bltn_type))
return;
dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (bltn_type), 1);
if (DECL_EXTERNAL (dtor))

View File

@ -1692,7 +1692,7 @@ lookup_fnfields_1 (type, name)
/* If the type is complete and we're past the conversion ops,
switch to binary search. */
if (! DECL_CONV_FN_P (tmp)
&& TYPE_SIZE (type))
&& COMPLETE_TYPE_P (type))
{
int lo = i + 1, hi = len;
@ -3560,7 +3560,7 @@ lookup_conversions (type)
tree t;
tree conversions = NULL_TREE;
if (TYPE_SIZE (type))
if (COMPLETE_TYPE_P (type))
bfs_walk (TYPE_BINFO (type), add_conversions, 0, &conversions);
for (t = conversions; t; t = TREE_CHAIN (t))

View File

@ -1919,7 +1919,7 @@ begin_class_definition (t)
}
/* If this type was already complete, and we see another definition,
that's an error. */
else if (TYPE_SIZE (t))
else if (COMPLETE_TYPE_P (t))
duplicate_tag_error (t);
/* Update the location of the decl. */

View File

@ -474,7 +474,7 @@ build_cplus_method_type (basetype, rettype, argtypes)
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;

View File

@ -106,7 +106,7 @@ require_complete_type (value)
type = TREE_TYPE (value);
/* First, detect a valid value with a complete type. */
if (TYPE_SIZE (type) && !integer_zerop (TYPE_SIZE (type)))
if (COMPLETE_TYPE_P (type))
return value;
/* If we see X::Y, we build an OFFSET_TYPE which has
@ -145,12 +145,12 @@ complete_type (type)
at some point. */
return error_mark_node;
if (type == error_mark_node || TYPE_SIZE (type) != NULL_TREE)
if (type == error_mark_node || COMPLETE_TYPE_P (type))
;
else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
{
tree t = complete_type (TREE_TYPE (type));
if (TYPE_SIZE (t) != NULL_TREE && ! processing_template_decl)
if (COMPLETE_TYPE_P (t) && ! processing_template_decl)
layout_type (type);
TYPE_NEEDS_CONSTRUCTING (type)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t));
@ -176,7 +176,7 @@ complete_type_or_else (type, value)
if (type == error_mark_node)
/* We already issued an error. */
return NULL_TREE;
else if (!TYPE_SIZE (type) || integer_zerop (TYPE_SIZE (type)))
else if (!COMPLETE_TYPE_P (type))
{
incomplete_type_error (value, type);
return NULL_TREE;
@ -1584,7 +1584,7 @@ c_sizeof (type)
return size_zero_node;
}
if (TYPE_SIZE (complete_type (type)) == 0)
if (!COMPLETE_TYPE_P (complete_type (type)))
{
cp_error ("`sizeof' applied to incomplete type `%T'", type);
return size_zero_node;
@ -1643,7 +1643,7 @@ c_sizeof_nowarn (type)
if (code == REFERENCE_TYPE)
type = TREE_TYPE (type);
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
return size_zero_node;
/* Convert in case a char is more than one unit. */
@ -2436,7 +2436,7 @@ build_array_ref (array, idx)
address arithmetic on its address.
Likewise an array of elements of variable size. */
if (TREE_CODE (idx) != INTEGER_CST
|| (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0
|| (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))
&& (TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))))
!= INTEGER_CST)))
{
@ -3163,7 +3163,7 @@ convert_arguments (typelist, values, fndecl, flags)
/* Formal parm type is specified by a function prototype. */
tree parmval;
if (TYPE_SIZE (complete_type (type)) == 0)
if (!COMPLETE_TYPE_P (complete_type (type)))
{
error ("parameter type of called function is incomplete");
parmval = val;
@ -4228,7 +4228,7 @@ pointer_diff (op0, op1, ptrtype)
cp_convert (restype, op1));
/* This generates an error if op1 is a pointer to an incomplete type. */
if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
if (!COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
error ("invalid use of a pointer to an incomplete type in pointer arithmetic");
op1 = ((TREE_CODE (target_type) == VOID_TYPE
@ -4316,7 +4316,7 @@ build_x_unary_op (code, xarg)
if (code == ADDR_EXPR
&& TREE_CODE (xarg) != TEMPLATE_ID_EXPR
&& ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (xarg)))
&& TYPE_SIZE (TREE_TYPE (xarg)) == NULL_TREE)
&& !COMPLETE_TYPE_P (TREE_TYPE (xarg)))
|| (TREE_CODE (xarg) == OFFSET_REF)))
/* don't look for a function */;
else
@ -4524,7 +4524,9 @@ build_unary_op (code, xarg, noconvert)
if (TREE_CODE (argtype) == POINTER_TYPE)
{
enum tree_code tmp = TREE_CODE (TREE_TYPE (argtype));
if (TYPE_SIZE (complete_type (TREE_TYPE (argtype))) == 0)
tree type = complete_type (TREE_TYPE (argtype));
if (!COMPLETE_OR_VOID_TYPE_P (type))
cp_error ("cannot %s a pointer to incomplete type `%T'",
((code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR)
@ -5536,8 +5538,8 @@ build_c_cast (type, expr)
&& TREE_CODE (otype) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
&& TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
&& TYPE_SIZE (TREE_TYPE (otype))
&& TYPE_SIZE (TREE_TYPE (type))
&& COMPLETE_TYPE_P (TREE_TYPE (otype))
&& COMPLETE_TYPE_P (TREE_TYPE (type))
&& TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
cp_warning ("cast from `%T' to `%T' increases required alignment of target type",
otype, type);
@ -5819,7 +5821,7 @@ build_modify_expr (lhs, modifycode, rhs)
{
tree tmp = convert_from_reference (lhs);
lhstype = TREE_TYPE (tmp);
if (TYPE_SIZE (lhstype) == 0)
if (!COMPLETE_TYPE_P (lhstype))
{
incomplete_type_error (lhs, lhstype);
return error_mark_node;
@ -5830,7 +5832,7 @@ build_modify_expr (lhs, modifycode, rhs)
if (TREE_CODE (TREE_TYPE (newrhs)) == REFERENCE_TYPE)
{
tree tmp = convert_from_reference (newrhs);
if (TYPE_SIZE (TREE_TYPE (tmp)) == 0)
if (!COMPLETE_TYPE_P (TREE_TYPE (tmp)))
{
incomplete_type_error (newrhs, TREE_TYPE (tmp));
return error_mark_node;

View File

@ -648,7 +648,7 @@ digest_init (type, init, tail)
/* Come here only for records and arrays (and unions with constructors). */
if (TYPE_SIZE (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
if (COMPLETE_TYPE_P (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
{
cp_error ("variable-sized object of type `%T' may not be initialized",
type);
@ -1267,11 +1267,8 @@ build_functional_cast (exp, parms)
then the slot being initialized will be filled in. */
if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
{
cp_error ("type `%T' is not yet defined", type);
return error_mark_node;
}
if (!complete_type_or_else (type, NULL_TREE))
return error_mark_node;
if (abstract_virtuals_error (NULL_TREE, type))
return error_mark_node;
@ -1474,7 +1471,7 @@ add_exception_specifier (list, spec, complain)
else if (TREE_CODE (core) == TEMPLATE_TYPE_PARM)
ok = 1;
else
ok = TYPE_SIZE (complete_type (core)) != NULL_TREE;
ok = COMPLETE_TYPE_P (complete_type (core));
if (ok)
{

View File

@ -473,7 +473,7 @@ dbxout_typedefs (syms)
tree type = TREE_TYPE (syms);
if (TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& TYPE_SIZE (type) != NULL_TREE
&& COMPLETE_TYPE_P (type)
&& ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
dbxout_symbol (TYPE_NAME (type), 0);
}
@ -1072,7 +1072,7 @@ dbxout_type (type, full, show_arg_types)
and either that's all we want or that's the best we could do,
don't repeat the cross reference.
Sun dbx crashes if we do. */
if (! full || TYPE_SIZE (type) == 0
if (! full || !COMPLETE_TYPE_P (type)
/* No way in DBX fmt to describe a variable size. */
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
return;
@ -1097,7 +1097,7 @@ dbxout_type (type, full, show_arg_types)
&& ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_IGNORED_P (TYPE_NAME (type)))
&& !full)
|| TYPE_SIZE (type) == 0
|| !COMPLETE_TYPE_P (type)
/* No way in DBX fmt to describe a variable size. */
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{
@ -1362,7 +1362,7 @@ dbxout_type (type, full, show_arg_types)
&& ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_IGNORED_P (TYPE_NAME (type)))
&& !full)
|| TYPE_SIZE (type) == 0
|| !COMPLETE_TYPE_P (type)
/* No way in DBX fmt to describe a variable size. */
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{
@ -1487,7 +1487,7 @@ dbxout_type (type, full, show_arg_types)
&& ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_IGNORED_P (TYPE_NAME (type)))
&& !full)
|| TYPE_SIZE (type) == 0)
|| !COMPLETE_TYPE_P (type))
{
fprintf (asmfile, "xe");
CHARS (3);
@ -1866,7 +1866,7 @@ dbxout_symbol (decl, local)
if (tag_needed && TYPE_NAME (type) != 0
&& (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
|| (DECL_NAME (TYPE_NAME (type)) != 0))
&& TYPE_SIZE (type) != 0
&& COMPLETE_TYPE_P (type)
&& !TREE_ASM_WRITTEN (TYPE_NAME (type)))
{
/* For a TYPE_DECL with no name, but the type has a name,

View File

@ -2410,6 +2410,7 @@ location_or_const_value_attribute (decl)
rtl = DECL_INCOMING_RTL (decl);
else if (! BYTES_BIG_ENDIAN)
if (TREE_CODE (declared_type) == INTEGER_TYPE)
/* NMS WTF? */
if (TYPE_SIZE (declared_type) <= TYPE_SIZE (passed_type))
rtl = DECL_INCOMING_RTL (decl);
}
@ -3361,7 +3362,7 @@ output_enumeration_type_die (arg)
given enum type is incomplete, do not generate the AT_byte_size
attribute or the AT_element_list attribute. */
if (TYPE_SIZE (type))
if (COMPLETE_TYPE_P (type))
{
byte_size_attribute (type);
element_list_attribute (TYPE_FIELDS (type));
@ -3794,7 +3795,7 @@ output_structure_type_die (arg)
of members (since we don't have any idea what they might be for an
incomplete type). */
if (TYPE_SIZE (type))
if (COMPLETE_TYPE_P (type))
{
dienum_push ();
byte_size_attribute (type);
@ -3907,7 +3908,7 @@ output_union_type_die (arg)
of members (since we don't have any idea what they might be for an
incomplete type). */
if (TYPE_SIZE (type))
if (COMPLETE_TYPE_P (type))
{
dienum_push ();
byte_size_attribute (type);
@ -4408,7 +4409,7 @@ output_type (type, containing_scope)
can safely generate correct Dwarf descriptions for these file-
scope tagged types. */
if (TYPE_SIZE (type) == 0
if (!COMPLETE_TYPE_P (type)
&& (TYPE_CONTEXT (type) == NULL
|| AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
|| TREE_CODE (TYPE_CONTEXT (type)) == NAMESPACE_DECL)
@ -4463,7 +4464,7 @@ output_type (type, containing_scope)
appropriate (containing) type.
*/
if (TYPE_SIZE (type))
if (COMPLETE_TYPE_P (type))
{
/* First output info about the base classes. */
if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))

View File

@ -5318,7 +5318,7 @@ safe_from_p (x, exp, top_p)
So we assume here that something at a higher level has prevented a
clash. This is somewhat bogus, but the best we can do. Only
do this when X is BLKmode and when we are at the top level. */
|| (top_p && TREE_TYPE (exp) != 0 && TYPE_SIZE (TREE_TYPE (exp)) != 0
|| (top_p && TREE_TYPE (exp) != 0 && COMPLETE_TYPE_P (TREE_TYPE (exp))
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST
&& (TREE_CODE (TREE_TYPE (exp)) != ARRAY_TYPE
|| TYPE_ARRAY_MAX_SIZE (TREE_TYPE (exp)) == NULL_TREE
@ -5875,7 +5875,7 @@ expand_expr (exp, target, tmode, modifier)
case VAR_DECL:
/* If a static var's type was incomplete when the decl was written,
but the type is complete now, lay out the decl now. */
if (DECL_SIZE (exp) == 0 && TYPE_SIZE (TREE_TYPE (exp)) != 0
if (DECL_SIZE (exp) == 0 && COMPLETE_TYPE_P (TREE_TYPE (exp))
&& (TREE_STATIC (exp) || DECL_EXTERNAL (exp)))
{
push_obstacks_nochange ();

View File

@ -4638,7 +4638,7 @@ assign_parms (fndecl)
push_to_sequence (conversion_insns);
if (TYPE_SIZE (type) == 0
if (!COMPLETE_TYPE_P (type)
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
/* This is a variable sized object. */
copy = gen_rtx_MEM (BLKmode,

View File

@ -860,7 +860,7 @@ sdbout_symbol (decl, local)
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE)
{
if (TYPE_SIZE (type) != 0 /* not a forward reference */
if (COMPLETE_TYPE_P (type) /* not a forward reference */
&& KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
sdbout_one_type (type);
}
@ -1131,7 +1131,7 @@ sdbout_one_type (type)
return;
/* Output nothing if type is not yet defined. */
if (TYPE_SIZE (type) == 0)
if (!COMPLETE_TYPE_P (type))
return;
TREE_ASM_WRITTEN (type) = 1;

View File

@ -1163,7 +1163,7 @@ layout_type (type)
break;
case VOID_TYPE:
TYPE_SIZE (type) = bitsize_int (0);
/* VOID_TYPE is an incompletable type, it has no size */
TYPE_SIZE_UNIT (type) = size_zero_node;
TYPE_ALIGN (type) = 1;
TYPE_MODE (type) = VOIDmode;

View File

@ -4731,7 +4731,7 @@ build_array_type (elt_type, index_type)
hashcode = TYPE_HASH (elt_type) + TYPE_HASH (index_type);
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;
}
@ -4780,7 +4780,7 @@ build_function_type (value_type, arg_types)
hashcode = TYPE_HASH (value_type) + type_hash_list (arg_types);
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;
}
@ -4817,7 +4817,7 @@ build_method_type (basetype, type)
hashcode = TYPE_HASH (basetype) + TYPE_HASH (type);
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;
@ -4844,7 +4844,7 @@ build_offset_type (basetype, type)
hashcode = TYPE_HASH (basetype) + TYPE_HASH (type);
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;
@ -4869,7 +4869,7 @@ build_complex_type (component_type)
hashcode = TYPE_HASH (component_type);
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
if (!COMPLETE_TYPE_P (t))
layout_type (t);
/* If we are writing Dwarf2 output we need to create a name,

View File

@ -468,6 +468,17 @@ extern void tree_class_check_failed PARAMS ((const tree, char,
#define POINTER_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
/* Nonzero if this type is a complete type. */
#define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
/* Nonzero if this type is complete or is cv void. */
#define COMPLETE_OR_VOID_TYPE_P(NODE) \
(COMPLETE_TYPE_P (NODE) || TREE_CODE (NODE) == VOID_TYPE)
/* Nonzero if this type is complete or is an array with unspecified bound. */
#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
(COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : NODE))
/* Nonzero if TYPE represents a type. */
#define TYPE_P(TYPE) (TREE_CODE_CLASS (TREE_CODE (TYPE)) == 't')