diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-04-27 10:49:35 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-04-27 10:49:35 +0000 |
commit | afc737f05213af90e74b1b62efe4039dbc3a7fc2 (patch) | |
tree | 2dbbe4060eceb145e54f50961129a316f38fc56c /gcc/ada/gcc-interface/utils.c | |
parent | a2e76867ad58dd0d7b5e09b95533029ad0659202 (diff) | |
download | gcc-afc737f05213af90e74b1b62efe4039dbc3a7fc2.zip gcc-afc737f05213af90e74b1b62efe4039dbc3a7fc2.tar.gz gcc-afc737f05213af90e74b1b62efe4039dbc3a7fc2.tar.bz2 |
gigi.h (gnat_to_gnu_entity): Adjust prototype.
* gcc-interface/gigi.h (gnat_to_gnu_entity): Adjust prototype.
(maybe_pad_type): Adjust comment.
(finish_record_type): Likewise.
(rest_of_record_type_compilation): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity): Change DEFINITION type
parameter from integer to boolean. Adjust recursive calls.
<E_Subprogram_Type>: Use copy_type and remove redundant assignments.
<E_Signed_Integer_Subtype>: Adjust comment. Remove call to
rest_of_record_type_compilation. Set TYPE_PADDING_P flag earlier.
Pass false to finish_record_type. Set the debug type later.
<E_Record_Subtype>: Remove call to rest_of_record_type_compilation.
(gnat_to_gnu_component_type): Fix formatting.
(gnat_to_gnu_field_decl): Adjust call to gnat_to_gnu_entity.
(gnat_to_gnu_type): Likewise.
* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
(Loop_Statement_to_gnu): Likewise.
(Subprogram_Body_to_gnu): Likewise.
(Exception_Handler_to_gnu_fe_sjlj): Likewise.
(Exception_Handler_to_gnu_gcc): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
(push_exception_label_stack): Likewise.
(elaborate_all_entities_for_package): Likewise.
(process_freeze_entity): Likewise.
(process_decls): Likewise.
(process_type): Likewise.
* gcc-interface/utils.c (struct deferred_decl_context_node): Tweak.
(maybe_pad_type): Adjust comments. Set the debug type later. Remove
call to rest_of_record_type_compilation.
(rest_of_record_type_compilation): Use copy_type.
(copy_type): Use correctly typed constants.
(gnat_signed_or_unsigned_type_for): Use copy_type.
* gcc-interface/utils2.c (nonbinary_modular_operation): Likewise.
(build_goto_raise): Adjust call tognat_to_gnu_entity.
From-SVN: r235479
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index d568dff..db38701 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -239,17 +239,24 @@ static tree convert_to_fat_pointer (tree, tree); static unsigned int scale_by_factor_of (tree, unsigned int); static bool potential_alignment_gap (tree, tree, tree); -/* A linked list used as a queue to defer the initialization of the - DECL_CONTEXT attribute of ..._DECL nodes and of the TYPE_CONTEXT attribute - of ..._TYPE nodes. */ +/* Linked list used as a queue to defer the initialization of the DECL_CONTEXT + of ..._DECL nodes and of the TYPE_CONTEXT of ..._TYPE nodes. */ struct deferred_decl_context_node { - tree decl; /* The ..._DECL node to work on. */ - Entity_Id gnat_scope; /* The corresponding entity's Scope attribute. */ - int force_global; /* force_global value when pushing DECL. */ - vec<tree, va_heap, vl_ptr> types; /* A list of ..._TYPE nodes to propagate the - context to. */ - struct deferred_decl_context_node *next; /* The next queue item. */ + /* The ..._DECL node to work on. */ + tree decl; + + /* The corresponding entity's Scope. */ + Entity_Id gnat_scope; + + /* The value of force_global when DECL was pushed. */ + int force_global; + + /* The list of ..._TYPE nodes to propagate the context to. */ + vec<tree> types; + + /* The next queue item. */ + struct deferred_decl_context_node *next; }; static struct deferred_decl_context_node *deferred_decl_context_queue = NULL; @@ -1217,7 +1224,8 @@ lookup_and_insert_pad_type (tree type) IS_COMPONENT_TYPE is true if this is being done for the component type of an array. IS_USER_TYPE is true if the original type needs to be completed. DEFINITION is true if this type is being defined. SET_RM_SIZE is true if - the RM size of the resulting type is to be set to SIZE too. */ + the RM size of the resulting type is to be set to SIZE too; in this case, + the padded type is canonicalized before being returned. */ tree maybe_pad_type (tree type, tree size, unsigned int align, @@ -1280,8 +1288,6 @@ maybe_pad_type (tree type, tree size, unsigned int align, type and name. */ record = make_node (RECORD_TYPE); TYPE_PADDING_P (record) = 1; - if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) - SET_TYPE_DEBUG_TYPE (record, type); /* ??? Padding types around packed array implementation types will be considered as root types in the array descriptor language hook (see @@ -1337,9 +1343,12 @@ maybe_pad_type (tree type, tree size, unsigned int align, bitsize_zero_node, 0, 1); DECL_INTERNAL_P (field) = 1; - /* Do not emit debug info until after the auxiliary record is built. */ + /* We will output additional debug info manually below. */ finish_record_type (record, field, 1, false); + if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) + SET_TYPE_DEBUG_TYPE (record, type); + /* Set the RM size if requested. */ if (set_rm_size) { @@ -1409,8 +1418,6 @@ maybe_pad_type (tree type, tree size, unsigned int align, } } - rest_of_record_type_compilation (record); - built: /* If a simple size was explicitly given, maybe issue a warning. */ if (!size @@ -1672,7 +1679,7 @@ finish_fat_pointer_type (tree record_type, tree field_list) laid out already; only set the sizes and alignment. If REP_LEVEL is two, this record is derived from a parent record and thus inherits its layout; only make a pass on the fields to finalize them. DEBUG_INFO_P is true if - we need to write debug information about this type. */ + additional debug info needs to be output for this type. */ void finish_record_type (tree record_type, tree field_list, int rep_level, @@ -1927,10 +1934,9 @@ has_parallel_type (tree type) return DECL_PARALLEL_TYPE (decl) != NULL_TREE; } -/* Wrap up compilation of RECORD_TYPE, i.e. output all the debug information - associated with it. It need not be invoked directly in most cases since - finish_record_type takes care of doing so, but this can be necessary if - a parallel type is to be attached to the record type. */ +/* Wrap up compilation of RECORD_TYPE, i.e. output additional debug info + associated with it. It need not be invoked directly in most cases as + finish_record_type takes care of doing so. */ void rest_of_record_type_compilation (tree record_type) @@ -2072,7 +2078,7 @@ rest_of_record_type_compilation (tree record_type) field_type = build_pointer_type (field_type); if (align != 0 && TYPE_ALIGN (field_type) > align) { - field_type = copy_node (field_type); + field_type = copy_type (field_type); SET_TYPE_ALIGN (field_type, align); } var = true; @@ -2284,10 +2290,10 @@ copy_type (tree type) aliased with TREE_CHAIN. */ TYPE_STUB_DECL (new_type) = TYPE_STUB_DECL (type); - TYPE_POINTER_TO (new_type) = 0; - TYPE_REFERENCE_TO (new_type) = 0; + TYPE_POINTER_TO (new_type) = NULL_TREE; + TYPE_REFERENCE_TO (new_type) = NULL_TREE; TYPE_MAIN_VARIANT (new_type) = new_type; - TYPE_NEXT_VARIANT (new_type) = 0; + TYPE_NEXT_VARIANT (new_type) = NULL_TREE; TYPE_CANONICAL (new_type) = new_type; return new_type; @@ -3431,14 +3437,14 @@ gnat_signed_or_unsigned_type_for (int unsignedp, tree type_node) if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node)) { - type = copy_node (type); + type = copy_type (type); TREE_TYPE (type) = type_node; } else if (TREE_TYPE (type_node) && TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE && TYPE_MODULAR_P (TREE_TYPE (type_node))) { - type = copy_node (type); + type = copy_type (type); TREE_TYPE (type) = TREE_TYPE (type_node); } |