diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2009-11-25 21:28:00 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2009-11-25 21:28:00 +0000 |
commit | ca37373a97985aed8cdba95af4c4e27484c19444 (patch) | |
tree | e336476fa49714cee3ff0c7325c05d48edb95b3b /gcc | |
parent | 281e33e1bb62f77b7f999213da93db0088d08e1d (diff) | |
download | gcc-ca37373a97985aed8cdba95af4c4e27484c19444.zip gcc-ca37373a97985aed8cdba95af4c4e27484c19444.tar.gz gcc-ca37373a97985aed8cdba95af4c4e27484c19444.tar.bz2 |
decl.c (gnat_to_gnu_entity): Translate regular boolean types into BOOLEAN_TYPEs.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Type>:
Translate regular boolean types into BOOLEAN_TYPEs.
From-SVN: r154658
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 26 |
2 files changed, 24 insertions, 16 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3360231..2098cfd 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2009-11-25 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Type>: + Translate regular boolean types into BOOLEAN_TYPEs. + 2009-11-24 Eric Botcazou <ebotcazou@adacore.com> * sem_util.adb (Set_Debug_Info_Needed): For an E_Class_Wide_Subtype, @@ -8,16 +13,17 @@ (build_vms_descriptor32): Adjust call to finish_record_type. (build_vms_descriptor): Likewise. (build_unc_object_type): Likewise. - * decl.c (gnat_to_gnu_entity): Adjust calls to finish_record_type and - components_to_record. + * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust calls to + finish_record_type and components_to_record. (make_packable_type): Adjust call to finish_record_type. (maybe_pad_type): Likewise. Tweak condition. (components_to_record): Likewise. Replace DO_NOT_FINALIZE parameter with MAYBE_UNUSED. Adjust recursive call. (create_variant_part_from): Adjust call to finish_record_type. Do not call rest_of_record_type_compilation on the new record types. - * trans.c (gigi): Adjust call to finish_record_type. - * gigi.h (finish_record_type): Adjust prototype and comment. + * gcc-interface/trans.c (gigi): Adjust call to finish_record_type. + * gcc-interface/gigi.h (finish_record_type): Adjust prototype and + comment. (rest_of_record_type_compilation): Adjust comment. 2009-11-24 Eric Botcazou <ebotcazou@adacore.com> diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 8b4936a..0effe88 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1416,30 +1416,31 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) break; } - /* Normal case of non-character type or non-Standard character type. */ { - /* Here we have a list of enumeral constants in First_Literal. - We make a CONST_DECL for each and build into GNU_LITERAL_LIST - the list to be placed into TYPE_FIELDS. Each node in the list - is a TREE_LIST whose TREE_VALUE is the literal name and whose - TREE_PURPOSE is the value of the literal. */ - - Entity_Id gnat_literal; + /* We have a list of enumeral constants in First_Literal. We make a + CONST_DECL for each one and build into GNU_LITERAL_LIST the list to + be placed into TYPE_FIELDS. Each node in the list is a TREE_LIST + whose TREE_VALUE is the literal name and whose TREE_PURPOSE is the + value of the literal. But when we have a regular boolean type, we + simplify this a little by using a BOOLEAN_TYPE. */ + bool is_boolean = Is_Boolean_Type (gnat_entity) + && !Has_Non_Standard_Rep (gnat_entity); tree gnu_literal_list = NULL_TREE; + Entity_Id gnat_literal; if (Is_Unsigned_Type (gnat_entity)) gnu_type = make_unsigned_type (esize); else gnu_type = make_signed_type (esize); - TREE_SET_CODE (gnu_type, ENUMERAL_TYPE); + TREE_SET_CODE (gnu_type, is_boolean ? BOOLEAN_TYPE : ENUMERAL_TYPE); for (gnat_literal = First_Literal (gnat_entity); Present (gnat_literal); gnat_literal = Next_Literal (gnat_literal)) { - tree gnu_value = UI_To_gnu (Enumeration_Rep (gnat_literal), - gnu_type); + tree gnu_value + = UI_To_gnu (Enumeration_Rep (gnat_literal), gnu_type); tree gnu_literal = create_var_decl (get_entity_name (gnat_literal), NULL_TREE, gnu_type, gnu_value, true, false, false, @@ -1450,7 +1451,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_value, gnu_literal_list); } - TYPE_VALUES (gnu_type) = nreverse (gnu_literal_list); + if (!is_boolean) + TYPE_VALUES (gnu_type) = nreverse (gnu_literal_list); /* Note that the bounds are updated at the end of this function to avoid an infinite recursion since they refer to the type. */ |