diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-03-21 18:10:48 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-03-21 18:10:48 +0000 |
commit | d0f062fbb30186c3d5b65adee0bf5ac478a366a4 (patch) | |
tree | 60cf3d06d6cd7ec81aa72cfba4859f1a66850aad /gcc/c-decl.c | |
parent | b9712646fb41219bfee574767c3d0bddb8a16ab5 (diff) | |
download | gcc-d0f062fbb30186c3d5b65adee0bf5ac478a366a4.zip gcc-d0f062fbb30186c3d5b65adee0bf5ac478a366a4.tar.gz gcc-d0f062fbb30186c3d5b65adee0bf5ac478a366a4.tar.bz2 |
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
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8a57460..c3ba279 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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; |