From c1b98a9573da874bdfc9a0d4fa2a1b1445488e01 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 13 Apr 1993 06:47:33 -0400 Subject: [PATCH] Treat QUAL_UNION_TYPE like UNION_TYPE when seeing if aggregate. From-SVN: r4118 --- gcc/calls.c | 7 +++++-- gcc/dbxout.c | 9 +++++++-- gcc/dwarfout.c | 25 ++++++++++++++++--------- gcc/function.c | 11 ++++++++--- gcc/print-tree.c | 4 +++- gcc/sdbout.c | 7 ++++++- gcc/stmt.c | 6 ++++-- gcc/varasm.c | 3 ++- 8 files changed, 51 insertions(+), 21 deletions(-) diff --git a/gcc/calls.c b/gcc/calls.c index b2b52b1337df..3dc52c614842 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -588,6 +588,7 @@ expand_call (exp, target, ignore) if (warn_aggregate_return && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)) warning ("function call has aggregate value"); @@ -1798,7 +1799,8 @@ expand_call (exp, target, ignore) MEM_IN_STRUCT_P (target) = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE); } } else if (pcc_struct_value) @@ -1810,7 +1812,8 @@ expand_call (exp, target, ignore) MEM_IN_STRUCT_P (target) = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE); } else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode) emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 27b996e9bfee..02a937c6674c 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -568,6 +568,7 @@ dbxout_type_fields (type) /* For nameless subunions and subrecords, treat their fields as ours. */ if (DECL_NAME (tem) == NULL_TREE && (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (tem)) == QUAL_UNION_TYPE || TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE)) dbxout_type_fields (TREE_TYPE (tem)); /* Omit here local type decls until we know how to support them. */ @@ -952,6 +953,7 @@ dbxout_type (type, full, show_arg_types) leave the type-number completely undefined rather than output a cross-reference. */ if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE || TREE_CODE (type) == ENUMERAL_TYPE) if ((TYPE_NAME (type) != 0 && !full) @@ -1093,6 +1095,7 @@ dbxout_type (type, full, show_arg_types) case RECORD_TYPE: case UNION_TYPE: + case QUAL_UNION_TYPE: { int i, n_baseclasses = 0; @@ -1505,7 +1508,8 @@ dbxout_symbol (decl, local) which gives both a typedef name and a tag. */ /* dbx requires the tag first and the typedef second. */ if ((TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) && TYPE_NAME (type) == decl && !(use_gnu_debug_info_extensions && have_used_extensions) && !TREE_ASM_WRITTEN (TYPE_NAME (type)) @@ -1534,7 +1538,8 @@ dbxout_symbol (decl, local) /* Short cut way to output a tag also. */ if ((TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) && TYPE_NAME (type) == decl) { if (use_gnu_debug_info_extensions && have_used_extensions) diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index b2552a66d32b..1026f4681486 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -770,7 +770,8 @@ is_tagged_type (type) { register enum tree_code code = TREE_CODE (type); - return (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE); + return (code == RECORD_TYPE || code == UNION_TYPE + || code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE); } static char * @@ -1379,6 +1380,7 @@ type_is_fundamental (type) case ARRAY_TYPE: case RECORD_TYPE: case UNION_TYPE: + case QUAL_UNION_TYPE: case ENUMERAL_TYPE: case FUNCTION_TYPE: case METHOD_TYPE: @@ -2390,6 +2392,7 @@ byte_size_attribute (tree_node) case ENUMERAL_TYPE: case RECORD_TYPE: case UNION_TYPE: + case QUAL_UNION_TYPE: size = int_size_in_bytes (tree_node); break; @@ -3760,11 +3763,12 @@ pend_type (type) FUNCTION_DECL node (for types local to the heading of some function definition), or to a FUNCTION_TYPE node (for types local to the prototyped parameter list of a function type specification), or to a - RECORD_TYPE or UNION_TYPE node (in the case of C++ nested types). + RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE node + (in the case of C++ nested types). The `scope' parameter should likewise be NULL or should point to a BLOCK node, a FUNCTION_DECL node, a FUNCTION_TYPE node, a RECORD_TYPE - node, or a UNION_TYPE node. + node, a UNION_TYPE node, or a QUAL_UNION_TYPE node. This function is used only for deciding when to "pend" and when to "un-pend" types to/from the pending_types_list. @@ -3949,15 +3953,16 @@ output_type (type, containing_scope) case ENUMERAL_TYPE: case RECORD_TYPE: case UNION_TYPE: + case QUAL_UNION_TYPE: /* For a non-file-scope tagged type, we can always go ahead and output a Dwarf description of this type right now, even if the type in question is still incomplete, because if this local type *was* ever completed anywhere within its scope, that complete definition would already have been attached to - this RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE node by the - time we reach this point. That's true because of the way the - front-end does its processing of file-scope declarations (of + this RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ENUMERAL_TYPE + node by the time we reach this point. That's true because of the + way the front-end does its processing of file-scope declarations (of functions and class types) within which other types might be nested. The C and C++ front-ends always gobble up such "local scope" things en-mass before they try to output *any* debugging @@ -4002,6 +4007,7 @@ output_type (type, containing_scope) break; case UNION_TYPE: + case QUAL_UNION_TYPE: output_die (output_union_type_die, type); break; @@ -4066,9 +4072,9 @@ output_type (type, containing_scope) } } - /* RECORD_TYPEs and UNION_TYPEs are themselves scopes (at least - in C++) so we must now output any nested pending types which - are local just to this RECORD_TYPE or UNION_TYPE. */ + /* RECORD_TYPEs, UNION_TYPEs, and QUAL_UNION_TYPEs are themselves + scopes (at least in C++) so we must now output any nested + pending types which are local just to this type. */ output_pending_types_for_scope (type); @@ -4125,6 +4131,7 @@ output_tagged_type_instantiation (type) break; case UNION_TYPE: + case QUAL_UNION_TYPE: output_die (output_inlined_union_type_die, type); break; diff --git a/gcc/function.c b/gcc/function.c index 6b219e9aad93..06f3649126d6 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -883,7 +883,8 @@ put_var_into_stack (decl) MEM_IN_STRUCT_P (reg) = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE); /* Now make sure that all refs to the variable, previously made when it was a register, are fixed up to be valid again. */ @@ -2650,7 +2651,8 @@ aggregate_value_p (exp) return 1; if (flag_pcc_struct_return && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE)) + || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE)) return 1; /* Make sure we have suitable call-clobbered regs to return the value in; if not, we must return it in memory. */ @@ -2768,7 +2770,8 @@ assign_parms (fndecl, second_time) int aggregate = (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (parm)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (parm)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (parm)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (parm)) == QUAL_UNION_TYPE); struct args_size stack_offset; struct args_size arg_size; int passed_pointer = 0; @@ -3593,6 +3596,7 @@ uninitialized_vars_warning (block) Unions are troublesome because members may be shorter. */ && TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE && TREE_CODE (TREE_TYPE (decl)) != UNION_TYPE + && TREE_CODE (TREE_TYPE (decl)) != QUAL_UNION_TYPE && TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE && DECL_RTL (decl) != 0 && GET_CODE (DECL_RTL (decl)) == REG @@ -4166,6 +4170,7 @@ init_function_start (subr, filename, line) if (warn_aggregate_return && (TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == RECORD_TYPE || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == UNION_TYPE + || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == QUAL_UNION_TYPE || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == ARRAY_TYPE)) warning ("function returns an aggregate"); diff --git a/gcc/print-tree.c b/gcc/print-tree.c index cb8df0c6b497..f9bbe89527a9 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -449,7 +449,9 @@ print_node (file, prefix, node, indent) } else if (TREE_CODE (node) == REAL_TYPE) fprintf (file, " precision %d", TYPE_PRECISION (node)); - else if (TREE_CODE (node) == RECORD_TYPE || TREE_CODE (node) == UNION_TYPE) + else if (TREE_CODE (node) == RECORD_TYPE + || TREE_CODE (node) == UNION_TYPE + || TREE_CODE (node) == QUAL_UNION_TYPE) print_node (file, "fields", TYPE_FIELDS (node), indent + 4); else if (TREE_CODE (node) == FUNCTION_TYPE || TREE_CODE (node) == METHOD_TYPE) { diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 26226021bdb8..a08230dc94a2 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -527,6 +527,7 @@ plain_type_1 (type) case RECORD_TYPE: case UNION_TYPE: + case QUAL_UNION_TYPE: case ENUMERAL_TYPE: { char *tag; @@ -558,6 +559,7 @@ plain_type_1 (type) } return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT : (TREE_CODE (type) == UNION_TYPE) ? T_UNION + : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION : T_ENUM); } case POINTER_TYPE: @@ -753,7 +755,8 @@ sdbout_symbol (decl, local) within functions. */ if (TREE_CODE (type) == ENUMERAL_TYPE || TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) { if (TYPE_SIZE (type) != 0 /* not a forward reference */ && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */ @@ -992,6 +995,7 @@ sdbout_one_type (type) { case RECORD_TYPE: case UNION_TYPE: + case QUAL_UNION_TYPE: case ENUMERAL_TYPE: type = TYPE_MAIN_VARIANT (type); /* Don't output a type twice. */ @@ -1053,6 +1057,7 @@ sdbout_one_type (type) switch (TREE_CODE (type)) { case UNION_TYPE: + case QUAL_UNION_TYPE: PUT_SDB_SCL (C_UNTAG); PUT_SDB_TYPE (T_UNION); member_scl = C_MOU; diff --git a/gcc/stmt.c b/gcc/stmt.c index 5c16f50b2a22..4400f614a485 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2931,7 +2931,8 @@ expand_decl (decl) MEM_IN_STRUCT_P (DECL_RTL (decl)) = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE); #if 0 /* If this is in memory because of -ffloat-store, set the volatile bit, to prevent optimizations from @@ -2981,7 +2982,8 @@ expand_decl (decl) MEM_IN_STRUCT_P (DECL_RTL (decl)) = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE); /* Indicate the alignment we actually gave this variable. */ #ifdef STACK_BOUNDARY diff --git a/gcc/varasm.c b/gcc/varasm.c index 20a4bdcc8863..3b34d4cb8d71 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -394,7 +394,8 @@ make_decl_rtl (decl, asmspec, top_level) MEM_IN_STRUCT_P (DECL_RTL (decl)) = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); + || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE); /* Optionally set flags or add text to the name to record information such as that it is a function name. -- 2.43.5