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/cp/typeck.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/cp/typeck.c')
-rw-r--r-- | gcc/cp/typeck.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 43bd1bc..0c45c9b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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; |