From 615cbd95bd73d35bdf41475f60243f9d9fefc5f4 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 26 Jul 2004 12:42:13 +0200 Subject: [PATCH] [multiple changes] 2004-07-26 Arnaud Charlet * sem_util.adb (Requires_Transient_Scope): Temporarily disable optimization, not supported by the tree-ssa back-end. 2004-07-26 Olivier Hainque * s-mastop-irix.adb: Update comments. * a-except.adb (Exception_Information): Raise Constraint_Error if exception Id is Null_Id. This is required behavior, which is more reliably and clearly checked at the top level interface level. 2004-07-26 Javier Miranda * exp_aggr.adb (Build_Array_Aggr_Code): Do not build the initialization call if a component has no default_expression and the box is used. * sem_aggr.adb (Resolve_Array_Aggregate): If a component has no default_expression and you use box, it behaves as if you had declared a stand-alone object. (Resolve_Record_Aggregate): If a component has no default_expression and you use box, it behaves as if you had declared a stand-alone object. * sem_ch10.adb (Install_Siblings): Do not make visible the private entities of private-with siblings. 2004-07-26 Ed Schonberg * sem_ch3.adb (Build_Underlying_Full_View): If this is the full view for a component of an itype, set the parent pointer for analysis, there is no list in which to insert it. * sem_res.adb (Resolve): Call Rewrite_Renamed_Operator only for bona-fide renamings, not for inherited operations. * exp_ch4.adb (Expand_Allocator_Expression): If the allocator is an actual for a formal that is an access parameter, create local finalization list even if the expression is not an aggregate. 2004-07-26 Ed Schonberg PR ada/16213 * sem_ch8.adb (Attribute_Renaming, Check_Library_Level_Renaming): Diagnose properly illegal subprogram renamings that are library units. 2004-07-26 Ed Schonberg PR ada/15588 * sem_util.adb (Is_OK_Variable_For_Out_Formal): If actual is a type conversion rewritten as an unchecked conversion, check that original expression is a variable. * exp_ch4.adb (Expand_N_Type_Conversion): If rewriting as an unchecked_conversion, create new node rather than rewriting in place, to preserve original construct. 2004-07-26 Richard Kenner * gigi.h (gnat_expand_body): Deleted. * Make-lang.in: (trans.o): Depends on function.h. * misc.c: (gnat_expand_body): Moved to here. * trans.c (gnat_expand_body_1): Deleted. (gnat_expand_body): Moved from here. (gnat_to_gnu): N_Implicit_Label_Declaration forces being in elab proc. (add_stmt): Check for marked visited with global_bindings_p. (gnat_gimplify_expr, case COMPONENT_REF): New case. (gnat_gimplify_expr, case NULL_EXPR): Set TREE_NO_WARNING for temp. * utils2.c (build_binary_op, case MODIFY_EXPR): Put LHS in a VIEW_CONVERT_EXPR if not operation type. * utils.c (update_pointer_to): Set DECL_ORIGINAL_FIELD for fat pointer. * decl.c, cuintp.c, gigi.h, misc.c, trans.c, utils.c, utils2.c: Minor changes: reformatting of negation operators, removing unneeded inequality comparison with zero, converting equality comparisons with zero to negations, changing int/0/1 to bool/false/true, replace calls to gigi_abort with abort, and various other similar changes. 2004-07-26 Vincent Celier * gnatcmd.adb (GNATCmd): Add processing for new built-in command "setup". * make.adb (Gnatmake): Fail when a library is not present and there is no object directory. * mlib-prj.adb (Check_Library): No need to check if the library needs to be rebuilt if there is no object directory, hence no object files to build the library. * opt.ads (Setup_Projects): New Boolean flag. * prj-nmsc.adb (Locate_Directory): New parameter Project, Kind and Location. Create directory when Kind /= "" and in "gnat setup". Report error if directory cannot be created. (Ada_Check): Create library interface copy dir if it does not exist and we are in "gnat setup". (Find_Sources): No error if in "gnat setup" and no Ada sources were found. (Language_Independent_Check): Create object directory, exec directory and/or library directory if they do not exist and we are in "gnat setup". * vms_conv.ads: (Command_Type): New command Setup. * vms_conv.adb (Initialize): Add Setup component of Cammand_List. * vms_data.ads: Add qualifiers/switches for new built-in command "setup". From-SVN: r85188 --- gcc/ada/ChangeLog | 118 ++++ gcc/ada/Make-lang.in | 8 +- gcc/ada/a-except.adb | 10 +- gcc/ada/cuintp.c | 2 +- gcc/ada/decl.c | 1355 ++++++++++++++++++------------------- gcc/ada/exp_aggr.adb | 8 +- gcc/ada/exp_ch4.adb | 25 +- gcc/ada/gigi.h | 96 +-- gcc/ada/gnatcmd.adb | 142 ++++ gcc/ada/make.adb | 35 +- gcc/ada/misc.c | 79 ++- gcc/ada/mlib-prj.adb | 8 +- gcc/ada/opt.ads | 5 + gcc/ada/prj-nmsc.adb | 188 +++-- gcc/ada/s-mastop-irix.adb | 4 +- gcc/ada/sem_aggr.adb | 35 +- gcc/ada/sem_ch10.adb | 7 - gcc/ada/sem_ch3.adb | 12 +- gcc/ada/sem_ch8.adb | 13 + gcc/ada/sem_res.adb | 6 +- gcc/ada/sem_util.adb | 10 +- gcc/ada/trans.c | 618 ++++++++--------- gcc/ada/utils.c | 386 ++++++----- gcc/ada/utils2.c | 293 ++++---- gcc/ada/vms_conv.adb | 10 + gcc/ada/vms_conv.ads | 3 +- gcc/ada/vms_data.ads | 63 ++ 27 files changed, 1959 insertions(+), 1580 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 651ff90c188..88eb443d089 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,121 @@ +2004-07-26 Arnaud Charlet + + * sem_util.adb (Requires_Transient_Scope): Temporarily disable + optimization, not supported by the tree-ssa back-end. + +2004-07-26 Olivier Hainque + + * s-mastop-irix.adb: Update comments. + + * a-except.adb (Exception_Information): Raise Constraint_Error if + exception Id is Null_Id. + This is required behavior, which is more reliably and clearly checked + at the top level interface level. + +2004-07-26 Javier Miranda + + * exp_aggr.adb (Build_Array_Aggr_Code): Do not build the initialization + call if a component has no default_expression and the box is used. + + * sem_aggr.adb (Resolve_Array_Aggregate): If a component has no + default_expression and you use box, it behaves as if you had declared a + stand-alone object. + (Resolve_Record_Aggregate): If a component has no default_expression and + you use box, it behaves as if you had declared a stand-alone object. + + * sem_ch10.adb (Install_Siblings): Do not make visible the private + entities of private-with siblings. + +2004-07-26 Ed Schonberg + + * sem_ch3.adb (Build_Underlying_Full_View): If this is the full view + for a component of an itype, set the parent pointer for analysis, + there is no list in which to insert it. + + * sem_res.adb (Resolve): Call Rewrite_Renamed_Operator only for + bona-fide renamings, not for inherited operations. + + * exp_ch4.adb (Expand_Allocator_Expression): If the allocator is an + actual for a formal that is an access parameter, create local + finalization list even if the expression is not an aggregate. + +2004-07-26 Ed Schonberg + + PR ada/16213 + * sem_ch8.adb (Attribute_Renaming, Check_Library_Level_Renaming): + Diagnose properly illegal subprogram renamings that are library units. + +2004-07-26 Ed Schonberg + + PR ada/15588 + * sem_util.adb (Is_OK_Variable_For_Out_Formal): If actual is a type + conversion rewritten as an unchecked conversion, check that original + expression is a variable. + + * exp_ch4.adb (Expand_N_Type_Conversion): If rewriting as an + unchecked_conversion, create new node rather than rewriting in place, + to preserve original construct. + +2004-07-26 Richard Kenner + + * gigi.h (gnat_expand_body): Deleted. + + * Make-lang.in: (trans.o): Depends on function.h. + + * misc.c: (gnat_expand_body): Moved to here. + + * trans.c (gnat_expand_body_1): Deleted. + (gnat_expand_body): Moved from here. + (gnat_to_gnu): N_Implicit_Label_Declaration forces being in elab proc. + (add_stmt): Check for marked visited with global_bindings_p. + (gnat_gimplify_expr, case COMPONENT_REF): New case. + (gnat_gimplify_expr, case NULL_EXPR): Set TREE_NO_WARNING for temp. + + * utils2.c (build_binary_op, case MODIFY_EXPR): Put LHS in a + VIEW_CONVERT_EXPR if not operation type. + + * utils.c (update_pointer_to): Set DECL_ORIGINAL_FIELD for + fat pointer. + + * decl.c, cuintp.c, gigi.h, misc.c, trans.c, utils.c, utils2.c: Minor + changes: reformatting of negation operators, removing unneeded + inequality comparison with zero, converting equality comparisons with + zero to negations, changing int/0/1 to bool/false/true, replace calls + to gigi_abort with abort, and various other similar changes. + +2004-07-26 Vincent Celier + + * gnatcmd.adb (GNATCmd): Add processing for new built-in command + "setup". + + * make.adb (Gnatmake): Fail when a library is not present and there is + no object directory. + + * mlib-prj.adb (Check_Library): No need to check if the library needs + to be rebuilt if there is no object directory, hence no object files + to build the library. + + * opt.ads (Setup_Projects): New Boolean flag. + + * prj-nmsc.adb (Locate_Directory): New parameter Project, Kind and + Location. + Create directory when Kind /= "" and in "gnat setup". Report error if + directory cannot be created. + (Ada_Check): Create library interface copy dir if it does not exist + and we are in "gnat setup". + (Find_Sources): No error if in "gnat setup" and no Ada sources were + found. + (Language_Independent_Check): Create object directory, exec directory + and/or library directory if they do not exist and we are in + "gnat setup". + + * vms_conv.ads: (Command_Type): New command Setup. + + * vms_conv.adb (Initialize): Add Setup component of Cammand_List. + + * vms_data.ads: Add qualifiers/switches for new built-in command + "setup". + 2004-07-25 Richard Henderson * utils.c (create_subprog_decl): Set DECL_ARTIFICIAL and diff --git a/gcc/ada/Make-lang.in b/gcc/ada/Make-lang.in index 60ee84b257d..2d303313302 100644 --- a/gcc/ada/Make-lang.in +++ b/gcc/ada/Make-lang.in @@ -1089,10 +1089,10 @@ ada/targtyps.o : ada/targtyps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ada/urealp.h ada/fe.h $(ADA_TREE_H) ada/gigi.h ada/trans.o : ada/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ - $(TREE_H) $(RTL_H) flags.h ada/ada.h except.h ada/types.h ada/atree.h \ - ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h ada/einfo.h ada/namet.h \ - ada/snames.h ada/stringt.h ada/urealp.h ada/fe.h $(ADA_TREE_H) ada/gigi.h \ - gt-ada-trans.h + $(TREE_H) $(RTL_H) flags.h function.h ada/ada.h except.h ada/types.h \ + ada/atree.h ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h ada/einfo.h \ + ada/namet.h ada/snames.h ada/stringt.h ada/urealp.h ada/fe.h $(ADA_TREE_H) \ + ada/gigi.h gt-ada-trans.h ada/utils.o : ada/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) flags.h expr.h convert.h defaults.h ada/ada.h ada/types.h \ diff --git a/gcc/ada/a-except.adb b/gcc/ada/a-except.adb index 2da9de23fb1..3f574085a48 100644 --- a/gcc/ada/a-except.adb +++ b/gcc/ada/a-except.adb @@ -640,8 +640,14 @@ package body Ada.Exceptions is -- Exception_Information -- --------------------------- - function Exception_Information (X : Exception_Occurrence) return String - renames Exception_Data.Exception_Information; + function Exception_Information (X : Exception_Occurrence) return String is + begin + if X.Id = Null_Id then + raise Constraint_Error; + end if; + + return Exception_Data.Exception_Information (X); + end Exception_Information; ----------------------- -- Exception_Message -- diff --git a/gcc/ada/cuintp.c b/gcc/ada/cuintp.c index f83f5184ee6..3b8495c7e77 100644 --- a/gcc/ada/cuintp.c +++ b/gcc/ada/cuintp.c @@ -77,7 +77,7 @@ UI_To_gnu (Uint Input, tree type) tree gnu_base = convert (comp_type, build_int_2 (Base, 0)); if (Length <= 0) - gigi_abort (601); + abort (); gnu_ret = convert (comp_type, build_int_2 (First, First < 0 ? -1 : 0)); if (First < 0) diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index e719072a4fd..480ebad8ca7 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -81,28 +81,28 @@ static struct incomplete } *defer_incomplete_list = 0; static void copy_alias_set (tree, tree); -static tree substitution_list (Entity_Id, Entity_Id, tree, int); -static int allocatable_size_p (tree, int); +static tree substitution_list (Entity_Id, Entity_Id, tree, bool); +static bool allocatable_size_p (tree, bool); static struct attrib *build_attr_list (Entity_Id); static tree elaborate_expression (Node_Id, Entity_Id, tree, bool, bool, bool); -static int is_variable_size (tree); +static bool is_variable_size (tree); static tree elaborate_expression_1 (Node_Id, Entity_Id, tree, tree, bool, bool); static tree make_packable_type (tree); static tree maybe_pad_type (tree, tree, unsigned int, Entity_Id, const char *, - int, int, int); -static tree gnat_to_gnu_field (Entity_Id, tree, int, int); -static void components_to_record (tree, Node_Id, tree, int, int, tree *, - int, int); + bool, bool, bool); +static tree gnat_to_gnu_field (Entity_Id, tree, int, bool); +static void components_to_record (tree, Node_Id, tree, int, bool, tree *, + bool, bool); static int compare_field_bitpos (const PTR, const PTR); static Uint annotate_value (tree); static void annotate_rep (Entity_Id, tree); static tree compute_field_positions (tree, tree, tree, tree, unsigned int); -static tree validate_size (Uint, tree, Entity_Id, enum tree_code, int, int); +static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool); static void set_rm_size (Uint, tree, Entity_Id); -static tree make_type_from_size (tree, tree, int); +static tree make_type_from_size (tree, tree, bool); static unsigned int validate_alignment (Uint, Entity_Id, unsigned int); -static void check_ok_for_atomic (tree, Entity_Id, int); +static void check_ok_for_atomic (tree, Entity_Id, bool); /* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a GCC type corresponding to that entity. GNAT_ENTITY is assumed to @@ -120,7 +120,7 @@ gnat_to_gnu_type (Entity_Id gnat_entity) /* Convert the ada entity type into a GCC TYPE_DECL node. */ gnu_decl = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); if (TREE_CODE (gnu_decl) != TYPE_DECL) - gigi_abort (101); + abort (); return TREE_TYPE (gnu_decl); } @@ -145,24 +145,24 @@ tree gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { tree gnu_entity_id; - tree gnu_type = 0; + tree gnu_type = NULL_TREE; /* Contains the gnu XXXX_DECL tree node which is equivalent to the input GNAT tree. This node will be associated with the GNAT node by calling the save_gnu_tree routine at the end of the `switch' statement. */ - tree gnu_decl = 0; - /* Nonzero if we have already saved gnu_decl as a gnat association. */ - int saved = 0; + tree gnu_decl = NULL_TREE; + /* true if we have already saved gnu_decl as a gnat association. */ + bool saved = false; /* Nonzero if we incremented defer_incomplete_level. */ - int this_deferred = 0; + bool this_deferred = false; /* Nonzero if we incremented force_global. */ - int this_global = 0; + bool this_global = false; /* Nonzero if we should check to see if elaborated during processing. */ - int maybe_present = 0; + bool maybe_present = false; /* Nonzero if we made GNU_DECL and its type here. */ - int this_made_decl = 0; - struct attrib *attr_list = 0; - int debug_info_p = (Needs_Debug_Info (gnat_entity) - || debug_info_level == DINFO_LEVEL_VERBOSE); + bool this_made_decl = false; + struct attrib *attr_list = NULL; + bool debug_info_p = (Needs_Debug_Info (gnat_entity) + || debug_info_level == DINFO_LEVEL_VERBOSE); Entity_Kind kind = Ekind (gnat_entity); Entity_Id gnat_temp; unsigned int esize @@ -175,7 +175,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) : LONG_LONG_TYPE_SIZE) : LONG_LONG_TYPE_SIZE); tree gnu_size = 0; - int imported_p + bool imported_p = ((Is_Imported (gnat_entity) && No (Address_Clause (gnat_entity))) || From_With_Type (gnat_entity)); unsigned int align = 0; @@ -183,15 +183,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Since a use of an Itype is a definition, process it as such if it is not in a with'ed unit. */ - if (! definition && Is_Itype (gnat_entity) - && ! present_gnu_tree (gnat_entity) + if (!definition && Is_Itype (gnat_entity) + && !present_gnu_tree (gnat_entity) && In_Extended_Main_Code_Unit (gnat_entity)) { /* Ensure that we are in a subprogram mentioned in the Scope chain of this entity, our current scope is global, or that we encountered a task or entry (where we can't currently accurately check scoping). */ - if (current_function_decl == 0 + if (!current_function_decl || DECL_ELABORATION_PROC_P (current_function_decl)) { process_type (gnat_entity); @@ -225,15 +225,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } } - /* gigi abort 122 means that the entity "gnat_entity" has an incorrect - scope, i.e. that its scope does not correspond to the subprogram - in which it is declared */ - gigi_abort (122); + /* This abort means the entity "gnat_entity" has an incorrect scope, + i.e. that its scope does not correspond to the subprogram in which + it is declared */ + abort (); } /* If this is entity 0, something went badly wrong. */ - if (gnat_entity == 0) - gigi_abort (102); + if (No (gnat_entity)) + abort (); /* If we've already processed this entity, return what we got last time. If we are defining the node, we should not have already processed it. @@ -255,8 +255,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_decl = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, 0); - save_gnu_tree (gnat_entity, NULL_TREE, 0); - save_gnu_tree (gnat_entity, gnu_decl, 0); + save_gnu_tree (gnat_entity, NULL_TREE, false); + save_gnu_tree (gnat_entity, gnu_decl, false); } return gnu_decl; @@ -269,14 +269,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && kind != E_Access_Protected_Subprogram_Type && kind != E_Access_Subtype)) && Unknown_Esize (gnat_entity) - && ! Has_Size_Clause (gnat_entity)) - gigi_abort (109); + && !Has_Size_Clause (gnat_entity)) + abort (); /* Likewise, RM_Size must be specified for all discrete and fixed-point types. */ if (IN (kind, Discrete_Or_Fixed_Point_Kind) && Unknown_RM_Size (gnat_entity)) - gigi_abort (123); + abort (); /* Get the name of the entity and set up the line number and filename of the original definition for use in any decl we make. */ @@ -286,16 +286,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If we get here, it means we have not yet done anything with this entity. If we are not defining it here, it must be external, otherwise we should have defined it already. */ - if (! definition && ! Is_Public (gnat_entity) - && ! type_annotate_only + if (!definition && ! Is_Public (gnat_entity) + && !type_annotate_only && kind != E_Discriminant && kind != E_Component && kind != E_Label - && ! (kind == E_Constant && Present (Full_View (gnat_entity))) + && !(kind == E_Constant && Present (Full_View (gnat_entity))) #if 1 && !IN (kind, Type_Kind) #endif ) - gigi_abort (116); + abort (); /* For cases when we are not defining (i.e., we are referencing from another compilation unit) Public entities, show we are at global level @@ -303,12 +303,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) discriminants since the relevant test is whether or not the record is being defined. But do this for Imported functions or procedures in all cases. */ - if ((! definition && Is_Public (gnat_entity) - && ! Is_Statically_Allocated (gnat_entity) + if ((!definition && Is_Public (gnat_entity) + && !Is_Statically_Allocated (gnat_entity) && kind != E_Discriminant && kind != E_Component) || (Is_Imported (gnat_entity) && (kind == E_Function || kind == E_Procedure))) - force_global++, this_global = 1; + force_global++, this_global = true; /* Handle any attributes. */ if (Has_Gigi_Rep_Item (gnat_entity)) @@ -319,11 +319,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) case E_Constant: /* If this is a use of a deferred constant, get its full declaration. */ - if (! definition && Present (Full_View (gnat_entity))) + if (!definition && Present (Full_View (gnat_entity))) { gnu_decl = gnat_to_gnu_entity (Full_View (gnat_entity), gnu_expr, definition); - saved = 1; + saved = true; break; } @@ -334,11 +334,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) Do not retrieve the expression if it is an aggregate, because in complex instantiation contexts it may not be expanded */ - if (! definition + if (!definition && Present (Expression (Declaration_Node (gnat_entity))) - && ! No_Initialization (Declaration_Node (gnat_entity)) - && Nkind (Expression (Declaration_Node (gnat_entity))) - != N_Aggregate) + && !No_Initialization (Declaration_Node (gnat_entity)) + && (Nkind (Expression (Declaration_Node (gnat_entity))) + != N_Aggregate)) gnu_expr = gnat_to_gnu (Expression (Declaration_Node (gnat_entity))); /* Ignore deferred constant definitions; they are processed fully in the @@ -348,20 +348,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) not a deferred constant but a constant whose value is built manually. */ - if (definition && gnu_expr == 0 - && ! No_Initialization (Declaration_Node (gnat_entity)) + if (definition && !gnu_expr + && !No_Initialization (Declaration_Node (gnat_entity)) && No (Renamed_Object (gnat_entity))) { gnu_decl = error_mark_node; - saved = 1; + saved = true; break; } - else if (! definition && IN (kind, Incomplete_Or_Private_Kind) + else if (!definition && IN (kind, Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity))) { gnu_decl = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, 0); - saved = 1; + saved = true; break; } @@ -403,7 +403,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_decl = gnat_to_gnu_entity (Original_Record_Component (gnat_entity), gnu_expr, definition); - saved = 1; + saved = true; break; } @@ -421,12 +421,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (First_Discriminant (gnat_record) != First_Stored_Discriminant (gnat_record)) - gigi_abort (119); + abort (); gnu_decl = gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity), gnu_expr, definition); - saved = 1; + saved = true; break; } @@ -440,12 +440,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else if (Present (Corresponding_Discriminant (gnat_entity)) && (First_Discriminant (gnat_record) != First_Stored_Discriminant (gnat_record))) - gigi_abort (120); + abort (); /* Otherwise, if we are not defining this and we have no GCC type for the containing record, make one for it. Then we should have made our own equivalent. */ - else if (! definition && ! present_gnu_tree (gnat_record)) + else if (!definition && !present_gnu_tree (gnat_record)) { /* ??? If this is in a record whose scope is a protected type and we have an Original_Record_Component, use it. @@ -463,21 +463,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = gnat_to_gnu_entity (Original_Record_Component (gnat_entity), gnu_expr, definition); - saved = 1; + saved = true; break; } gnat_to_gnu_entity (Scope (gnat_entity), NULL_TREE, 0); gnu_decl = get_gnu_tree (gnat_entity); - saved = 1; + saved = true; break; } - /* Here we have no GCC type and this is a reference rather than a - definition. This should never happen. Most likely the cause is a - reference before declaration in the gnat tree for gnat_entity. */ else - gigi_abort (103); + /* Here we have no GCC type and this is a reference rather than a + definition. This should never happen. Most likely the cause is a + reference before declaration in the gnat tree for gnat_entity. */ + abort (); } case E_Loop_Parameter: @@ -487,20 +487,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Simple variables, loop variables, OUT parameters, and exceptions. */ object: { - int used_by_ref = 0; - int const_flag + bool used_by_ref = false; + bool const_flag = ((kind == E_Constant || kind == E_Variable) - && ! Is_Statically_Allocated (gnat_entity) + && !Is_Statically_Allocated (gnat_entity) && Is_True_Constant (gnat_entity) && (((Nkind (Declaration_Node (gnat_entity)) == N_Object_Declaration) && Present (Expression (Declaration_Node (gnat_entity)))) || Present (Renamed_Object (gnat_entity)))); - int inner_const_flag = const_flag; - int static_p = Is_Statically_Allocated (gnat_entity); + bool inner_const_flag = const_flag; + bool static_p = Is_Statically_Allocated (gnat_entity); tree gnu_ext_name = NULL_TREE; - if (Present (Renamed_Object (gnat_entity)) && ! definition) + if (Present (Renamed_Object (gnat_entity)) && !definition) { if (kind == E_Exception) gnu_expr = gnat_to_gnu_entity (Renamed_Entity (gnat_entity), @@ -532,7 +532,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (type_annotate_only) return error_mark_node; else - gigi_abort (104); + abort (); } /* If we are defining the object, see if it has a Size value and @@ -542,19 +542,19 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) get the new type, if any. */ if (definition) gnu_size = validate_size (Esize (gnat_entity), gnu_type, - gnat_entity, VAR_DECL, 0, + gnat_entity, VAR_DECL, false, Has_Size_Clause (gnat_entity)); else if (Has_Size_Clause (gnat_entity)) gnu_size = UI_To_gnu (Esize (gnat_entity), bitsizetype); - if (gnu_size != 0) + if (gnu_size) { gnu_type = make_type_from_size (gnu_type, gnu_size, Has_Biased_Representation (gnat_entity)); if (operand_equal_p (TYPE_SIZE (gnu_type), gnu_size, 0)) - gnu_size = 0; + gnu_size = NULL_TREE; } /* If this object has self-referential size, it must be a record with @@ -567,7 +567,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (No (Renamed_Object (gnat_entity)) && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) { - if (gnu_expr != 0 && kind == E_Constant) + if (gnu_expr && kind == E_Constant) gnu_size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_SIZE (TREE_TYPE (gnu_expr)), gnu_expr); @@ -583,7 +583,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) (Etype (Expression (Declaration_Node (gnat_entity))))); else - gnu_size = max_size (TYPE_SIZE (gnu_type), 1); + gnu_size = max_size (TYPE_SIZE (gnu_type), true); } /* If the size is zero bytes, make it one byte since some linkers have @@ -593,13 +593,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) clause, as we would lose useful information on the view size (e.g. for null array slices) and we are not allocating the object here anyway. */ - if (((gnu_size != 0 && integer_zerop (gnu_size)) - || (TYPE_SIZE (gnu_type) != 0 - && integer_zerop (TYPE_SIZE (gnu_type)))) - && (! Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) - || ! Is_Array_Type (Etype (gnat_entity))) - && ! Present (Renamed_Object (gnat_entity)) - && ! Present (Address_Clause (gnat_entity))) + if (((gnu_size && integer_zerop (gnu_size)) + || (TYPE_SIZE (gnu_type) && integer_zerop (TYPE_SIZE (gnu_type)))) + && (!Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) + || !Is_Array_Type (Etype (gnat_entity))) + && !Present (Renamed_Object (gnat_entity)) + && !Present (Address_Clause (gnat_entity))) gnu_size = bitsize_unit_node; /* If an alignment is specified, use it if valid. Note that @@ -607,11 +606,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (kind != E_Exception && Known_Alignment (gnat_entity)) { if (No (Alignment (gnat_entity))) - gigi_abort (125); + abort (); - align - = validate_alignment (Alignment (gnat_entity), gnat_entity, - TYPE_ALIGN (gnu_type)); + align = validate_alignment (Alignment (gnat_entity), gnat_entity, + TYPE_ALIGN (gnu_type)); } /* If this is an atomic object with no specified size and alignment, @@ -619,10 +617,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) the lowest power of two greater than the size, or to the biggest meaningful alignment, whichever is smaller. */ - if (Is_Atomic (gnat_entity) && gnu_size == 0 && align == 0 + if (Is_Atomic (gnat_entity) && !gnu_size && align == 0 && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST) { - if (! host_integerp (TYPE_SIZE (gnu_type), 1) + if (!host_integerp (TYPE_SIZE (gnu_type), 1) || 0 <= compare_tree_int (TYPE_SIZE (gnu_type), BIGGEST_ALIGNMENT)) align = BIGGEST_ALIGNMENT; @@ -641,15 +639,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (Has_Atomic_Components (gnat_entity)) { - tree gnu_inner - = (TREE_CODE (gnu_type) == ARRAY_TYPE - ? TREE_TYPE (gnu_type) : gnu_type); + tree gnu_inner = (TREE_CODE (gnu_type) == ARRAY_TYPE + ? TREE_TYPE (gnu_type) : gnu_type); while (TREE_CODE (gnu_inner) == ARRAY_TYPE && TYPE_MULTI_ARRAY_P (gnu_inner)) gnu_inner = TREE_TYPE (gnu_inner); - check_ok_for_atomic (gnu_inner, gnat_entity, 1); + check_ok_for_atomic (gnu_inner, gnat_entity, true); } /* Now check if the type of the object allows atomic access. Note @@ -659,13 +656,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) this by always copying via an intermediate value, but it's not clear it's worth the effort. */ if (Is_Atomic (gnat_entity)) - check_ok_for_atomic (gnu_type, gnat_entity, 0); + check_ok_for_atomic (gnu_type, gnat_entity, false); /* If this is an aliased object with an unconstrained nominal subtype, make a type that includes the template. */ if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) && Is_Array_Type (Etype (gnat_entity)) - && ! type_annotate_only) + && !type_annotate_only) { tree gnu_fat = TREE_TYPE (gnat_to_gnu_type (Base_Type (Etype (gnat_entity)))); @@ -688,18 +685,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) do not do it for Out parameters since that creates an size inconsistency with In parameters. */ if (align == 0 && MINIMUM_ATOMIC_ALIGNMENT > TYPE_ALIGN (gnu_type) - && ! FLOAT_TYPE_P (gnu_type) - && ! const_flag && No (Renamed_Object (gnat_entity)) - && ! imported_p && No (Address_Clause (gnat_entity)) + && !FLOAT_TYPE_P (gnu_type) + && !const_flag && No (Renamed_Object (gnat_entity)) + && !imported_p && No (Address_Clause (gnat_entity)) && kind != E_Out_Parameter - && (gnu_size != 0 ? TREE_CODE (gnu_size) == INTEGER_CST + && (gnu_size ? TREE_CODE (gnu_size) == INTEGER_CST : TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST)) align = MINIMUM_ATOMIC_ALIGNMENT; #endif /* Make a new type with the desired size and alignment, if needed. */ - gnu_type = maybe_pad_type (gnu_type, gnu_size, align, - gnat_entity, "PAD", 0, definition, 1); + gnu_type = maybe_pad_type (gnu_type, gnu_size, align, gnat_entity, + "PAD", false, definition, true); /* Make a volatile version of this object's type if we are to make the object volatile. Note that 13.3(19) says that we @@ -708,7 +705,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || Is_Exported (gnat_entity) || Is_Imported (gnat_entity) || Present (Address_Clause (gnat_entity))) - && ! TYPE_VOLATILE (gnu_type)) + && !TYPE_VOLATILE (gnu_type)) gnu_type = build_qualified_type (gnu_type, (TYPE_QUALS (gnu_type) | TYPE_QUAL_VOLATILE)); @@ -719,13 +716,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) the former case, converting will generate unnecessary evaluations of the CONSTRUCTOR to compute the size and in the latter case, we want to only copy the actual data. */ - if (gnu_expr != 0 + if (gnu_expr && TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE - && ! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)) - && ! (TREE_CODE (gnu_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (gnu_type) - && (CONTAINS_PLACEHOLDER_P - (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type))))))) + && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)) + && !(TREE_CODE (gnu_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (gnu_type) + && (CONTAINS_PLACEHOLDER_P + (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type))))))) gnu_expr = convert (gnu_type, gnu_expr); /* See if this is a renaming. If this is a constant renaming, treat @@ -767,16 +764,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) the latter has to be materialized. */ else if ((DECL_P (gnu_expr) || TREE_CODE_CLASS (TREE_CODE (gnu_expr)) == 'r') - && ! Materialize_Entity (gnat_entity) - && (! global_bindings_p () + && !Materialize_Entity (gnat_entity) + && (!global_bindings_p () || (staticp (gnu_expr) - && ! TREE_SIDE_EFFECTS (gnu_expr)))) + && !TREE_SIDE_EFFECTS (gnu_expr)))) { - gnu_decl = gnat_stabilize_reference (gnu_expr, 1); - save_gnu_tree (gnat_entity, gnu_decl, 1); - saved = 1; + gnu_decl = gnat_stabilize_reference (gnu_expr, true); + save_gnu_tree (gnat_entity, gnu_decl, true); + saved = true; break; } + /* Otherwise, make this into a constant pointer to the object we are to rename. @@ -794,18 +792,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else { inner_const_flag = TREE_READONLY (gnu_expr); - const_flag = 1; + const_flag = true; gnu_type = build_reference_type (gnu_type); gnu_expr = build_unary_op (ADDR_EXPR, gnu_type, gnu_expr); - if (! global_bindings_p ()) + if (!global_bindings_p ()) { - gnu_expr = gnat_stabilize_reference (gnu_expr, 1); + gnu_expr = gnat_stabilize_reference (gnu_expr, true); add_stmt (gnu_expr); } - gnu_size = 0; - used_by_ref = 1; + gnu_size = NULL_TREE; + used_by_ref = true; } } @@ -823,7 +821,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (TYPE_FIELDS (gnu_type))))) - && gnu_expr == 0) + && !gnu_expr) { tree template_field = TYPE_IS_PADDING_P (gnu_type) @@ -846,8 +844,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) imported. */ if (definition && (POINTER_TYPE_P (gnu_type) || TYPE_FAT_POINTER_P (gnu_type)) - && !Is_Imported (gnat_entity) - && gnu_expr == 0) + && !Is_Imported (gnat_entity) && !gnu_expr) gnu_expr = integer_zero_node; /* If we are defining the object and it has an Address clause we must @@ -862,21 +859,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = (present_gnu_tree (gnat_entity) ? get_gnu_tree (gnat_entity) : gnat_to_gnu (Expression (Address_Clause (gnat_entity)))); - save_gnu_tree (gnat_entity, NULL_TREE, 0); + save_gnu_tree (gnat_entity, NULL_TREE, false); /* Ignore the size. It's either meaningless or was handled above. */ - gnu_size = 0; + gnu_size = NULL_TREE; gnu_type = build_reference_type (gnu_type); gnu_address = convert (gnu_type, gnu_address); - used_by_ref = 1; - const_flag = ! Is_Public (gnat_entity); + used_by_ref = true; + const_flag = !Is_Public (gnat_entity); /* If we don't have an initializing expression for the underlying variable, the initializing expression for the pointer is the specified address. Otherwise, we have to make a COMPOUND_EXPR to assign both the address and the initial value. */ - if (gnu_expr == 0) + if (!gnu_expr) gnu_expr = gnu_address; else gnu_expr @@ -892,13 +889,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If it has an address clause and we are not defining it, mark it as an indirect object. Likewise for Stdcall objects that are imported. */ - if ((! definition && Present (Address_Clause (gnat_entity))) + if ((!definition && Present (Address_Clause (gnat_entity))) || (Is_Imported (gnat_entity) && Convention (gnat_entity) == Convention_Stdcall)) { gnu_type = build_reference_type (gnu_type); - gnu_size = 0; - used_by_ref = 1; + gnu_size = NULL_TREE; + used_by_ref = true; } /* If we are at top level and this object is of variable size, @@ -912,18 +909,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) Storage_Error gets raised. Note that we will never free such memory, so we presume it never will get allocated. */ - if (! allocatable_size_p (TYPE_SIZE_UNIT (gnu_type), - global_bindings_p () || ! definition - || static_p) - || (gnu_size != 0 + if (!allocatable_size_p (TYPE_SIZE_UNIT (gnu_type), + global_bindings_p () || !definition + || static_p) + || (gnu_size && ! allocatable_size_p (gnu_size, - global_bindings_p () || ! definition + global_bindings_p () || !definition || static_p))) { gnu_type = build_reference_type (gnu_type); - gnu_size = 0; - used_by_ref = 1; - const_flag = 1; + gnu_size = NULL_TREE; + used_by_ref = true; + const_flag = true; /* Get the data part of GNU_EXPR in case this was a aliased object whose nominal subtype is unconstrained. @@ -943,12 +940,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_expr = build_component_ref (gnu_expr, NULL_TREE, - TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (gnu_expr))), 0); + TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (gnu_expr))), + false); } if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST && TREE_CONSTANT_OVERFLOW (TYPE_SIZE_UNIT (gnu_alloc_type)) - && ! Is_Imported (gnat_entity)) + && !Is_Imported (gnat_entity)) post_error ("Storage_Error will be raised at run-time?", gnat_entity); @@ -957,8 +955,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } else { - gnu_expr = 0; - const_flag = 0; + gnu_expr = NULL_TREE; + const_flag = false; } } @@ -967,9 +965,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) to hold the "aligning type" with a modified initial value, if any, then point to it and make that the value of this variable, which is now indirect. */ - - if (! global_bindings_p () && ! static_p && definition - && ! imported_p && TYPE_ALIGN (gnu_type) > BIGGEST_ALIGNMENT) + if (!global_bindings_p () && !static_p && definition + && !imported_p && TYPE_ALIGN (gnu_type) > BIGGEST_ALIGNMENT) { tree gnu_new_type = make_aligning_type (gnu_type, TYPE_ALIGN (gnu_type), @@ -978,15 +975,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_new_var = create_var_decl (create_concat_name (gnat_entity, "ALIGN"), - NULL_TREE, gnu_new_type, gnu_expr, - 0, 0, 0, 0, 0, gnat_entity); + NULL_TREE, gnu_new_type, gnu_expr, false, + false, false, false, NULL, gnat_entity); - if (gnu_expr != 0) + if (gnu_expr) add_stmt_with_node (build_binary_op (MODIFY_EXPR, NULL_TREE, build_component_ref (gnu_new_var, NULL_TREE, - TYPE_FIELDS (gnu_new_type), 0), + TYPE_FIELDS (gnu_new_type), false), gnu_expr), gnat_entity); @@ -995,11 +992,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = build_unary_op (ADDR_EXPR, gnu_type, build_component_ref (gnu_new_var, NULL_TREE, - TYPE_FIELDS (gnu_new_type), 0)); + TYPE_FIELDS (gnu_new_type), false)); - gnu_size = 0; - used_by_ref = 1; - const_flag = 1; + gnu_size = NULL_TREE; + used_by_ref = true; + const_flag = true; } /* Convert the expression to the type of the object except in the @@ -1008,24 +1005,24 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) the former case, converting will generate unnecessary evaluations of the CONSTRUCTOR to compute the size and in the latter case, we want to only copy the actual data. */ - if (gnu_expr != 0 + if (gnu_expr && TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE - && ! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)) - && ! (TREE_CODE (gnu_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (gnu_type) - && (CONTAINS_PLACEHOLDER_P - (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type))))))) + && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)) + && !(TREE_CODE (gnu_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (gnu_type) + && (CONTAINS_PLACEHOLDER_P + (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type))))))) gnu_expr = convert (gnu_type, gnu_expr); /* If this name is external or there was a name specified, use it, unless this is a VMS exception object since this would conflict with the symbol we need to export in addition. Don't use the Interface_Name if there is an address clause (see CD30005). */ - if (! Is_VMS_Exception (gnat_entity) + if (!Is_VMS_Exception (gnat_entity) && ((Present (Interface_Name (gnat_entity)) && No (Address_Clause (gnat_entity))) || (Is_Public (gnat_entity) - && (! Is_Imported (gnat_entity) + && (!Is_Imported (gnat_entity) || Is_Exported (gnat_entity))))) gnu_ext_name = create_concat_name (gnat_entity, 0); @@ -1043,9 +1040,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (const_flag && gnu_expr && TREE_CONSTANT (gnu_expr) && host_integerp (TYPE_SIZE_UNIT (gnu_type), 1) && (AGGREGATE_TYPE_P (gnu_type) - && ! (TREE_CODE (gnu_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (gnu_type)))) - static_p = 1; + && !(TREE_CODE (gnu_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (gnu_type)))) + static_p = true; gnu_decl = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type, gnu_expr, const_flag, @@ -1063,10 +1060,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (Present (Address_Clause (gnat_entity)) && used_by_ref) DECL_POINTER_ALIAS_SET (gnu_decl) = 0; - if (definition && DECL_SIZE (gnu_decl) != 0 + if (definition && DECL_SIZE (gnu_decl) && get_block_jmpbuf_decl () && (TREE_CODE (DECL_SIZE (gnu_decl)) != INTEGER_CST - || (flag_stack_check && ! STACK_CHECK_BUILTIN + || (flag_stack_check && !STACK_CHECK_BUILTIN && 0 < compare_tree_int (DECL_SIZE_UNIT (gnu_decl), STACK_CHECK_MAX_VAR_SIZE)))) add_stmt_with_node (build_call_1_expr @@ -1088,8 +1085,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { tree gnu_corr_var = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type, - gnu_expr, 0, Is_Public (gnat_entity), 0, - static_p, 0, gnat_entity); + gnu_expr, false, Is_Public (gnat_entity), + false, static_p, NULL, gnat_entity); SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var); } @@ -1106,12 +1103,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) But if the "object" is actually a pointer to an object, the alignment and size are the same as teh type, so don't back-annotate the values for the pointer. */ - if (! used_by_ref && Unknown_Alignment (gnat_entity)) + if (!used_by_ref && Unknown_Alignment (gnat_entity)) Set_Alignment (gnat_entity, UI_From_Int (DECL_ALIGN (gnu_decl) / BITS_PER_UNIT)); - if (! used_by_ref && Unknown_Esize (gnat_entity) - && DECL_SIZE (gnu_decl) != 0) + if (!used_by_ref && Unknown_Esize (gnat_entity) + && DECL_SIZE (gnu_decl)) { tree gnu_back_size = DECL_SIZE (gnu_decl); @@ -1170,11 +1167,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tree gnu_value = UI_To_gnu (Enumeration_Rep (gnat_literal), gnu_type); tree gnu_literal - = create_var_decl (get_entity_name (gnat_literal), - 0, gnu_type, gnu_value, 1, 0, 0, 0, 0, - gnat_literal); + = create_var_decl (get_entity_name (gnat_literal), NULL_TREE, + gnu_type, gnu_value, true, false, false, + false, NULL, gnat_literal); - save_gnu_tree (gnat_literal, gnu_literal, 0); + save_gnu_tree (gnat_literal, gnu_literal, false); gnu_literal_list = tree_cons (DECL_NAME (gnu_literal), gnu_value, gnu_literal_list); } @@ -1224,7 +1221,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) a modulus of zero, which is otherwise invalid. */ gnu_modulus = UI_To_gnu (Modulus (gnat_entity), gnu_type); - if (! integer_zerop (gnu_modulus)) + if (!integer_zerop (gnu_modulus)) { TYPE_MODULAR_P (gnu_type) = 1; SET_TYPE_MODULUS (gnu_type, gnu_modulus); @@ -1237,7 +1234,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) it is not one greater than TYPE_MAX_VALUE. */ if (TYPE_PRECISION (gnu_type) != esize || (TYPE_MODULAR_P (gnu_type) - && ! tree_int_cst_equal (TYPE_MAX_VALUE (gnu_type), gnu_high))) + && !tree_int_cst_equal (TYPE_MAX_VALUE (gnu_type), gnu_high))) { tree gnu_subtype = make_node (INTEGER_TYPE); @@ -1282,9 +1279,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (definition == 0 && Present (Ancestor_Subtype (gnat_entity)) - && ! In_Extended_Main_Code_Unit (Ancestor_Subtype (gnat_entity)) - && (! Compile_Time_Known_Value (Type_Low_Bound (gnat_entity)) - || ! Compile_Time_Known_Value (Type_High_Bound (gnat_entity)))) + && !In_Extended_Main_Code_Unit (Ancestor_Subtype (gnat_entity)) + && (!Compile_Time_Known_Value (Type_Low_Bound (gnat_entity)) + || !Compile_Time_Known_Value (Type_High_Bound (gnat_entity)))) gnat_to_gnu_entity (Ancestor_Subtype (gnat_entity), gnu_expr, definition); @@ -1316,7 +1313,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) so don't blow up if so. */ if (present_gnu_tree (gnat_entity)) { - maybe_present = 1; + maybe_present = true; break; } @@ -1357,7 +1354,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_field = create_field_decl (get_identifier ("OBJECT"), gnu_field_type, gnu_type, 1, 0, 0, 0); - finish_record_type (gnu_type, gnu_field, 0, 0); + finish_record_type (gnu_type, gnu_field, false, false); TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_type) = 1; SET_TYPE_ADA_SIZE (gnu_type, bitsize_int (esize)); } @@ -1394,9 +1391,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { if (definition == 0 && Present (Ancestor_Subtype (gnat_entity)) - && ! In_Extended_Main_Code_Unit (Ancestor_Subtype (gnat_entity)) - && (! Compile_Time_Known_Value (Type_Low_Bound (gnat_entity)) - || ! Compile_Time_Known_Value (Type_High_Bound (gnat_entity)))) + && !In_Extended_Main_Code_Unit (Ancestor_Subtype (gnat_entity)) + && (!Compile_Time_Known_Value (Type_Low_Bound (gnat_entity)) + || !Compile_Time_Known_Value (Type_High_Bound (gnat_entity)))) gnat_to_gnu_entity (Ancestor_Subtype (gnat_entity), gnu_expr, definition); @@ -1422,7 +1419,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) so don't blow up if so. */ if (present_gnu_tree (gnat_entity)) { - maybe_present = 1; + maybe_present = true; break; } @@ -1476,15 +1473,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) suppress expanding incomplete types and save the node as the type for GNAT_ENTITY. */ gnu_type = make_node (UNCONSTRAINED_ARRAY_TYPE); - if (! definition) + if (!definition) { defer_incomplete_level++; - this_deferred = this_made_decl = 1; + this_deferred = this_made_decl = true; gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - save_gnu_tree (gnat_entity, gnu_decl, 0); - saved = 1; + save_gnu_tree (gnat_entity, gnu_decl, false); + saved = true; } /* Build the fat pointer type. Use a "void *" object instead of @@ -1500,7 +1497,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Make sure we can put this into a register. */ TYPE_ALIGN (gnu_fat_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE); - finish_record_type (gnu_fat_type, tem, 0, 1); + finish_record_type (gnu_fat_type, tem, false, true); /* Build a reference to the template from a PLACEHOLDER_EXPR that is the fat pointer. This will be used to access the individual @@ -1582,7 +1579,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = chainon (gnu_template_fields, gnu_temp_fields[index]); /* Install all the fields into the template. */ - finish_record_type (gnu_template_type, gnu_template_fields, 0, 0); + finish_record_type (gnu_template_type, gnu_template_fields, + false, false); TYPE_READONLY (gnu_template_type) = 1; /* Now make the array of arrays and update the pointer to the array @@ -1596,23 +1594,23 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = validate_size (Component_Size (gnat_entity), tem, gnat_entity, (Is_Bit_Packed_Array (gnat_entity) - ? TYPE_DECL : VAR_DECL), 1, - Has_Component_Size_Clause (gnat_entity)); + ? TYPE_DECL : VAR_DECL), + true, Has_Component_Size_Clause (gnat_entity)); if (Has_Atomic_Components (gnat_entity)) - check_ok_for_atomic (tem, gnat_entity, 1); + check_ok_for_atomic (tem, gnat_entity, true); /* If the component type is a RECORD_TYPE that has a self-referential size, use the maxium size. */ - if (gnu_comp_size == 0 && TREE_CODE (tem) == RECORD_TYPE + if (!gnu_comp_size && TREE_CODE (tem) == RECORD_TYPE && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (tem))) - gnu_comp_size = max_size (TYPE_SIZE (tem), 1); + gnu_comp_size = max_size (TYPE_SIZE (tem), true); - if (! Is_Bit_Packed_Array (gnat_entity) && gnu_comp_size != 0) + if (!Is_Bit_Packed_Array (gnat_entity) && gnu_comp_size) { - tem = make_type_from_size (tem, gnu_comp_size, 0); + tem = make_type_from_size (tem, gnu_comp_size, false); tem = maybe_pad_type (tem, gnu_comp_size, 0, gnat_entity, - "C_PAD", 0, definition, 1); + "C_PAD", false, definition, true); } if (Has_Volatile_Components (gnat_entity)) @@ -1648,8 +1646,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_NONALIASED_COMPONENT (tem) = ((TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE && TYPE_MULTI_ARRAY_P (TREE_TYPE (tem))) ? 1 - : (! Has_Aliased_Components (gnat_entity) - && ! AGGREGATE_TYPE_P (TREE_TYPE (tem)))); + : (!Has_Aliased_Components (gnat_entity) + && !AGGREGATE_TYPE_P (TREE_TYPE (tem)))); } /* If an alignment is specified, use it if valid. But ignore it for @@ -1658,7 +1656,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && Known_Alignment (gnat_entity)) { if (No (Alignment (gnat_entity))) - gigi_abort (124); + abort (); TYPE_ALIGN (tem) = validate_alignment (Alignment (gnat_entity), gnat_entity, @@ -1679,17 +1677,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If the maximum size doesn't overflow, use it. */ if (TREE_CODE (gnu_max_size) == INTEGER_CST - && ! TREE_OVERFLOW (gnu_max_size)) + && !TREE_OVERFLOW (gnu_max_size)) TYPE_SIZE (tem) = size_binop (MIN_EXPR, gnu_max_size, TYPE_SIZE (tem)); if (TREE_CODE (gnu_max_size_unit) == INTEGER_CST - && ! TREE_OVERFLOW (gnu_max_size_unit)) + && !TREE_OVERFLOW (gnu_max_size_unit)) TYPE_SIZE_UNIT (tem) = size_binop (MIN_EXPR, gnu_max_size_unit, TYPE_SIZE_UNIT (tem)); create_type_decl (create_concat_name (gnat_entity, "XUA"), - tem, 0, ! Comes_From_Source (gnat_entity), + tem, NULL, !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); /* Create a record type for the object and its template and @@ -1707,8 +1705,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Give the thin pointer type a name. */ create_type_decl (create_concat_name (gnat_entity, "XUX"), - build_pointer_type (tem), 0, - ! Comes_From_Source (gnat_entity), debug_info_p, + build_pointer_type (tem), NULL, + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); } break; @@ -1729,7 +1727,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) type. If so, the result is the array type. */ gnu_type = gnat_to_gnu_type (Etype (gnat_entity)); - if (! Is_Constrained (gnat_entity)) + if (!Is_Constrained (gnat_entity)) break; else { @@ -1744,11 +1742,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) Entity_Id gnat_ind_base_subtype; tree gnu_base_type = gnu_type; tree *gnu_index_type = (tree *) alloca (array_dim * sizeof (tree *)); - tree gnu_comp_size = 0; + tree gnu_comp_size = NULL_TREE; tree gnu_max_size = size_one_node; tree gnu_max_size_unit; - int need_index_type_struct = 0; - int max_overflow = 0; + bool need_index_type_struct = false; + bool max_overflow = false; /* First create the gnu types for each index. Create types for debugging information to point to the index types if the @@ -1792,7 +1790,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && TREE_CODE (gnu_min) == INTEGER_CST && TREE_CODE (gnu_max) == INTEGER_CST && TREE_OVERFLOW (gnu_min) && TREE_OVERFLOW (gnu_max) - && (! TREE_OVERFLOW + && (!TREE_OVERFLOW (fold (build (MINUS_EXPR, gnu_index_subtype, TYPE_MAX_VALUE (gnu_index_subtype), TYPE_MIN_VALUE (gnu_index_subtype)))))) @@ -1826,8 +1824,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) code below to malfunction if we don't handle it specially. */ if (TREE_CODE (gnu_base_min) == INTEGER_CST && TREE_CODE (gnu_base_max) == INTEGER_CST - && ! TREE_CONSTANT_OVERFLOW (gnu_base_min) - && ! TREE_CONSTANT_OVERFLOW (gnu_base_max) + && !TREE_CONSTANT_OVERFLOW (gnu_base_min) + && !TREE_CONSTANT_OVERFLOW (gnu_base_max) && tree_int_cst_lt (gnu_base_max, gnu_base_min)) gnu_high = size_zero_node, gnu_min = size_one_node; @@ -1857,15 +1855,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) handle each bound separately. */ if ((TREE_CODE (gnu_min) == INTEGER_CST - && ! TREE_OVERFLOW (gnu_min) - && ! operand_equal_p (gnu_min, gnu_base_base_min, 0)) - || ! CONTAINS_PLACEHOLDER_P (gnu_min)) + && !TREE_OVERFLOW (gnu_min) + && !operand_equal_p (gnu_min, gnu_base_base_min, 0)) + || !CONTAINS_PLACEHOLDER_P (gnu_min)) gnu_base_min = gnu_min; if ((TREE_CODE (gnu_max) == INTEGER_CST - && ! TREE_OVERFLOW (gnu_max) - && ! operand_equal_p (gnu_max, gnu_base_base_max, 0)) - || ! CONTAINS_PLACEHOLDER_P (gnu_max)) + && !TREE_OVERFLOW (gnu_max) + && !operand_equal_p (gnu_max, gnu_base_base_max, 0)) + || !CONTAINS_PLACEHOLDER_P (gnu_max)) gnu_base_max = gnu_max; if ((TREE_CODE (gnu_base_min) == INTEGER_CST @@ -1874,7 +1872,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || (TREE_CODE (gnu_base_max) == INTEGER_CST && TREE_CONSTANT_OVERFLOW (gnu_base_max)) || operand_equal_p (gnu_base_max, gnu_base_base_max, 0)) - max_overflow = 1; + max_overflow = true; gnu_base_min = size_binop (MAX_EXPR, gnu_base_min, gnu_min); gnu_base_max = size_binop (MIN_EXPR, gnu_base_max, gnu_max); @@ -1888,22 +1886,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (TREE_CODE (gnu_this_max) == INTEGER_CST && TREE_CONSTANT_OVERFLOW (gnu_this_max)) - max_overflow = 1; + max_overflow = true; gnu_max_size = size_binop (MULT_EXPR, gnu_max_size, gnu_this_max); - if (! integer_onep (TYPE_MIN_VALUE (gnu_index_subtype)) + if (!integer_onep (TYPE_MIN_VALUE (gnu_index_subtype)) || (TREE_CODE (TYPE_MAX_VALUE (gnu_index_subtype)) != INTEGER_CST) || TREE_CODE (gnu_index_subtype) != INTEGER_TYPE - || (TREE_TYPE (gnu_index_subtype) != 0 + || (TREE_TYPE (gnu_index_subtype) && (TREE_CODE (TREE_TYPE (gnu_index_subtype)) != INTEGER_TYPE)) || TYPE_BIASED_REPRESENTATION_P (gnu_index_subtype) || (TYPE_PRECISION (gnu_index_subtype) > TYPE_PRECISION (sizetype))) - need_index_type_struct = 1; + need_index_type_struct = true; } /* Then flatten: create the array of arrays. */ @@ -1914,7 +1912,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) so don't blow up if so. */ if (present_gnu_tree (gnat_entity)) { - maybe_present = 1; + maybe_present = true; break; } @@ -1925,20 +1923,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnat_entity, (Is_Bit_Packed_Array (gnat_entity) ? TYPE_DECL : VAR_DECL), - 1, Has_Component_Size_Clause (gnat_entity)); + true, Has_Component_Size_Clause (gnat_entity)); /* If the component type is a RECORD_TYPE that has a self-referential size, use the maxium size. */ - if (gnu_comp_size == 0 && TREE_CODE (gnu_type) == RECORD_TYPE + if (!gnu_comp_size && TREE_CODE (gnu_type) == RECORD_TYPE && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) - gnu_comp_size = max_size (TYPE_SIZE (gnu_type), 1); + gnu_comp_size = max_size (TYPE_SIZE (gnu_type), true); - if (! Is_Bit_Packed_Array (gnat_entity) && gnu_comp_size != 0) + if (!Is_Bit_Packed_Array (gnat_entity) && gnu_comp_size) { - gnu_type = make_type_from_size (gnu_type, gnu_comp_size, 0); + gnu_type = make_type_from_size (gnu_type, gnu_comp_size, false); gnu_type = maybe_pad_type (gnu_type, gnu_comp_size, 0, - gnat_entity, "C_PAD", 0, - definition, 1); + gnat_entity, "C_PAD", false, + definition, true); } if (Has_Volatile_Components (Base_Type (gnat_entity))) @@ -1966,8 +1964,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_NONALIASED_COMPONENT (gnu_type) = ((TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type))) ? 1 - : (! Has_Aliased_Components (gnat_entity) - && ! AGGREGATE_TYPE_P (TREE_TYPE (gnu_type)))); + : (!Has_Aliased_Components (gnat_entity) + && !AGGREGATE_TYPE_P (TREE_TYPE (gnu_type)))); } /* If we are at file level and this is a multi-dimensional array, we @@ -2013,7 +2011,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (need_index_type_struct && debug_info_p) { tree gnu_bound_rec_type = make_node (RECORD_TYPE); - tree gnu_field_list = 0; + tree gnu_field_list = NULL_TREE; tree gnu_field; TYPE_NAME (gnu_bound_rec_type) @@ -2035,7 +2033,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_field_list = gnu_field; } - finish_record_type (gnu_bound_rec_type, gnu_field_list, 0, 0); + finish_record_type (gnu_bound_rec_type, gnu_field_list, + false, false); } TYPE_CONVENTION_FORTRAN_P (gnu_type) @@ -2046,11 +2045,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If our size depends on a placeholder and the maximum size doesn't overflow, use it. */ if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)) - && ! (TREE_CODE (gnu_max_size) == INTEGER_CST - && TREE_OVERFLOW (gnu_max_size)) - && ! (TREE_CODE (gnu_max_size_unit) == INTEGER_CST - && TREE_OVERFLOW (gnu_max_size_unit)) - && ! max_overflow) + && !(TREE_CODE (gnu_max_size) == INTEGER_CST + && TREE_OVERFLOW (gnu_max_size)) + && !(TREE_CODE (gnu_max_size_unit) == INTEGER_CST + && TREE_OVERFLOW (gnu_max_size_unit)) + && !max_overflow) { TYPE_SIZE (gnu_type) = size_binop (MIN_EXPR, gnu_max_size, TYPE_SIZE (gnu_type)); @@ -2080,20 +2079,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) | (TYPE_QUAL_VOLATILE * Treat_As_Volatile (gnat_entity)))); gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - if (! Comes_From_Source (gnat_entity)) + if (!Comes_From_Source (gnat_entity)) DECL_ARTIFICIAL (gnu_decl) = 1; /* Save it as our equivalent in case the call below elaborates this type again. */ - save_gnu_tree (gnat_entity, gnu_decl, 0); + save_gnu_tree (gnat_entity, gnu_decl, false); gnu_decl = gnat_to_gnu_entity (Packed_Array_Type (gnat_entity), NULL_TREE, 0); - this_made_decl = 1; + this_made_decl = true; gnu_inner_type = gnu_type = TREE_TYPE (gnu_decl); - save_gnu_tree (gnat_entity, NULL_TREE, 0); + save_gnu_tree (gnat_entity, NULL_TREE, false); while (TREE_CODE (gnu_inner_type) == RECORD_TYPE && (TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_inner_type) @@ -2104,9 +2103,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) the actual bounds can be put into a template. */ if ((TREE_CODE (gnu_inner_type) == ARRAY_TYPE - && TYPE_ACTUAL_BOUNDS (gnu_inner_type) == 0) + && !TYPE_ACTUAL_BOUNDS (gnu_inner_type)) || (TREE_CODE (gnu_inner_type) == INTEGER_TYPE - && ! TYPE_HAS_ACTUAL_BOUNDS_P (gnu_inner_type))) + && !TYPE_HAS_ACTUAL_BOUNDS_P (gnu_inner_type))) { if (TREE_CODE (gnu_inner_type) == INTEGER_TYPE) { @@ -2159,7 +2158,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Abort if packed array with no packed array type field set. */ else if (Is_Packed (gnat_entity)) - gigi_abort (107); + abort (); break; @@ -2252,9 +2251,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) : (Component_Alignment (gnat_entity) == Calign_Storage_Unit) ? -1 : 0); - int has_rep = Has_Specified_Layout (gnat_entity); - int all_rep = has_rep; - int is_extension + bool has_rep = Has_Specified_Layout (gnat_entity); + bool all_rep = has_rep; + bool is_extension = (Is_Tagged_Type (gnat_entity) && Nkind (record_definition) == N_Derived_Type_Definition); @@ -2266,18 +2265,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if ((Ekind (gnat_field) == E_Component || Ekind (gnat_field) == E_Discriminant) && No (Component_Clause (gnat_field))) - all_rep = 0; + all_rep = false; /* If this is a record extension, go a level further to find the record definition. Also, verify we have a Parent_Subtype. */ if (is_extension) { - if (! type_annotate_only + if (!type_annotate_only || Present (Record_Extension_Part (record_definition))) record_definition = Record_Extension_Part (record_definition); - if (! type_annotate_only && No (Parent_Subtype (gnat_entity))) - gigi_abort (121); + if (!type_annotate_only && No (Parent_Subtype (gnat_entity))) + abort (); } /* Make a node for the record. If we are not defining the record, @@ -2303,17 +2302,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) DECL_IGNORED_P (TYPE_NAME (gnu_type)) = 0; TYPE_ALIGN (gnu_type) = 0; - TYPE_PACKED (gnu_type) = packed != 0 || has_rep; + TYPE_PACKED (gnu_type) = packed || has_rep; - if (! definition) + if (!definition) { defer_incomplete_level++; - this_deferred = 1; + this_deferred = true; gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - save_gnu_tree (gnat_entity, gnu_decl, 0); - this_made_decl = saved = 1; + save_gnu_tree (gnat_entity, gnu_decl, false); + this_made_decl = saved = true; } /* If both a size and rep clause was specified, put the size in @@ -2368,7 +2367,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) (gnat_field), NULL_TREE, 0), NULL_TREE), - 1); + true); gnu_parent = gnat_to_gnu_type (Parent_Subtype (gnat_entity)); @@ -2385,7 +2384,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } /* Add the fields for the discriminants into the record. */ - if (! Is_Unchecked_Union (gnat_entity) + if (!Is_Unchecked_Union (gnat_entity) && Has_Discriminants (gnat_entity)) for (gnat_field = First_Stored_Discriminant (gnat_entity); Present (gnat_field); @@ -2410,7 +2409,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) build (PLACEHOLDER_EXPR, DECL_CONTEXT (gnu_field)), gnu_field, NULL_TREE), - 1); + true); TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; @@ -2423,8 +2422,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Add the listed fields into the record and finish up. */ components_to_record (gnu_type, Component_List (record_definition), - gnu_field_list, packed, definition, 0, - 0, all_rep); + gnu_field_list, packed, definition, NULL, + false, all_rep); TYPE_VOLATILE (gnu_type) = Treat_As_Volatile (gnat_entity); TYPE_BY_REFERENCE_P (gnu_type) = Is_By_Reference_Type (gnat_entity); @@ -2432,7 +2431,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If this is an extension type, reset the tree for any inherited discriminants. Also remove the PLACEHOLDER_EXPR for non-inherited discriminants. */ - if (! Is_Unchecked_Union (gnat_entity) + if (!Is_Unchecked_Union (gnat_entity) && Has_Discriminants (gnat_entity)) for (gnat_field = First_Stored_Discriminant (gnat_entity); Present (gnat_field); @@ -2440,12 +2439,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { if (Present (Parent_Subtype (gnat_entity)) && Present (Corresponding_Discriminant (gnat_field))) - save_gnu_tree (gnat_field, NULL_TREE, 0); + save_gnu_tree (gnat_field, NULL_TREE, false); else { gnu_field = get_gnu_tree (gnat_field); - save_gnu_tree (gnat_field, NULL_TREE, 0); - save_gnu_tree (gnat_field, TREE_OPERAND (gnu_field, 1), 0); + save_gnu_tree (gnat_field, NULL_TREE, false); + save_gnu_tree (gnat_field, TREE_OPERAND (gnu_field, 1), + false); } } @@ -2459,8 +2459,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) the same as that of the type we are derived from. We assume here that the other type is already frozen. */ if (Etype (gnat_entity) != gnat_entity - && ! (Is_Private_Type (Etype (gnat_entity)) - && Full_View (Etype (gnat_entity)) == gnat_entity)) + && !(Is_Private_Type (Etype (gnat_entity)) + && Full_View (Etype (gnat_entity)) == gnat_entity)) copy_alias_set (gnu_type, gnat_to_gnu_type (Etype (gnat_entity))); /* Fill in locations of fields. */ @@ -2474,7 +2474,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if ((Ekind (gnat_temp) == E_Component || Ekind (gnat_temp) == E_Discriminant) && Is_Itype (Etype (gnat_temp)) - && ! present_gnu_tree (gnat_temp)) + && !present_gnu_tree (gnat_temp)) gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, 0); } break; @@ -2488,7 +2488,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { gnu_decl = gnat_to_gnu_entity (Equivalent_Type (gnat_entity), NULL_TREE, 0); - maybe_present = 1; + maybe_present = true; break; } @@ -2504,7 +2504,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { gnu_decl = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity), NULL_TREE, 0); - maybe_present = 1; + maybe_present = true; } /* Otherwise, first ensure the base type is elaborated. Then, if we are @@ -2520,8 +2520,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tree gnu_base_type; tree gnu_orig_type; - if (! definition) - defer_incomplete_level++, this_deferred = 1; + if (!definition) + defer_incomplete_level++, this_deferred = true; /* Get the base type initially for its alignment and sizes. But if it is a padded type, we do all the other work with the @@ -2535,7 +2535,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (present_gnu_tree (gnat_entity)) { - maybe_present = 1; + maybe_present = true; break; } @@ -2550,8 +2550,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) expressions are Is_Constrained but aren't constrained! */ if (IN (Ekind (gnat_base_type), Record_Kind) - && ! Is_For_Access_Subtype (gnat_entity) - && ! Is_Unchecked_Union (gnat_base_type) + && !Is_For_Access_Subtype (gnat_entity) + && !Is_Unchecked_Union (gnat_base_type) && Is_Constrained (gnat_entity) && Stored_Constraint (gnat_entity) != No_Elist && Present (Discriminant_Constraint (gnat_entity))) @@ -2590,7 +2590,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = gnu_entity_id; TYPE_STUB_DECL (gnu_type) - = create_type_decl (NULL_TREE, gnu_type, NULL, 0, 0, + = create_type_decl (NULL_TREE, gnu_type, NULL, false, false, gnat_entity); TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_base_type); @@ -2654,9 +2654,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = create_field_decl (DECL_NAME (gnu_old_field), gnu_field_type, gnu_type, 0, gnu_size, gnu_new_pos, - ! DECL_NONADDRESSABLE_P (gnu_old_field)); + !DECL_NONADDRESSABLE_P (gnu_old_field)); - if (! TREE_CONSTANT (gnu_pos)) + if (!TREE_CONSTANT (gnu_pos)) { normalize_offset (&gnu_pos, &gnu_bitpos, offset_align); DECL_FIELD_OFFSET (gnu_field) = gnu_pos; @@ -2673,7 +2673,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) DECL_INTERNAL_P (gnu_field) = DECL_INTERNAL_P (gnu_old_field); SET_DECL_ORIGINAL_FIELD - (gnu_field, (DECL_ORIGINAL_FIELD (gnu_old_field) != 0 + (gnu_field, (DECL_ORIGINAL_FIELD (gnu_old_field) ? DECL_ORIGINAL_FIELD (gnu_old_field) : gnu_old_field)); DECL_DISCRIMINANT_NUMBER (gnu_field) @@ -2682,10 +2682,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = TREE_THIS_VOLATILE (gnu_old_field); TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; - save_gnu_tree (gnat_field, gnu_field, 0); + save_gnu_tree (gnat_field, gnu_field, false); } - finish_record_type (gnu_type, nreverse (gnu_field_list), 1, 0); + finish_record_type (gnu_type, nreverse (gnu_field_list), + true, false); /* Now set the size, alignment and alias set of the new type to match that of the old one, doing any substitutions, as @@ -2712,8 +2713,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TREE_PURPOSE (gnu_temp), TREE_VALUE (gnu_temp)); - if (TYPE_ADA_SIZE (gnu_type) != 0 - && CONTAINS_PLACEHOLDER_P (TYPE_ADA_SIZE (gnu_type))) + if (CONTAINS_PLACEHOLDER_P (TYPE_ADA_SIZE (gnu_type))) for (gnu_temp = gnu_subst_list; gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp)) SET_TYPE_ADA_SIZE @@ -2750,14 +2750,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_subtype_marker, 0, NULL_TREE, NULL_TREE, 0), - 0, 0); + false, false); } TYPE_VOLATILE (gnu_type) = Treat_As_Volatile (gnat_entity); TYPE_NAME (gnu_type) = gnu_entity_id; TYPE_STUB_DECL (gnu_type) = create_type_decl (TYPE_NAME (gnu_type), gnu_type, - NULL, 1, debug_info_p, gnat_entity); + NULL, true, debug_info_p, gnat_entity); } /* Otherwise, go down all the components in the new type and @@ -2766,11 +2766,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) for (gnat_temp = First_Entity (gnat_entity); Present (gnat_temp); gnat_temp = Next_Entity (gnat_temp)) if ((Ekind (gnat_temp) == E_Discriminant - && ! Is_Unchecked_Union (gnat_base_type)) + && !Is_Unchecked_Union (gnat_base_type)) || Ekind (gnat_temp) == E_Component) save_gnu_tree (gnat_temp, get_gnu_tree - (Original_Record_Component (gnat_temp)), 0); + (Original_Record_Component (gnat_temp)), false); } break; @@ -2779,7 +2779,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If we are not defining this entity, and we have incomplete entities being processed above us, make a dummy type and fill it in later. */ - if (! definition && defer_incomplete_level != 0) + if (!definition && defer_incomplete_level != 0) { struct incomplete *p = (struct incomplete *) xmalloc (sizeof (struct incomplete)); @@ -2788,10 +2788,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = build_pointer_type (make_dummy_type (Directly_Designated_Type (gnat_entity))); gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - save_gnu_tree (gnat_entity, gnu_decl, 0); - this_made_decl = saved = 1; + save_gnu_tree (gnat_entity, gnu_decl, false); + this_made_decl = saved = true; p->old_type = TREE_TYPE (gnu_type); p->full_type = Directly_Designated_Type (gnat_entity); @@ -2815,13 +2815,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ? Full_View (gnat_desig_type) : 0); /* We want to know if we'll be seeing the freeze node for any incomplete type we may be pointing to. */ - int in_main_unit + bool in_main_unit = (Present (gnat_desig_full) ? In_Extended_Main_Code_Unit (gnat_desig_full) : In_Extended_Main_Code_Unit (gnat_desig_type)); - int got_fat_p = 0; - int made_dummy = 0; - tree gnu_desig_type = 0; + bool got_fat_p = false; + bool made_dummy = false; + tree gnu_desig_type = NULL_TREE; enum machine_mode p_mode = mode_for_size (esize, MODE_INT, 0); if (!targetm.valid_pointer_mode (p_mode)) @@ -2851,11 +2851,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) subtype of. This avoids problems with multiple copies of unconstrained array types. */ if (Ekind (gnat_desig_type) == E_Array_Subtype - && ! Is_Constrained (gnat_desig_type)) + && !Is_Constrained (gnat_desig_type)) gnat_desig_type = Etype (gnat_desig_type); if (Present (gnat_desig_full) && Ekind (gnat_desig_full) == E_Array_Subtype - && ! Is_Constrained (gnat_desig_full)) + && !Is_Constrained (gnat_desig_full)) gnat_desig_full = Etype (gnat_desig_full); /* If the designated type is a subtype of an incomplete record type, @@ -2876,23 +2876,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if ((Present (gnat_desig_full) && Is_Array_Type (gnat_desig_full) - && ! Is_Constrained (gnat_desig_full)) + && !Is_Constrained (gnat_desig_full)) || (present_gnu_tree (gnat_desig_type) && TYPE_IS_DUMMY_P (TREE_TYPE (get_gnu_tree (gnat_desig_type))) && Is_Array_Type (gnat_desig_type) - && ! Is_Constrained (gnat_desig_type)) + && !Is_Constrained (gnat_desig_type)) || (present_gnu_tree (gnat_desig_type) && (TREE_CODE (TREE_TYPE (get_gnu_tree (gnat_desig_type))) == UNCONSTRAINED_ARRAY_TYPE) - && (TYPE_POINTER_TO (TREE_TYPE - (get_gnu_tree (gnat_desig_type))) - == 0)) - || (No (gnat_desig_full) && ! in_main_unit - && defer_incomplete_level != 0 - && ! present_gnu_tree (gnat_desig_type) + && !(TYPE_POINTER_TO (TREE_TYPE + (get_gnu_tree (gnat_desig_type))))) + || (No (gnat_desig_full) && !in_main_unit + && defer_incomplete_level + && !present_gnu_tree (gnat_desig_type) && Is_Array_Type (gnat_desig_type) - && ! Is_Constrained (gnat_desig_type))) + && !Is_Constrained (gnat_desig_type))) { tree gnu_old = (present_gnu_tree (gnat_desig_type) @@ -2901,14 +2900,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tree fields; /* Show the dummy we get will be a fat pointer. */ - got_fat_p = made_dummy = 1; + got_fat_p = made_dummy = true; /* If the call above got something that has a pointer, that pointer is our type. This could have happened either because the type was elaborated or because somebody else executed the code below. */ gnu_type = TYPE_POINTER_TO (gnu_old); - if (gnu_type == 0) + if (!gnu_type) { gnu_type = make_node (RECORD_TYPE); SET_TYPE_UNCONSTRAINED_ARRAY (gnu_type, gnu_old); @@ -2929,7 +2928,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_ALIGN (gnu_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE); TYPE_IS_FAT_POINTER_P (gnu_type) = 1; - finish_record_type (gnu_type, fields, 0, 1); + finish_record_type (gnu_type, fields, false, true); TYPE_OBJECT_RECORD_TYPE (gnu_old) = make_node (RECORD_TYPE); TYPE_NAME (TYPE_OBJECT_RECORD_TYPE (gnu_old)) @@ -2948,22 +2947,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) to it. If it is a reference to an incomplete or private type with a full view that is a record, make a dummy type node and get the actual type later when we have verified it is safe. */ - else if (! in_main_unit - && ! present_gnu_tree (gnat_desig_type) + else if (!in_main_unit + && !present_gnu_tree (gnat_desig_type) && Present (gnat_desig_full) - && ! present_gnu_tree (gnat_desig_full) + && !present_gnu_tree (gnat_desig_full) && Is_Record_Type (gnat_desig_full)) { gnu_desig_type = make_dummy_type (gnat_desig_type); - made_dummy = 1; + made_dummy = true; } /* Likewise if we are pointing to a record or array and we are to defer elaborating incomplete types. We do this since this access type may be the full view of some private type. Note that the unconstrained array case is handled above. */ - else if ((! in_main_unit || imported_p) && defer_incomplete_level != 0 - && ! present_gnu_tree (gnat_desig_type) + else if ((!in_main_unit || imported_p) && defer_incomplete_level != 0 + && !present_gnu_tree (gnat_desig_type) && ((Is_Record_Type (gnat_desig_type) || Is_Array_Type (gnat_desig_type)) || (Present (gnat_desig_full) @@ -2971,7 +2970,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || Is_Array_Type (gnat_desig_full))))) { gnu_desig_type = make_dummy_type (gnat_desig_type); - made_dummy = 1; + made_dummy = true; } else if (gnat_desig_type == gnat_entity) { @@ -2988,14 +2987,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) type. If so, just return it. */ if (present_gnu_tree (gnat_entity)) { - maybe_present = 1; + maybe_present = true; break; } /* If we have a GCC type for the designated type, possibly modify it if we are pointing only to constant objects and then make a pointer to it. Don't do this for unconstrained arrays. */ - if (gnu_type == 0 && gnu_desig_type != 0) + if (!gnu_type && gnu_desig_type) { if (Is_Access_Constant (gnat_entity) && TREE_CODE (gnu_desig_type) != UNCONSTRAINED_ARRAY_TYPE) @@ -3011,13 +3010,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) of the call to gnat_to_gnu_type above if we are processing an access type for a record component designating the record type itself. */ - if (! COMPLETE_TYPE_P (gnu_desig_type)) + if (!COMPLETE_TYPE_P (gnu_desig_type)) { /* We must ensure that the pointer to variant we make will be processed by update_pointer_to when the initial type is completed. Pretend we made a dummy and let further processing act as usual. */ - made_dummy = 1; + made_dummy = true; /* We must ensure that update_pointer_to will not retrieve the dummy variant when building a properly qualified @@ -3041,7 +3040,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) actually looking up the actual type, make an entry in the deferred list. */ - if (! in_main_unit && made_dummy) + if (!in_main_unit && made_dummy) { tree gnu_old_type = TYPE_FAT_POINTER_P (gnu_type) @@ -3055,28 +3054,26 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) (TYPE_UNCONSTRAINED_ARRAY (gnu_type))); gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - save_gnu_tree (gnat_entity, gnu_decl, 0); - this_made_decl = saved = 1; + save_gnu_tree (gnat_entity, gnu_decl, false); + this_made_decl = saved = true; if (defer_incomplete_level == 0) - { - update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_type), - gnat_to_gnu_type (gnat_desig_type)); - /* Note that the call to gnat_to_gnu_type here might have - updated gnu_old_type directly, in which case it is not a - dummy type any more when we get into update_pointer_to. - - This may happen for instance when the designated type is a - record type, because their elaboration starts with an - initial node from make_dummy_type, which may yield the same - node as the one we got. - - Besides, variants of this non-dummy type might have been - created along the way. update_pointer_to is expected to - properly take care of those situations. */ - } + /* Note that the call to gnat_to_gnu_type here might have + updated gnu_old_type directly, in which case it is not a + dummy type any more when we get into update_pointer_to. + + This may happen for instance when the designated type is a + record type, because their elaboration starts with an + initial node from make_dummy_type, which may yield the same + node as the one we got. + + Besides, variants of this non-dummy type might have been + created along the way. update_pointer_to is expected to + properly take care of those situations. */ + update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_type), + gnat_to_gnu_type (gnat_desig_type)); else { struct incomplete *p @@ -3100,9 +3097,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = gnat_to_gnu_type (Equivalent_Type (gnat_entity)); if (Is_Itype (Directly_Designated_Type (gnat_entity)) - && ! present_gnu_tree (Directly_Designated_Type (gnat_entity)) + && !present_gnu_tree (Directly_Designated_Type (gnat_entity)) && No (Freeze_Node (Directly_Designated_Type (gnat_entity))) - && ! Is_Record_Type (Scope (Directly_Designated_Type (gnat_entity)))) + && !Is_Record_Type (Scope (Directly_Designated_Type (gnat_entity)))) gnat_to_gnu_entity (Directly_Designated_Type (gnat_entity), NULL_TREE, 0); @@ -3124,14 +3121,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = gnat_to_gnu_type (Etype (gnat_entity)); if (Is_Itype (Directly_Designated_Type (gnat_entity)) - && ! present_gnu_tree (Directly_Designated_Type (gnat_entity)) + && !present_gnu_tree (Directly_Designated_Type (gnat_entity)) && Is_Frozen (Directly_Designated_Type (gnat_entity)) && No (Freeze_Node (Directly_Designated_Type (gnat_entity)))) { /* If we are not defining this entity, and we have incomplete entities being processed above us, make a dummy type and elaborate it later. */ - if (! definition && defer_incomplete_level != 0) + if (!definition && defer_incomplete_level != 0) { struct incomplete *p = (struct incomplete *) xmalloc (sizeof (struct incomplete)); @@ -3153,7 +3150,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) NULL_TREE, 0); } - maybe_present = 1; + maybe_present = true; break; /* Subprogram Entities @@ -3225,22 +3222,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_CI_CO_LIST field of the FUNCTION_TYPE node we create. */ tree gnu_return_list = NULL_TREE; Entity_Id gnat_param; - int inline_flag = Is_Inlined (gnat_entity); - int public_flag = Is_Public (gnat_entity); - int extern_flag + bool inline_flag = Is_Inlined (gnat_entity); + bool public_flag = Is_Public (gnat_entity); + bool extern_flag = (Is_Public (gnat_entity) && !definition) || imported_p; - int pure_flag = Is_Pure (gnat_entity); - int volatile_flag = No_Return (gnat_entity); - int returns_by_ref = 0; - int returns_unconstrained = 0; + bool pure_flag = Is_Pure (gnat_entity); + bool volatile_flag = No_Return (gnat_entity); + bool returns_by_ref = false; + bool returns_unconstrained = false; tree gnu_ext_name = create_concat_name (gnat_entity, 0); - int has_copy_in_out = 0; + bool has_copy_in_out = false; int parmnum; - if (kind == E_Subprogram_Type && ! definition) + if (kind == E_Subprogram_Type && !definition) /* A parameter may refer to this type, so defer completion of any incomplete types. */ - defer_incomplete_level++, this_deferred = 1; + defer_incomplete_level++, this_deferred = true; /* If the subprogram has an alias, it is probably inherited, so we can use the original one. If the original "subprogram" @@ -3271,7 +3268,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) return type of this function the pointer and mark the decl. */ if (Returns_By_Ref (gnat_entity)) { - returns_by_ref = 1; + returns_by_ref = true; gnu_return_type = build_pointer_type (gnu_return_type); } @@ -3291,7 +3288,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else if (TREE_CODE (gnu_return_type) == UNCONSTRAINED_ARRAY_TYPE) { gnu_return_type = TREE_TYPE (gnu_return_type); - returns_unconstrained = 1; + returns_unconstrained = true; } /* If the type requires a transient scope, the result is allocated @@ -3300,7 +3297,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else if (Requires_Transient_Scope (Etype (gnat_entity))) { gnu_return_type = build_pointer_type (gnu_return_type); - returns_unconstrained = 1; + returns_unconstrained = true; } /* If the type is a padded type and the underlying type would not @@ -3308,8 +3305,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) return the underlying type. */ else if (TREE_CODE (gnu_return_type) == RECORD_TYPE && TYPE_IS_PADDING_P (gnu_return_type) - && (! default_pass_by_ref (TREE_TYPE - (TYPE_FIELDS (gnu_return_type))) + && (!default_pass_by_ref (TREE_TYPE + (TYPE_FIELDS (gnu_return_type))) || Has_Foreign_Convention (gnat_entity))) gnu_return_type = TREE_TYPE (TYPE_FIELDS (gnu_return_type)); @@ -3339,33 +3336,33 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tree gnu_param_name = get_entity_name (gnat_param); tree gnu_param_type = gnat_to_gnu_type (Etype (gnat_param)); tree gnu_param, gnu_field; - int by_ref_p = 0; - int by_descr_p = 0; - int by_component_ptr_p = 0; - int copy_in_copy_out_flag = 0; - int req_by_copy = 0, req_by_ref = 0; + bool by_ref_p = false; + bool by_descr_p = false; + bool by_component_ptr_p = false; + bool copy_in_copy_out_flag = false; + bool req_by_copy = false, req_by_ref = false; /* See if a Mechanism was supplied that forced this parameter to be passed one way or another. */ if (Is_Valued_Procedure (gnat_entity) && parmnum == 0) - req_by_copy = 1; + req_by_copy = true; else if (Mechanism (gnat_param) == Default) ; else if (Mechanism (gnat_param) == By_Copy) - req_by_copy = 1; + req_by_copy = true; else if (Mechanism (gnat_param) == By_Reference) - req_by_ref = 1; + req_by_ref = true; else if (Mechanism (gnat_param) <= By_Descriptor) - by_descr_p = 1; + by_descr_p = true; else if (Mechanism (gnat_param) > 0) { if (TREE_CODE (gnu_param_type) == UNCONSTRAINED_ARRAY_TYPE || TREE_CODE (TYPE_SIZE (gnu_param_type)) != INTEGER_CST || 0 < compare_tree_int (TYPE_SIZE (gnu_param_type), Mechanism (gnat_param))) - req_by_ref = 1; + req_by_ref = true; else - req_by_copy = 1; + req_by_copy = true; } else post_error ("unsupported mechanism for&", gnat_param); @@ -3376,8 +3373,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (TREE_CODE (gnu_param_type) == RECORD_TYPE && TYPE_IS_PADDING_P (gnu_param_type) && (req_by_ref || Has_Foreign_Convention (gnat_entity) - || ! must_pass_by_ref (TREE_TYPE (TYPE_FIELDS - (gnu_param_type))))) + || !must_pass_by_ref (TREE_TYPE (TYPE_FIELDS + (gnu_param_type))))) gnu_param_type = TREE_TYPE (TYPE_FIELDS (gnu_param_type)); /* If this is an IN parameter it is read-only, so make a variant @@ -3388,8 +3385,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) self-referential type. */ if (Ekind (gnat_param) == E_In_Parameter && TREE_CODE (gnu_param_type) != UNCONSTRAINED_ARRAY_TYPE - && ! (TYPE_SIZE (gnu_param_type) != 0 - && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_param_type)))) + && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_param_type))) gnu_param_type = build_qualified_type (gnu_param_type, (TYPE_QUALS (gnu_param_type) @@ -3409,11 +3405,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_param_type = build_pointer_type (build_vms_descriptor (gnu_param_type, - Mechanism (gnat_param), - gnat_entity)); + Mechanism (gnat_param), gnat_entity)); else if (Has_Foreign_Convention (gnat_entity) - && ! req_by_copy + && !req_by_copy && TREE_CODE (gnu_param_type) == ARRAY_TYPE) { /* Strip off any multi-dimensional entries, then strip @@ -3422,7 +3417,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_param_type))) gnu_param_type = TREE_TYPE (gnu_param_type); - by_component_ptr_p = 1; + by_component_ptr_p = true; gnu_param_type = TREE_TYPE (gnu_param_type); if (Ekind (gnat_param) == E_In_Parameter) @@ -3440,7 +3435,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && TYPE_FAT_POINTER_P (gnu_param_type)) gnu_param_type = make_type_from_size (gnu_param_type, - size_int (POINTER_SIZE), 0); + size_int (POINTER_SIZE), false); /* If we must pass or were requested to pass by reference, do so. If we were requested to pass by copy, do so. @@ -3449,7 +3444,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) all integer and FP types that way too. For Convention Ada, use the standard Ada default. */ else if (must_pass_by_ref (gnu_param_type) || req_by_ref - || (! req_by_copy + || (!req_by_copy && ((Has_Foreign_Convention (gnat_entity) && (Ekind (gnat_param) != E_In_Parameter || AGGREGATE_TYPE_P (gnu_param_type))) @@ -3461,15 +3456,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || FLOAT_TYPE_P (gnu_param_type))) /* For convention Ada, see if we pass by reference by default. */ - || (! Has_Foreign_Convention (gnat_entity) + || (!Has_Foreign_Convention (gnat_entity) && default_pass_by_ref (gnu_param_type))))) { gnu_param_type = build_reference_type (gnu_param_type); - by_ref_p = 1; + by_ref_p = true; } else if (Ekind (gnat_param) != E_In_Parameter) - copy_in_copy_out_flag = 1; + copy_in_copy_out_flag = true; if (req_by_copy && (by_ref_p || by_component_ptr_p)) post_error ("?cannot pass & by copy", gnat_param); @@ -3493,16 +3488,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) check for packed arrays of records. This may lead to useless copy-in operations, but in very rare cases only, as these would be exceptions in a set of already exceptional situations. */ - if (Ekind (gnat_param) == E_Out_Parameter && ! by_ref_p + if (Ekind (gnat_param) == E_Out_Parameter && !by_ref_p && ((Is_Valued_Procedure (gnat_entity) && parmnum == 0) - || (! by_descr_p - && ! POINTER_TYPE_P (gnu_param_type) - && ! AGGREGATE_TYPE_P (gnu_param_type))) - && ! (Is_Array_Type (Etype (gnat_param)) - && Is_Packed (Etype (gnat_param)) - && Is_Composite_Type (Component_Type - (Etype (gnat_param))))) - gnu_param = 0; + || (!by_descr_p + && !POINTER_TYPE_P (gnu_param_type) + && !AGGREGATE_TYPE_P (gnu_param_type))) + && !(Is_Array_Type (Etype (gnat_param)) + && Is_Packed (Etype (gnat_param)) + && Is_Composite_Type (Component_Type + (Etype (gnat_param))))) + gnu_param = NULL_TREE; else { gnu_param @@ -3519,7 +3514,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && (by_ref_p || by_component_ptr_p)); Sloc_to_locus (Sloc (gnat_param), &DECL_SOURCE_LOCATION (gnu_param)); - save_gnu_tree (gnat_param, gnu_param, 0); + save_gnu_tree (gnat_param, gnu_param, false); gnu_param_list = chainon (gnu_param, gnu_param_list); /* If a parameter is a pointer, this function may modify @@ -3529,19 +3524,19 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) case also handles by-ref parameters. */ if (POINTER_TYPE_P (gnu_param_type) || TYPE_FAT_POINTER_P (gnu_param_type)) - pure_flag = 0; + pure_flag = false; } if (copy_in_copy_out_flag) { - if (! has_copy_in_out) + if (!has_copy_in_out) { if (TREE_CODE (gnu_return_type) != VOID_TYPE) - gigi_abort (111); + abort (); gnu_return_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_return_type) = get_identifier ("RETURN"); - has_copy_in_out = 1; + has_copy_in_out = true; } gnu_field = create_field_decl (gnu_param_name, gnu_param_type, @@ -3557,10 +3552,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Do not compute record for out parameters if subprogram is stubbed since structures are incomplete for the back-end. */ - if (gnu_field_list != 0 + if (gnu_field_list && Convention (gnat_entity) != Convention_Stubbed) finish_record_type (gnu_return_type, nreverse (gnu_field_list), - 0, 0); + false, false); /* If we have a CICO list but it has only one entry, we convert this function into a function that simply returns that one @@ -3593,16 +3588,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) returns_by_ref, Function_Returns_With_DSP (gnat_entity)); - /* ??? For now, don't consider nested functions pure. */ - if (! global_bindings_p ()) - pure_flag = 0; - /* A subprogram (something that doesn't return anything) shouldn't be considered Pure since there would be no reason for such a subprogram. Note that procedures with Out (or In Out) parameters have already been converted into a function with a return type. */ if (TREE_CODE (gnu_return_type) == VOID_TYPE) - pure_flag = 0; + pure_flag = false; gnu_type = build_qualified_type (gnu_type, @@ -3616,7 +3607,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) internal names of the subprogram are the same, only use the internal name to allow disambiguation of nested subprograms. */ if (No (Interface_Name (gnat_entity)) && gnu_ext_name == gnu_entity_id) - gnu_ext_name = 0; + gnu_ext_name = NULL_TREE; /* If we are defining the subprogram and it has an Address clause we must get the address expression from the saved GCC tree for the @@ -3627,7 +3618,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) make it a constant. */ if (Present (Address_Clause (gnat_entity))) { - tree gnu_address = 0; + tree gnu_address = NULL_TREE; if (definition) gnu_address @@ -3635,22 +3626,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ? get_gnu_tree (gnat_entity) : gnat_to_gnu (Expression (Address_Clause (gnat_entity)))); - save_gnu_tree (gnat_entity, NULL_TREE, 0); + save_gnu_tree (gnat_entity, NULL_TREE, false); gnu_type = build_reference_type (gnu_type); - if (gnu_address != 0) + if (gnu_address) gnu_address = convert (gnu_type, gnu_address); gnu_decl = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type, - gnu_address, 0, Is_Public (gnat_entity), - extern_flag, 0, 0, gnat_entity); + gnu_address, false, Is_Public (gnat_entity), + extern_flag, false, NULL, gnat_entity); DECL_BY_REF_P (gnu_decl) = 1; } else if (kind == E_Subprogram_Type) gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); else { @@ -3689,7 +3680,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { gnu_decl = gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, 0); - maybe_present = 1; + maybe_present = true; } break; @@ -3699,7 +3690,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) type from the full view. But always get the type from the full view for define on use types, since otherwise we won't see them! */ - else if (! definition + else if (!definition || (Is_Itype (Full_View (gnat_entity)) && No (Freeze_Node (gnat_entity))) || (Is_Itype (gnat_entity) @@ -3707,7 +3698,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { gnu_decl = gnat_to_gnu_entity (Full_View (gnat_entity), NULL_TREE, 0); - maybe_present = 1; + maybe_present = true; break; } @@ -3718,9 +3709,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Save this type as the full declaration's type so we can do any needed updates when we see it. */ gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - save_gnu_tree (Full_View (gnat_entity), gnu_decl, 0); + save_gnu_tree (Full_View (gnat_entity), gnu_decl, false); break; /* Simple class_wide types are always viewed as their root_type @@ -3731,7 +3722,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else gnu_type = gnat_to_gnu_type (Root_Type (gnat_entity)); - maybe_present = 1; + maybe_present = true; break; case E_Task_Type: @@ -3743,7 +3734,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else gnu_type = gnat_to_gnu_type (Corresponding_Record_Type (gnat_entity)); - maybe_present = 1; + maybe_present = true; break; case E_Label: @@ -3755,11 +3746,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Nothing at all to do here, so just return an ERROR_MARK and claim we've already saved it, so we don't try to. */ gnu_decl = error_mark_node; - saved = 1; + saved = true; break; default: - gigi_abort (113); + abort (); } /* If we had a case where we evaluated another type and it might have @@ -3767,14 +3758,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (maybe_present && present_gnu_tree (gnat_entity)) { gnu_decl = get_gnu_tree (gnat_entity); - saved = 1; + saved = true; } /* If we are processing a type and there is either no decl for it or we just made one, do some common processing for the type, such as handling alignment and possible padding. */ - if ((gnu_decl == 0 || this_made_decl) && IN (kind, Type_Kind)) + if ((!gnu_decl || this_made_decl) && IN (kind, Type_Kind)) { if (Is_Tagged_Type (gnat_entity) || Is_Class_Wide_Equivalent_Type (gnat_entity)) @@ -3786,13 +3777,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* ??? Don't set the size for a String_Literal since it is either confirming or we don't handle it properly (if the low bound is non-constant). */ - if (gnu_size == 0 && kind != E_String_Literal_Subtype) + if (!gnu_size && kind != E_String_Literal_Subtype) gnu_size = validate_size (Esize (gnat_entity), gnu_type, gnat_entity, - TYPE_DECL, 0, Has_Size_Clause (gnat_entity)); + TYPE_DECL, false, + Has_Size_Clause (gnat_entity)); /* If a size was specified, see if we can make a new type of that size by rearranging the type, for example from a fat to a thin pointer. */ - if (gnu_size != 0) + if (gnu_size) { gnu_type = make_type_from_size (gnu_type, gnu_size, @@ -3811,12 +3803,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else if (Known_Alignment (gnat_entity)) align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); - else if (Is_Atomic (gnat_entity) && gnu_size == 0 + else if (Is_Atomic (gnat_entity) && !gnu_size && host_integerp (TYPE_SIZE (gnu_type), 1) && integer_pow2p (TYPE_SIZE (gnu_type))) align = MIN (BIGGEST_ALIGNMENT, tree_low_cst (TYPE_SIZE (gnu_type), 1)); - else if (Is_Atomic (gnat_entity) && gnu_size != 0 + else if (Is_Atomic (gnat_entity) && gnu_size && host_integerp (gnu_size, 1) && integer_pow2p (gnu_size)) align = MIN (BIGGEST_ALIGNMENT, tree_low_cst (gnu_size, 1)); @@ -3824,8 +3816,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* See if we need to pad the type. If we did, and made a record, the name of the new type may be changed. So get it back for us when we make the new TYPE_DECL below. */ - gnu_type = maybe_pad_type (gnu_type, gnu_size, align, - gnat_entity, "PAD", 1, definition, 0); + gnu_type = maybe_pad_type (gnu_type, gnu_size, align, gnat_entity, "PAD", + true, definition, false); if (TREE_CODE (gnu_type) == RECORD_TYPE && TYPE_IS_PADDING_P (gnu_type)) { @@ -3842,9 +3834,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) make a variable for the size rather than calculating it each time. Handle both the RM size and the actual size. */ if (global_bindings_p () - && TYPE_SIZE (gnu_type) != 0 - && ! TREE_CONSTANT (TYPE_SIZE (gnu_type)) - && ! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) + && TYPE_SIZE (gnu_type) + && !TREE_CONSTANT (TYPE_SIZE (gnu_type)) + && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) { if (TREE_CODE (gnu_type) == RECORD_TYPE && operand_equal_p (TYPE_ADA_SIZE (gnu_type), @@ -3907,7 +3899,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) In GCC 3.4, we'll use DECL_OFFSET_ALIGN in some way, but right now, we have to put in an explicit multiply and divide by that value. */ - if (! CONTAINS_PLACEHOLDER_P (DECL_FIELD_OFFSET (gnu_field))) + if (!CONTAINS_PLACEHOLDER_P (DECL_FIELD_OFFSET (gnu_field))) DECL_FIELD_OFFSET (gnu_field) = build_binary_op (MULT_EXPR, sizetype, @@ -3928,20 +3920,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) * Treat_As_Volatile (gnat_entity)))); if (Is_Atomic (gnat_entity)) - check_ok_for_atomic (gnu_type, gnat_entity, 0); + check_ok_for_atomic (gnu_type, gnat_entity, false); if (Known_Alignment (gnat_entity)) TYPE_USER_ALIGN (gnu_type) = 1; - if (gnu_decl == 0) + if (!gnu_decl) gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list, - ! Comes_From_Source (gnat_entity), + !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); else TREE_TYPE (gnu_decl) = gnu_type; } - if (IN (kind, Type_Kind) && ! TYPE_IS_DUMMY_P (TREE_TYPE (gnu_decl))) + if (IN (kind, Type_Kind) && !TYPE_IS_DUMMY_P (TREE_TYPE (gnu_decl))) { gnu_type = TREE_TYPE (gnu_decl); @@ -3951,14 +3943,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) Set_Alignment (gnat_entity, UI_From_Int (TYPE_ALIGN (gnu_type) / BITS_PER_UNIT)); - if (Unknown_Esize (gnat_entity) && TYPE_SIZE (gnu_type) != 0) + if (Unknown_Esize (gnat_entity) && TYPE_SIZE (gnu_type)) { /* If the size is self-referential, we annotate the maximum value of that size. */ tree gnu_size = TYPE_SIZE (gnu_type); if (CONTAINS_PLACEHOLDER_P (gnu_size)) - gnu_size = max_size (gnu_size, 1); + gnu_size = max_size (gnu_size, true); Set_Esize (gnat_entity, annotate_value (gnu_size)); @@ -3989,21 +3981,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } } - if (Unknown_RM_Size (gnat_entity) && rm_size (gnu_type) != 0) + if (Unknown_RM_Size (gnat_entity) && rm_size (gnu_type)) Set_RM_Size (gnat_entity, annotate_value (rm_size (gnu_type))); } - if (! Comes_From_Source (gnat_entity) && DECL_P (gnu_decl)) + if (!Comes_From_Source (gnat_entity) && DECL_P (gnu_decl)) DECL_ARTIFICIAL (gnu_decl) = 1; - if (! debug_info_p && DECL_P (gnu_decl) + if (!debug_info_p && DECL_P (gnu_decl) && TREE_CODE (gnu_decl) != FUNCTION_DECL) DECL_IGNORED_P (gnu_decl) = 1; /* If we haven't already, associate the ..._DECL node that we just made with the input GNAT entity node. */ - if (! saved) - save_gnu_tree (gnat_entity, gnu_decl, 0); + if (!saved) + save_gnu_tree (gnat_entity, gnu_decl, false); /* If this is an enumeral or floating-point type, we were not able to set the bounds since they refer to the type. These bounds are always static. @@ -4012,7 +4004,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) enumeration literal table, if needed. */ if ((kind == E_Enumeration_Type && Present (First_Literal (gnat_entity))) - || (kind == E_Floating_Point_Type && ! Vax_Float (gnat_entity))) + || (kind == E_Floating_Point_Type && !Vax_Float (gnat_entity))) { tree gnu_scalar_type = gnu_type; @@ -4023,7 +4015,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If this is a floating point type and we haven't set a floating point type yet, use this in the evaluation of the bounds. */ - if (longest_float_type_node == 0 && kind == E_Floating_Point_Type) + if (!longest_float_type_node && kind == E_Floating_Point_Type) longest_float_type_node = gnu_type; TYPE_MIN_VALUE (gnu_scalar_type) @@ -4044,18 +4036,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If we deferred processing of incomplete types, re-enable it. If there were no other disables and we have some to process, do so. */ - if (this_deferred && --defer_incomplete_level == 0 - && defer_incomplete_list != 0) + if (this_deferred && --defer_incomplete_level == 0 && defer_incomplete_list) { struct incomplete *incp = defer_incomplete_list; struct incomplete *next; - defer_incomplete_list = 0; + defer_incomplete_list = NULL; for (; incp; incp = next) { next = incp->next; - if (incp->old_type != 0) + if (incp->old_type) update_pointer_to (TYPE_MAIN_VARIANT (incp->old_type), gnat_to_gnu_type (incp->full_type)); free (incp); @@ -4064,16 +4055,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* If we are not defining this type, see if it's in the incomplete list. If so, handle that list entry now. */ - else if (! definition) + else if (!definition) { struct incomplete *incp; for (incp = defer_incomplete_list; incp; incp = incp->next) - if (incp->old_type != 0 && incp->full_type == gnat_entity) + if (incp->old_type && incp->full_type == gnat_entity) { update_pointer_to (TYPE_MAIN_VARIANT (incp->old_type), TREE_TYPE (gnu_decl)); - incp->old_type = 0; + incp->old_type = NULL_TREE; } } @@ -4083,7 +4074,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (Is_Packed_Array_Type (gnat_entity) && Is_Itype (Associated_Node_For_Itype (gnat_entity)) && No (Freeze_Node (Associated_Node_For_Itype (gnat_entity))) - && ! present_gnu_tree (Associated_Node_For_Itype (gnat_entity))) + && !present_gnu_tree (Associated_Node_For_Itype (gnat_entity))) gnat_to_gnu_entity (Associated_Node_For_Itype (gnat_entity), NULL_TREE, 0); return gnu_decl; @@ -4111,10 +4102,10 @@ elaborate_entity (Entity_Id gnat_entity) is needed until the front stops generating bogus conversions on bounds of real types. */ - if (! Raises_Constraint_Error (gnat_lb)) + if (!Raises_Constraint_Error (gnat_lb)) elaborate_expression (gnat_lb, gnat_entity, get_identifier ("L"), 1, 0, Needs_Debug_Info (gnat_entity)); - if (! Raises_Constraint_Error (gnat_hb)) + if (!Raises_Constraint_Error (gnat_hb)) elaborate_expression (gnat_hb, gnat_entity, get_identifier ("U"), 1, 0, Needs_Debug_Info (gnat_entity)); break; @@ -4150,7 +4141,7 @@ elaborate_entity (Entity_Id gnat_entity) gnat_field = Next_Discriminant (gnat_field), gnat_discriminant_expr = Next_Elmt (gnat_discriminant_expr)) /* ??? For now, ignore access discriminants. */ - if (! Is_Access_Type (Etype (Node (gnat_discriminant_expr)))) + if (!Is_Access_Type (Etype (Node (gnat_discriminant_expr)))) elaborate_expression (Node (gnat_discriminant_expr), gnat_entity, get_entity_name (gnat_field), 1, 0, 0); @@ -4190,11 +4181,11 @@ mark_out_of_scope (Entity_Id gnat_entity) a subprogram or parameter. We could refine this, but it isn't worth it. If this is statically allocated, it is supposed to hang around out of cope. */ - if (present_gnu_tree (gnat_entity) && ! Is_Statically_Allocated (gnat_entity) - && kind != E_Procedure && kind != E_Function && ! IN (kind, Formal_Kind)) + if (present_gnu_tree (gnat_entity) && !Is_Statically_Allocated (gnat_entity) + && kind != E_Procedure && kind != E_Function && !IN (kind, Formal_Kind)) { - save_gnu_tree (gnat_entity, NULL_TREE, 1); - save_gnu_tree (gnat_entity, error_mark_node, 1); + save_gnu_tree (gnat_entity, NULL_TREE, true); + save_gnu_tree (gnat_entity, error_mark_node, true); } } @@ -4231,10 +4222,8 @@ copy_alias_set (tree gnu_new_type, tree gnu_old_type) DEFINITION is as in gnat_to_gnu_entity. */ static tree -substitution_list (Entity_Id gnat_subtype, - Entity_Id gnat_type, - tree gnu_list, - int definition) +substitution_list (Entity_Id gnat_subtype, Entity_Id gnat_type, + tree gnu_list, bool definition) { Entity_Id gnat_discrim; Node_Id gnat_value; @@ -4249,7 +4238,7 @@ substitution_list (Entity_Id gnat_subtype, gnat_discrim = Next_Stored_Discriminant (gnat_discrim), gnat_value = Next_Elmt (gnat_value)) /* Ignore access discriminants. */ - if (! Is_Access_Type (Etype (Node (gnat_value)))) + if (!Is_Access_Type (Etype (Node (gnat_value)))) gnu_list = tree_cons (gnat_to_gnu_entity (gnat_discrim, NULL_TREE, 0), elaborate_expression (Node (gnat_value), gnat_subtype, @@ -4323,27 +4312,27 @@ make_dummy_type (Entity_Id gnat_type) return gnu_type; } -/* Return 1 if the size represented by GNU_SIZE can be handled by an - allocation. If STATIC_P is non-zero, consider only what can be - done with a static allocation. */ +/* Return true if the size represented by GNU_SIZE can be handled by an + allocation. If STATIC_P is true, consider only what can be done with a + static allocation. */ -static int -allocatable_size_p (tree gnu_size, int static_p) +static bool +allocatable_size_p (tree gnu_size, bool static_p) { HOST_WIDE_INT our_size; /* If this is not a static allocation, the only case we want to forbid is an overflowing size. That will be converted into a raise a Storage_Error. */ - if (! static_p) - return ! (TREE_CODE (gnu_size) == INTEGER_CST - && TREE_CONSTANT_OVERFLOW (gnu_size)); + if (!static_p) + return !(TREE_CODE (gnu_size) == INTEGER_CST + && TREE_CONSTANT_OVERFLOW (gnu_size)); /* Otherwise, we need to deal with both variable sizes and constant sizes that won't fit in a host int. We use int instead of HOST_WIDE_INT since assemblers may not like very large sizes. */ if (!host_integerp (gnu_size, 1)) - return 0; + return false; our_size = tree_low_cst (gnu_size, 1); return (int) our_size == our_size; @@ -4481,7 +4470,7 @@ elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity, /* If we don't need a value and this is static or a discriment, we don't need to do anything. */ - else if (! need_value + else if (!need_value && (Is_OK_Static_Expression (gnat_expr) || (Nkind (gnat_expr) == N_Identifier && Ekind (Entity (gnat_expr)) == E_Discriminant))) @@ -4494,8 +4483,8 @@ elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity, /* Save the expression in case we try to elaborate this entity again. Since this is not a DECL, don't check it. Don't save if it's a discriminant. */ - if (! CONTAINS_PLACEHOLDER_P (gnu_expr)) - save_gnu_tree (gnat_expr, gnu_expr, 1); + if (!CONTAINS_PLACEHOLDER_P (gnu_expr)) + save_gnu_tree (gnat_expr, gnu_expr, true); return need_value ? gnu_expr : error_mark_node; } @@ -4507,13 +4496,13 @@ elaborate_expression_1 (Node_Id gnat_expr, Entity_Id gnat_entity, tree gnu_expr, tree gnu_name, bool definition, bool need_debug) { - tree gnu_decl = 0; + tree gnu_decl = NULL_TREE; /* Strip any conversions to see if the expression is a readonly variable. ??? This really should remain readonly, but we have to think about the typing of the tree here. */ - tree gnu_inner_expr = remove_conversions (gnu_expr, 1); - int expr_global = Is_Public (gnat_entity) || global_bindings_p (); - int expr_variable; + tree gnu_inner_expr = remove_conversions (gnu_expr, true); + bool expr_global = Is_Public (gnat_entity) || global_bindings_p (); + bool expr_variable; /* In most cases, we won't see a naked FIELD_DECL here because a discriminant reference will have been replaced with a COMPONENT_REF @@ -4536,9 +4525,9 @@ elaborate_expression_1 (Node_Id gnat_expr, Entity_Id gnat_entity, discriminant and some other variable. */ expr_variable = (TREE_CODE_CLASS (TREE_CODE (gnu_expr)) != 'c' - && ! (TREE_CODE (gnu_inner_expr) == VAR_DECL - && TREE_READONLY (gnu_inner_expr)) - && ! CONTAINS_PLACEHOLDER_P (gnu_expr)); + && !(TREE_CODE (gnu_inner_expr) == VAR_DECL + && TREE_READONLY (gnu_inner_expr)) + && !CONTAINS_PLACEHOLDER_P (gnu_expr)); /* If this is a static expression or contains a discriminant, we don't need the variable for debugging (and can't elaborate anyway if a @@ -4546,22 +4535,22 @@ elaborate_expression_1 (Node_Id gnat_expr, Entity_Id gnat_entity, if (need_debug && (Is_OK_Static_Expression (gnat_expr) || CONTAINS_PLACEHOLDER_P (gnu_expr))) - need_debug = 0; + need_debug = false; /* Now create the variable if we need it. */ if (need_debug || (expr_variable && expr_global)) gnu_decl = create_var_decl (create_concat_name (gnat_entity, IDENTIFIER_POINTER (gnu_name)), - NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, 1, - Is_Public (gnat_entity), ! definition, 0, 0, + NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true, + Is_Public (gnat_entity), !definition, false, NULL, gnat_entity); /* We only need to use this variable if we are in global context since GCC can do the right thing in the local case. */ if (expr_global && expr_variable) return gnu_decl; - else if (! expr_variable) + else if (!expr_variable) return gnu_expr; else return maybe_variable (gnu_expr); @@ -4603,7 +4592,7 @@ make_aligning_type (tree type, int align, tree size) 1, size, pos, 1); DECL_BIT_FIELD (field) = 0; - finish_record_type (record_type, field, 1, 0); + finish_record_type (record_type, field, true, false); TYPE_ALIGN (record_type) = BIGGEST_ALIGNMENT; TYPE_SIZE (record_type) = size_binop (PLUS_EXPR, @@ -4649,7 +4638,7 @@ make_packable_type (tree type) << (floor_log2 (tree_low_cst (TYPE_SIZE (type), 1) - 1) + 1)); /* Now copy the fields, keeping the position and size. */ - for (old_field = TYPE_FIELDS (type); old_field != 0; + for (old_field = TYPE_FIELDS (type); old_field; old_field = TREE_CHAIN (old_field)) { tree new_field_type = TREE_TYPE (old_field); @@ -4666,11 +4655,11 @@ make_packable_type (tree type) new_type, TYPE_PACKED (type), DECL_SIZE (old_field), bit_position (old_field), - ! DECL_NONADDRESSABLE_P (old_field)); + !DECL_NONADDRESSABLE_P (old_field)); DECL_INTERNAL_P (new_field) = DECL_INTERNAL_P (old_field); SET_DECL_ORIGINAL_FIELD - (new_field, (DECL_ORIGINAL_FIELD (old_field) != 0 + (new_field, (DECL_ORIGINAL_FIELD (old_field) ? DECL_ORIGINAL_FIELD (old_field) : old_field)); if (TREE_CODE (new_type) == QUAL_UNION_TYPE) @@ -4680,7 +4669,7 @@ make_packable_type (tree type) field_list = new_field; } - finish_record_type (new_type, nreverse (field_list), 1, 1); + finish_record_type (new_type, nreverse (field_list), true, true); copy_alias_set (new_type, type); return TYPE_MODE (new_type) == BLKmode ? type : new_type; } @@ -4691,18 +4680,18 @@ make_packable_type (tree type) GNAT_ENTITY and NAME_TRAILER are used to name the resulting record and to issue a warning. - IS_USER_TYPE is nonzero if we must be sure we complete the original type. + IS_USER_TYPE is true if we must be sure we complete the original type. - DEFINITION is nonzero if this type is being defined. + DEFINITION is true if this type is being defined. - SAME_RM_SIZE is nonzero if the RM_Size of the resulting type is to be + SAME_RM_SIZE is true if the RM_Size of the resulting type is to be set to its TYPE_SIZE; otherwise, it's set to the RM_Size of the original type. */ static tree maybe_pad_type (tree type, tree size, unsigned int align, Entity_Id gnat_entity, const char *name_trailer, - int is_user_type, int definition, int same_rm_size) + bool is_user_type, bool definition, bool same_rm_size) { tree orig_size = TYPE_SIZE (type); tree record; @@ -4716,7 +4705,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type)) { - if ((size == 0 + if ((!size || operand_equal_p (round_up (size, MAX (align, TYPE_ALIGN (type))), round_up (TYPE_SIZE (type), @@ -4725,7 +4714,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, && (align == 0 || align == TYPE_ALIGN (type))) return type; - if (size == 0) + if (!size) size = TYPE_SIZE (type); if (align == 0) align = TYPE_ALIGN (type); @@ -4739,16 +4728,16 @@ maybe_pad_type (tree type, tree size, unsigned int align, isn't changing. Likewise, clear the alignment if it isn't being changed. Then return if we aren't doing anything. */ - if (size != 0 + if (size && (operand_equal_p (size, orig_size, 0) || (TREE_CODE (orig_size) == INTEGER_CST && tree_int_cst_lt (size, orig_size)))) - size = 0; + size = NULL_TREE; if (align == TYPE_ALIGN (type)) align = 0; - if (align == 0 && size == 0) + if (align == 0 && !size) return type; /* We used to modify the record in place in some cases, but that could @@ -4763,10 +4752,10 @@ maybe_pad_type (tree type, tree size, unsigned int align, name. */ if (is_user_type) create_type_decl (get_entity_name (gnat_entity), type, - 0, ! Comes_From_Source (gnat_entity), - ! (TYPE_NAME (type) != 0 - && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && DECL_IGNORED_P (TYPE_NAME (type))), + NULL, !Comes_From_Source (gnat_entity), + !(TYPE_NAME (type) + && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && DECL_IGNORED_P (TYPE_NAME (type))), gnat_entity); /* If we are changing the alignment and the input type is a record with @@ -4781,7 +4770,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, && TYPE_MODE (type) == BLKmode && host_integerp (orig_size, 1) && compare_tree_int (orig_size, BIGGEST_ALIGNMENT) <= 0 - && (size == 0 + && (!size || (TREE_CODE (size) == INTEGER_CST && compare_tree_int (size, BIGGEST_ALIGNMENT) <= 0)) && tree_low_cst (orig_size, 1) % align == 0) @@ -4791,7 +4780,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, NULL_TREE, bitsize_zero_node, 1); DECL_INTERNAL_P (field) = 1; - TYPE_SIZE (record) = size != 0 ? size : orig_size; + TYPE_SIZE (record) = size ? size : orig_size; TYPE_SIZE_UNIT (record) = convert (sizetype, size_binop (CEIL_DIV_EXPR, TYPE_SIZE (record), @@ -4800,7 +4789,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, TYPE_IS_PADDING_P (record) = 1; TYPE_VOLATILE (record) = Present (gnat_entity) && Treat_As_Volatile (gnat_entity); - finish_record_type (record, field, 1, 0); + finish_record_type (record, field, true, false); /* Keep the RM_Size of the padded record as that of the old record if requested. */ @@ -4809,10 +4798,9 @@ maybe_pad_type (tree type, tree size, unsigned int align, /* Unless debugging information isn't being written for the input type, write a record that shows what we are a subtype of and also make a variable that indicates our size, if variable. */ - if (TYPE_NAME (record) != 0 - && AGGREGATE_TYPE_P (type) + if (TYPE_NAME (record) && AGGREGATE_TYPE_P (type) && (TREE_CODE (TYPE_NAME (type)) != TYPE_DECL - || ! DECL_IGNORED_P (TYPE_NAME (type)))) + || !DECL_IGNORED_P (TYPE_NAME (type)))) { tree marker = make_node (RECORD_TYPE); tree name = (TREE_CODE (TYPE_NAME (record)) == TYPE_DECL @@ -4828,25 +4816,25 @@ maybe_pad_type (tree type, tree size, unsigned int align, create_field_decl (orig_name, integer_type_node, marker, 0, NULL_TREE, NULL_TREE, 0), - 0, 0); + false, false); - if (size != 0 && TREE_CODE (size) != INTEGER_CST && definition) + if (size && TREE_CODE (size) != INTEGER_CST && definition) create_var_decl (concat_id_with_name (name, "XVZ"), NULL_TREE, - sizetype, TYPE_SIZE (record), 0, 0, 0, 0, 0, - gnat_entity); + sizetype, TYPE_SIZE (record), false, false, false, + false, NULL, gnat_entity); } type = record; if (CONTAINS_PLACEHOLDER_P (orig_size)) - orig_size = max_size (orig_size, 1); + orig_size = max_size (orig_size, true); /* If the size was widened explicitly, maybe give a warning. */ - if (size != 0 && Present (gnat_entity) - && ! operand_equal_p (size, orig_size, 0) - && ! (TREE_CODE (size) == INTEGER_CST - && TREE_CODE (orig_size) == INTEGER_CST - && tree_int_cst_lt (size, orig_size))) + if (size && Present (gnat_entity) + && !operand_equal_p (size, orig_size, 0) + && !(TREE_CODE (size) == INTEGER_CST + && TREE_CODE (orig_size) == INTEGER_CST + && tree_int_cst_lt (size, orig_size))) { Node_Id gnat_error_node = Empty; @@ -4868,7 +4856,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, gnat_entity, size_diffop (size, orig_size)); - else if (*name_trailer == 'C' && ! Is_Internal (gnat_entity)) + else if (*name_trailer == 'C' && !Is_Internal (gnat_entity)) post_error_ne_tree ("component of& padded{ by ^ bits}?", gnat_entity, gnat_entity, size_diffop (size, orig_size)); @@ -4954,7 +4942,7 @@ choices_to_gnu (tree operand, Node_Id choices) break; default: - gigi_abort (114); + abort (); } result = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, @@ -4970,11 +4958,11 @@ choices_to_gnu (tree operand, Node_Id choices) PACKED is 1 if the enclosing record is packed and -1 if the enclosing record has a Component_Alignment of Storage_Unit. - DEFINITION is nonzero if this field is for a record being defined. */ + DEFINITION is true if this field is for a record being defined. */ static tree gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, - int definition) + bool definition) { tree gnu_field_id = get_entity_name (gnat_field); tree gnu_field_type = gnat_to_gnu_type (Etype (gnat_field)); @@ -4982,7 +4970,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, tree gnu_pos = 0; tree gnu_size = 0; tree gnu_field; - int needs_strict_alignment + bool needs_strict_alignment = (Is_Aliased (gnat_field) || Strict_Alignment (Etype (gnat_field)) || Treat_As_Volatile (gnat_field)); @@ -4998,11 +4986,11 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, if (packed == 1) gnu_size = validate_size (RM_Size (Etype (gnat_field)), gnu_field_type, - gnat_field, FIELD_DECL, 0, 1); + gnat_field, FIELD_DECL, false, true); if (Known_Static_Esize (gnat_field)) gnu_size = validate_size (Esize (gnat_field), gnu_field_type, - gnat_field, FIELD_DECL, 0, 1); + gnat_field, FIELD_DECL, false, true); /* If the field's type is left-justified modular, the wrapper can prevent packing so we make the field the type of the inner object unless the @@ -5010,7 +4998,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, typically because in that case this field may later be passed by-ref for a formal argument expecting the left justification. The condition below is then matching the addressable_p code for COMPONENT_REF. */ - if (! Is_Aliased (gnat_field) && flag_strict_aliasing + if (!Is_Aliased (gnat_field) && flag_strict_aliasing && TREE_CODE (gnu_field_type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_field_type)) gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); @@ -5026,26 +5014,26 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, && host_integerp (TYPE_SIZE (gnu_field_type), 1) && compare_tree_int (TYPE_SIZE (gnu_field_type), BIGGEST_ALIGNMENT) <= 0 && (packed - || (gnu_size != 0 && tree_int_cst_lt (gnu_size, - TYPE_SIZE (gnu_field_type))) + || (gnu_size && tree_int_cst_lt (gnu_size, + TYPE_SIZE (gnu_field_type))) || Present (Component_Clause (gnat_field)))) { gnu_field_type = make_packable_type (gnu_field_type); - if (gnu_field_type != gnu_orig_field_type && gnu_size == 0) + if (gnu_field_type != gnu_orig_field_type && !gnu_size) gnu_size = rm_size (gnu_field_type); } /* If we are packing the record and the field is BLKmode, round the size up to a byte boundary. */ - if (packed && TYPE_MODE (gnu_field_type) == BLKmode && gnu_size != 0) + if (packed && TYPE_MODE (gnu_field_type) == BLKmode && gnu_size) gnu_size = round_up (gnu_size, BITS_PER_UNIT); if (Present (Component_Clause (gnat_field))) { gnu_pos = UI_To_gnu (Component_Bit_Offset (gnat_field), bitsizetype); gnu_size = validate_size (Esize (gnat_field), gnu_field_type, - gnat_field, FIELD_DECL, 0, 1); + gnat_field, FIELD_DECL, false, true); /* Ensure the position does not overlap with the parent subtype, if there is one. */ @@ -5079,30 +5067,29 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, /* If Atomic, the size must match exactly and if aliased, the size must not be less than the rounded size. */ if ((Is_Atomic (gnat_field) || Is_Atomic (Etype (gnat_field))) - && ! operand_equal_p (gnu_size, TYPE_SIZE (gnu_field_type), 0)) + && !operand_equal_p (gnu_size, TYPE_SIZE (gnu_field_type), 0)) { post_error_ne_tree ("atomic field& must be natural size of type{ (^)}", Last_Bit (Component_Clause (gnat_field)), gnat_field, TYPE_SIZE (gnu_field_type)); - gnu_size = 0; + gnu_size = NULL_TREE; } else if (Is_Aliased (gnat_field) - && gnu_size != 0 - && tree_int_cst_lt (gnu_size, gnu_min_size)) + && gnu_size && tree_int_cst_lt (gnu_size, gnu_min_size)) { post_error_ne_tree ("size of aliased field& too small{, minimum required is ^}", Last_Bit (Component_Clause (gnat_field)), gnat_field, gnu_min_size); - gnu_size = 0; + gnu_size = NULL_TREE; } - if (! integer_zerop (size_binop - (TRUNC_MOD_EXPR, gnu_pos, - bitsize_int (TYPE_ALIGN (gnu_field_type))))) + if (!integer_zerop (size_binop + (TRUNC_MOD_EXPR, gnu_pos, + bitsize_int (TYPE_ALIGN (gnu_field_type))))) { if (Is_Aliased (gnat_field)) post_error_ne_num @@ -5122,19 +5109,14 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, First_Bit (Component_Clause (gnat_field)), gnat_field, TYPE_ALIGN (gnu_field_type)); else - gigi_abort (124); + abort (); - gnu_pos = 0; + gnu_pos = NULL_TREE; } - - /* If an error set the size to zero, show we have no position - either. */ - if (gnu_size == 0) - gnu_pos = 0; } if (Is_Atomic (gnat_field)) - check_ok_for_atomic (gnu_field_type, gnat_field, 0); + check_ok_for_atomic (gnu_field_type, gnat_field, false); } /* If the record has rep clauses and this is the tag field, make a rep @@ -5150,24 +5132,24 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, self-referential and an unconstrained type. In that case, we can't pack the field since we can't make a copy to align it. */ if (TREE_CODE (gnu_field_type) == RECORD_TYPE - && gnu_size == 0 + && !gnu_size && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_field_type)) - && ! Is_Constrained (Underlying_Type (Etype (gnat_field)))) + && !Is_Constrained (Underlying_Type (Etype (gnat_field)))) { - gnu_size = max_size (TYPE_SIZE (gnu_field_type), 1); + gnu_size = max_size (TYPE_SIZE (gnu_field_type), true); packed = 0; } /* If no size is specified (or if there was an error), don't specify a position. */ - if (gnu_size == 0) - gnu_pos = 0; + if (!gnu_size) + gnu_pos = NULL_TREE; else { /* Unless this field is aliased, we can remove any left-justified modular type since it's only needed in the unchecked conversion case, which doesn't apply here. */ - if (! needs_strict_alignment + if (!needs_strict_alignment && TREE_CODE (gnu_field_type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_field_type)) gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); @@ -5175,13 +5157,13 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, gnu_field_type = make_type_from_size (gnu_field_type, gnu_size, Has_Biased_Representation (gnat_field)); - gnu_field_type = maybe_pad_type (gnu_field_type, gnu_size, 0, - gnat_field, "PAD", 0, definition, 1); + gnu_field_type = maybe_pad_type (gnu_field_type, gnu_size, 0, gnat_field, + "PAD", false, definition, true); } if (TREE_CODE (gnu_field_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_field_type)) - gigi_abort (118); + abort (); /* Now create the decl for the field. */ gnu_field = create_field_decl (gnu_field_id, gnu_field_type, gnu_record_type, @@ -5197,33 +5179,33 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, return gnu_field; } -/* Return 1 if TYPE is a type with variable size, a padding type with a field - of variable size or is a record that has a field such a field. */ +/* Return true if TYPE is a type with variable size, a padding type with a + field of variable size or is a record that has a field such a field. */ -static int +static bool is_variable_size (tree type) { tree field; /* We need not be concerned about this at all if we don't have strict alignment. */ - if (! STRICT_ALIGNMENT) - return 0; - else if (! TREE_CONSTANT (TYPE_SIZE (type))) - return 1; + if (!STRICT_ALIGNMENT) + return false; + else if (!TREE_CONSTANT (TYPE_SIZE (type))) + return true; else if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type) - && ! TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type)))) - return 1; + && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type)))) + return true; else if (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE && TREE_CODE (type) != QUAL_UNION_TYPE) - return 0; + return false; - for (field = TYPE_FIELDS (type); field != 0; field = TREE_CHAIN (field)) + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) if (is_variable_size (TREE_TYPE (field))) - return 1; + return true; - return 0; + return false; } /* Return a GCC tree for a record type given a GNAT Component_List and a chain @@ -5236,29 +5218,28 @@ is_variable_size (tree type) PACKED is 1 if this is for a record with "pragma pack" and -1 is this is for a record type with "pragma component_alignment (storage_unit)". - FINISH_RECORD is nonzero if this call will supply all of the remaining - fields of the record. + DEFINITION is true if we are defining this record. P_GNU_REP_LIST, if nonzero, is a pointer to a list to which each field with a rep clause is to be added. If it is nonzero, that is all that should be done with such fields. - CANCEL_ALIGNMENT, if nonzero, means the alignment should be zeroed - before laying out the record. This means the alignment only serves - to force fields to be bitfields, but not require the record to be - that aligned. This is used for variants. + CANCEL_ALIGNMENT, if true, means the alignment should be zeroed before + laying out the record. This means the alignment only serves to force fields + to be bitfields, but not require the record to be that aligned. This is + used for variants. - ALL_REP, if nonzero, means that a rep clause was found for all the - fields. This simplifies the logic since we know we're not in the mixed - case. + ALL_REP, if true, means a rep clause was found for all the fields. This + simplifies the logic since we know we're not in the mixed case. The processing of the component list fills in the chain with all of the fields of the record and then the record type is finished. */ static void components_to_record (tree gnu_record_type, Node_Id component_list, - tree gnu_field_list, int packed, int definition, - tree *p_gnu_rep_list, int cancel_alignment, int all_rep) + tree gnu_field_list, int packed, bool definition, + tree *p_gnu_rep_list, bool cancel_alignment, + bool all_rep) { Node_Id component_decl; Entity_Id gnat_field; @@ -5266,8 +5247,8 @@ components_to_record (tree gnu_record_type, Node_Id component_list, Node_Id variant; tree gnu_our_rep_list = NULL_TREE; tree gnu_field, gnu_last; - int layout_with_rep = 0; - int all_rep_and_size = all_rep && TYPE_SIZE (gnu_record_type) != 0; + bool layout_with_rep = false; + bool all_rep_and_size = all_rep && TYPE_SIZE (gnu_record_type); /* For each variable within each component declaration create a GCC field and add it to the list, skipping any pragmas in the list. */ @@ -5298,7 +5279,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, } } - save_gnu_tree (gnat_field, gnu_field, 0); + save_gnu_tree (gnat_field, gnu_field, false); } /* At the end of the component list there may be a variant part. */ @@ -5318,7 +5299,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, definition); TREE_CHAIN (gnu_field) = gnu_field_list; gnu_field_list = gnu_field; - save_gnu_tree (gnat_field, gnu_field, 0); + save_gnu_tree (gnat_field, gnu_field, false); } /* We create a QUAL_UNION_TYPE for the variant part since the variants are @@ -5405,7 +5386,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, to these empty variants. */ /* Only make the QUAL_UNION_TYPE if there are any non-empty variants. */ - if (gnu_variant_list != 0) + if (gnu_variant_list) { if (all_rep_and_size) { @@ -5415,7 +5396,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, } finish_record_type (gnu_union_type, nreverse (gnu_variant_list), - all_rep_and_size, 0); + all_rep_and_size, false); gnu_union_field = create_field_decl (gnu_var_name, gnu_union_type, gnu_record_type, @@ -5437,13 +5418,13 @@ components_to_record (tree gnu_record_type, Node_Id component_list, ??? Note: if we then reorder them, debugging information will be wrong, but there's nothing that can be done about this at the moment. */ - for (gnu_field = gnu_field_list, gnu_last = 0; gnu_field; ) + for (gnu_field = gnu_field_list, gnu_last = NULL_TREE; gnu_field; ) { - if (DECL_FIELD_OFFSET (gnu_field) != 0) + if (DECL_FIELD_OFFSET (gnu_field)) { tree gnu_next = TREE_CHAIN (gnu_field); - if (gnu_last == 0) + if (!gnu_last) gnu_field_list = gnu_next; else TREE_CHAIN (gnu_last) = gnu_next; @@ -5464,12 +5445,12 @@ components_to_record (tree gnu_record_type, Node_Id component_list, set it and ignore the items. Otherwise, sort the fields by bit position and put them into their own record if we have any fields without rep clauses. */ - if (gnu_our_rep_list != 0 && p_gnu_rep_list != 0 && ! all_rep) + if (gnu_our_rep_list && p_gnu_rep_list && !all_rep) *p_gnu_rep_list = chainon (*p_gnu_rep_list, gnu_our_rep_list); - else if (gnu_our_rep_list != 0) + else if (gnu_our_rep_list) { tree gnu_rep_type - = gnu_field_list == 0 ? gnu_record_type : make_node (RECORD_TYPE); + = (gnu_field_list ? gnu_record_type : make_node (RECORD_TYPE)); int len = list_length (gnu_our_rep_list); tree *gnu_arr = (tree *) alloca (sizeof (tree) * len); int i; @@ -5493,12 +5474,12 @@ components_to_record (tree gnu_record_type, Node_Id component_list, TREE_CHAIN (gnu_arr[i]) = gnu_our_rep_list; gnu_our_rep_list = gnu_arr[i]; DECL_CONTEXT (gnu_arr[i]) = gnu_rep_type; - DECL_SECTION_NAME (gnu_arr[i]) = 0; + DECL_SECTION_NAME (gnu_arr[i]) = NULL_TREE; } - if (gnu_field_list != 0) + if (gnu_field_list) { - finish_record_type (gnu_rep_type, gnu_our_rep_list, 1, 0); + finish_record_type (gnu_rep_type, gnu_our_rep_list, true, false); gnu_field = create_field_decl (get_identifier ("REP"), gnu_rep_type, gnu_record_type, 0, 0, 0, 1); DECL_INTERNAL_P (gnu_field) = 1; @@ -5506,7 +5487,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, } else { - layout_with_rep = 1; + layout_with_rep = true; gnu_field_list = nreverse (gnu_our_rep_list); } } @@ -5515,7 +5496,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, TYPE_ALIGN (gnu_record_type) = 0; finish_record_type (gnu_record_type, nreverse (gnu_field_list), - layout_with_rep, 0); + layout_with_rep, false); } /* Called via qsort from the above. Returns -1, 1, depending on the @@ -5556,7 +5537,7 @@ annotate_value (tree gnu_size) /* See if we've already saved the value for this node. */ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (gnu_size))) - && TREE_COMPLEXITY (gnu_size) != 0) + && TREE_COMPLEXITY (gnu_size)) return (Node_Ref_Or_Val) TREE_COMPLEXITY (gnu_size); /* If we do not return inside this switch, TCODE will be set to the @@ -5579,7 +5560,7 @@ annotate_value (tree gnu_size) /* The rediculous code below is to handle the case of the largest negative integer. */ tree negative_size = size_diffop (bitsize_zero_node, gnu_size); - int adjust = 0; + bool adjust = false; tree temp; if (TREE_CONSTANT_OVERFLOW (negative_size)) @@ -5588,7 +5569,7 @@ annotate_value (tree gnu_size) = size_binop (MINUS_EXPR, bitsize_zero_node, size_binop (PLUS_EXPR, gnu_size, bitsize_one_node)); - adjust = 1; + adjust = true; } temp = build1 (NEGATE_EXPR, bitsizetype, negative_size); @@ -5598,7 +5579,7 @@ annotate_value (tree gnu_size) return annotate_value (temp); } - if (! host_integerp (gnu_size, 1)) + if (!host_integerp (gnu_size, 1)) return No_Uint; size = tree_low_cst (gnu_size, 1); @@ -5614,7 +5595,7 @@ annotate_value (tree gnu_size) /* The only case we handle here is a simple discriminant reference. */ if (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == PLACEHOLDER_EXPR && TREE_CODE (TREE_OPERAND (gnu_size, 1)) == FIELD_DECL - && DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1)) != 0) + && DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1))) return Create_Node (Discrim_Val, annotate_value (DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1))), @@ -5697,7 +5678,7 @@ annotate_rep (Entity_Id gnat_entity, tree gnu_type) gnat_field = Next_Entity (gnat_field)) if ((Ekind (gnat_field) == E_Component || (Ekind (gnat_field) == E_Discriminant - && ! Is_Unchecked_Union (Scope (gnat_field))))) + && !Is_Unchecked_Union (Scope (gnat_field))))) { tree parent_offset = bitsize_zero_node; @@ -5758,11 +5739,8 @@ annotate_rep (Entity_Id gnat_entity, tree gnu_type) so far. */ static tree -compute_field_positions (tree gnu_type, - tree gnu_list, - tree gnu_pos, - tree gnu_bitpos, - unsigned int offset_align) +compute_field_positions (tree gnu_type, tree gnu_list, tree gnu_pos, + tree gnu_bitpos, unsigned int offset_align) { tree gnu_field; tree gnu_result = gnu_list; @@ -5802,12 +5780,12 @@ compute_field_positions (tree gnu_type, for the size of a field. COMPONENT_P is true if we are being called to process the Component_Size of GNAT_OBJECT. This is used for error message handling and to indicate to use the object size of GNU_TYPE. - ZERO_OK is nonzero if a size of zero is permitted; if ZERO_OK is zero, + ZERO_OK is true if a size of zero is permitted; if ZERO_OK is false, it means that a size of zero should be treated as an unspecified size. */ static tree validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, - enum tree_code kind, int component_p, int zero_ok) + enum tree_code kind, bool component_p, bool zero_ok) { Node_Id gnat_error_node; tree type_size @@ -5827,7 +5805,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, /* Return 0 if no size was specified, either because Esize was not Present or the specified size was zero. */ if (No (uint_size) || uint_size == No_Uint) - return 0; + return NULL_TREE; /* Get the size as a tree. Give an error if a size was specified, but cannot be represented as in sizetype. */ @@ -5837,17 +5815,17 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, post_error_ne (component_p ? "component size of & is too large" : "size of & is too large", gnat_error_node, gnat_object); - return 0; + return NULL_TREE; } + /* Ignore a negative size since that corresponds to our back-annotation. Also ignore a zero size unless a size clause exists. */ - else if (tree_int_cst_sgn (size) < 0 || (integer_zerop (size) && ! zero_ok)) - return 0; + else if (tree_int_cst_sgn (size) < 0 || (integer_zerop (size) && !zero_ok)) + return NULL_TREE; /* The size of objects is always a multiple of a byte. */ if (kind == VAR_DECL - && ! integer_zerop (size_binop (TRUNC_MOD_EXPR, size, - bitsize_unit_node))) + && !integer_zerop (size_binop (TRUNC_MOD_EXPR, size, bitsize_unit_node))) { if (component_p) post_error_ne ("component size for& is not a multiple of Storage_Unit", @@ -5855,7 +5833,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, else post_error_ne ("size for& is not a multiple of Storage_Unit", gnat_error_node, gnat_object); - return 0; + return NULL_TREE; } /* If this is an integral type or a packed array type, the front-end has @@ -5863,7 +5841,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, checking against the bounds). However, if this is an aliased object, it may not be smaller than the type of the object. */ if ((INTEGRAL_TYPE_P (gnu_type) || TYPE_IS_PACKED_ARRAY_TYPE_P (gnu_type)) - && ! (kind == VAR_DECL && Is_Aliased (gnat_object))) + && !(kind == VAR_DECL && Is_Aliased (gnat_object))) return size; /* If the object is a record that contains a template, add the size of @@ -5874,8 +5852,8 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, /* Modify the size of the type to be that of the maximum size if it has a discriminant or the size of a thin pointer if this is a fat pointer. */ - if (type_size != 0 && CONTAINS_PLACEHOLDER_P (type_size)) - type_size = max_size (type_size, 1); + if (type_size && CONTAINS_PLACEHOLDER_P (type_size)) + type_size = max_size (type_size, true); else if (TYPE_FAT_POINTER_P (gnu_type)) type_size = bitsize_int (POINTER_SIZE); @@ -5907,9 +5885,9 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, post_error_ne_tree ("size for& too small{, minimum allowed is ^}", gnat_error_node, gnat_object, type_size); - if (kind == VAR_DECL && ! component_p + if (kind == VAR_DECL && !component_p && TREE_CODE (rm_size (gnu_type)) == INTEGER_CST - && ! tree_int_cst_lt (size, rm_size (gnu_type))) + && !tree_int_cst_lt (size, rm_size (gnu_type))) post_error_ne_tree_2 ("\\size of ^ is not a multiple of alignment (^ bits)", gnat_error_node, gnat_object, rm_size (gnu_type), @@ -5919,7 +5897,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, post_error_ne ("\\size would be legal if & were not aliased!", gnat_error_node, gnat_object); - return 0; + return NULL_TREE; } return size; @@ -5961,13 +5939,13 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) front end will have always set it. */ else if (tree_int_cst_sgn (size) < 0 || (integer_zerop (size) && No (gnat_attr_node) - && ! Has_Size_Clause (gnat_entity) - && ! Is_Discrete_Or_Fixed_Point_Type (gnat_entity))) + && !Has_Size_Clause (gnat_entity) + && !Is_Discrete_Or_Fixed_Point_Type (gnat_entity))) return; /* If the old size is self-referential, get the maximum size. */ if (CONTAINS_PLACEHOLDER_P (old_size)) - old_size = max_size (old_size, 1); + old_size = max_size (old_size, true); /* If the size of the object is a constant, the new size must not be smaller (the front end checks this for scalar types). */ @@ -5993,7 +5971,7 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) else if ((TREE_CODE (gnu_type) == RECORD_TYPE || TREE_CODE (gnu_type) == UNION_TYPE || TREE_CODE (gnu_type) == QUAL_UNION_TYPE) - && ! TYPE_IS_FAT_POINTER_P (gnu_type)) + && !TYPE_IS_FAT_POINTER_P (gnu_type)) SET_TYPE_ADA_SIZE (gnu_type, size); } @@ -6003,14 +5981,14 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) we are making a biased type. */ static tree -make_type_from_size (tree type, tree size_tree, int biased_p) +make_type_from_size (tree type, tree size_tree, bool biased_p) { tree new_type; unsigned HOST_WIDE_INT size; /* If size indicates an error, just return TYPE to avoid propagating the error. Likewise if it's too large to represent. */ - if (size_tree == 0 || ! host_integerp (size_tree, 1)) + if (!size_tree || !host_integerp (size_tree, 1)) return type; size = tree_low_cst (size_tree, 1); @@ -6028,8 +6006,7 @@ make_type_from_size (tree type, tree size_tree, int biased_p) size = MIN (size, LONG_LONG_TYPE_SIZE); new_type = make_signed_type (size); - TREE_TYPE (new_type) - = TREE_TYPE (type) != 0 ? TREE_TYPE (type) : type; + TREE_TYPE (new_type) = TREE_TYPE (type) ? TREE_TYPE (type) : type; TYPE_MIN_VALUE (new_type) = convert (TREE_TYPE (new_type), TYPE_MIN_VALUE (type)); TYPE_MAX_VALUE (new_type) @@ -6101,8 +6078,8 @@ validate_alignment (Uint alignment, Entity_Id gnat_entity, unsigned int align) post_error_ne_num ("largest supported alignment for& is ^", gnat_error_node, gnat_entity, MAX_OFILE_ALIGNMENT / BITS_PER_UNIT); - else if (! (Present (Alignment_Clause (gnat_entity)) - && From_At_Mod (Alignment_Clause (gnat_entity))) + else if (!(Present (Alignment_Clause (gnat_entity)) + && From_At_Mod (Alignment_Clause (gnat_entity))) && new_align * BITS_PER_UNIT < align) post_error_ne_num ("alignment for& must be at least ^", gnat_error_node, gnat_entity, @@ -6114,11 +6091,11 @@ validate_alignment (Uint alignment, Entity_Id gnat_entity, unsigned int align) } /* Verify that OBJECT, a type or decl, is something we can implement - atomically. If not, give an error for GNAT_ENTITY. COMP_P is nonzero + atomically. If not, give an error for GNAT_ENTITY. COMP_P is true if we require atomic components. */ static void -check_ok_for_atomic (tree object, Entity_Id gnat_entity, int comp_p) +check_ok_for_atomic (tree object, Entity_Id gnat_entity, bool comp_p) { Node_Id gnat_error_point = gnat_entity; Node_Id gnat_node; @@ -6161,7 +6138,7 @@ check_ok_for_atomic (tree object, Entity_Id gnat_entity, int comp_p) /* For the moment, also allow anything that has an alignment equal to its size and which is smaller than a word. */ - if (size != 0 && TREE_CODE (size) == INTEGER_CST + if (size && TREE_CODE (size) == INTEGER_CST && compare_tree_int (size, align) == 0 && align <= BITS_PER_WORD) return; @@ -6169,7 +6146,7 @@ check_ok_for_atomic (tree object, Entity_Id gnat_entity, int comp_p) for (gnat_node = First_Rep_Item (gnat_entity); Present (gnat_node); gnat_node = Next_Rep_Item (gnat_node)) { - if (! comp_p && Nkind (gnat_node) == N_Pragma + if (!comp_p && Nkind (gnat_node) == N_Pragma && Get_Pragma_Id (Chars (gnat_node)) == Pragma_Atomic) gnat_error_point = First (Pragma_Argument_Associations (gnat_node)); else if (comp_p && Nkind (gnat_node) == N_Pragma @@ -6207,8 +6184,8 @@ gnat_substitute_in_type (tree t, tree f, tree r) if (CONTAINS_PLACEHOLDER_P (TYPE_MIN_VALUE (t)) || CONTAINS_PLACEHOLDER_P (TYPE_MAX_VALUE (t))) { - tree low = substitute_in_expr (TYPE_MIN_VALUE (t), f, r); - tree high = substitute_in_expr (TYPE_MAX_VALUE (t), f, r); + tree low = SUBSTITUTE_IN_EXPR (TYPE_MIN_VALUE (t), f, r); + tree high = SUBSTITUTE_IN_EXPR (TYPE_MAX_VALUE (t), f, r); if (low == TYPE_MIN_VALUE (t) && high == TYPE_MAX_VALUE (t)) return t; @@ -6223,17 +6200,15 @@ gnat_substitute_in_type (tree t, tree f, tree r) return t; case REAL_TYPE: - if ((TYPE_MIN_VALUE (t) != 0 - && CONTAINS_PLACEHOLDER_P (TYPE_MIN_VALUE (t))) - || (TYPE_MAX_VALUE (t) != 0 - && CONTAINS_PLACEHOLDER_P (TYPE_MAX_VALUE (t)))) + if (CONTAINS_PLACEHOLDER_P (TYPE_MIN_VALUE (t)) + || CONTAINS_PLACEHOLDER_P (TYPE_MAX_VALUE (t))) { - tree low = 0, high = 0; + tree low = NULL_TREE, high = NULL_TREE; if (TYPE_MIN_VALUE (t)) - low = substitute_in_expr (TYPE_MIN_VALUE (t), f, r); + low = SUBSTITUTE_IN_EXPR (TYPE_MIN_VALUE (t), f, r); if (TYPE_MAX_VALUE (t)) - high = substitute_in_expr (TYPE_MAX_VALUE (t), f, r); + high = SUBSTITUTE_IN_EXPR (TYPE_MAX_VALUE (t), f, r); if (low == TYPE_MIN_VALUE (t) && high == TYPE_MAX_VALUE (t)) return t; @@ -6282,10 +6257,10 @@ gnat_substitute_in_type (tree t, tree f, tree r) case QUAL_UNION_TYPE: { tree field; - int changed_field - = (f == NULL_TREE && ! TREE_CONSTANT (TYPE_SIZE (t))); - int field_has_rep = 0; - tree last_field = 0; + bool changed_field + = (f == NULL_TREE && !TREE_CONSTANT (TYPE_SIZE (t))); + bool field_has_rep = false; + tree last_field = NULL_TREE; tree new = copy_type (t); @@ -6293,21 +6268,20 @@ gnat_substitute_in_type (tree t, tree f, tree r) in. If we haven't actually changed the type of any field, discard everything we've done and return the old type. */ - TYPE_FIELDS (new) = 0; - TYPE_SIZE (new) = 0; + TYPE_FIELDS (new) = NULL_TREE; + TYPE_SIZE (new) = NULL_TREE; - for (field = TYPE_FIELDS (t); field; - field = TREE_CHAIN (field)) + for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field)) { tree new_field = copy_node (field); TREE_TYPE (new_field) = gnat_substitute_in_type (TREE_TYPE (new_field), f, r); - if (DECL_HAS_REP_P (field) && ! DECL_INTERNAL_P (field)) - field_has_rep = 1; + if (DECL_HAS_REP_P (field) && !DECL_INTERNAL_P (field)) + field_has_rep = true; else if (TREE_TYPE (new_field) != TREE_TYPE (field)) - changed_field = 1; + changed_field = true; /* If this is an internal field and the type of this field is a UNION_TYPE or RECORD_TYPE with no elements, ignore it. If @@ -6318,10 +6292,10 @@ gnat_substitute_in_type (tree t, tree f, tree r) && (TREE_CODE (TREE_TYPE (new_field)) == UNION_TYPE || TREE_CODE (TREE_TYPE (new_field)) == RECORD_TYPE)) { - if (TYPE_FIELDS (TREE_TYPE (new_field)) == 0) + if (!TYPE_FIELDS (TREE_TYPE (new_field))) continue; - if (TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (new_field))) == 0) + if (!TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (new_field)))) { tree next_new_field = copy_node (TYPE_FIELDS (TREE_TYPE (new_field))); @@ -6335,7 +6309,7 @@ gnat_substitute_in_type (tree t, tree f, tree r) DECL_CONTEXT (new_field) = new; SET_DECL_ORIGINAL_FIELD (new_field, - (DECL_ORIGINAL_FIELD (field) != 0 + (DECL_ORIGINAL_FIELD (field) ? DECL_ORIGINAL_FIELD (field) : field)); /* If the size of the old field was set at a constant, @@ -6345,17 +6319,17 @@ gnat_substitute_in_type (tree t, tree f, tree r) record.) */ DECL_SIZE (new_field) = TREE_CODE (DECL_SIZE (field)) == INTEGER_CST - ? DECL_SIZE (field) : 0; + ? DECL_SIZE (field) : NULL_TREE; DECL_SIZE_UNIT (new_field) = TREE_CODE (DECL_SIZE_UNIT (field)) == INTEGER_CST - ? DECL_SIZE_UNIT (field) : 0; + ? DECL_SIZE_UNIT (field) : NULL_TREE; if (TREE_CODE (t) == QUAL_UNION_TYPE) { - tree new_q = substitute_in_expr (DECL_QUALIFIER (field), f, r); + tree new_q = SUBSTITUTE_IN_EXPR (DECL_QUALIFIER (field), f, r); if (new_q != DECL_QUALIFIER (new_field)) - changed_field = 1; + changed_field = true; /* Do the substitution inside the qualifier and if we find that this field will not be present, omit it. */ @@ -6365,7 +6339,7 @@ gnat_substitute_in_type (tree t, tree f, tree r) continue; } - if (last_field == 0) + if (!last_field) TYPE_FIELDS (new) = new_field; else TREE_CHAIN (last_field) = new_field; @@ -6382,19 +6356,19 @@ gnat_substitute_in_type (tree t, tree f, tree r) /* If this used to be a qualified union type, but we now know what field will be present, make this a normal union. */ if (changed_field && TREE_CODE (new) == QUAL_UNION_TYPE - && (TYPE_FIELDS (new) == 0 + && (!TYPE_FIELDS (new) || integer_onep (DECL_QUALIFIER (TYPE_FIELDS (new))))) TREE_SET_CODE (new, UNION_TYPE); - else if (! changed_field) + else if (!changed_field) return t; if (field_has_rep) - gigi_abort (117); + abort (); layout_type (new); /* If the size was originally a constant use it. */ - if (TYPE_SIZE (t) != 0 && TREE_CODE (TYPE_SIZE (t)) == INTEGER_CST + if (TYPE_SIZE (t) && TREE_CODE (TYPE_SIZE (t)) == INTEGER_CST && TREE_CODE (TYPE_SIZE (new)) != INTEGER_CST) { TYPE_SIZE (new) = TYPE_SIZE (t); @@ -6419,7 +6393,7 @@ rm_size (tree gnu_type) /* For integer types, this is the precision. For record types, we store the size explicitly. For other types, this is just the size. */ - if (INTEGRAL_TYPE_P (gnu_type) && TYPE_RM_SIZE (gnu_type) != 0) + if (INTEGRAL_TYPE_P (gnu_type) && TYPE_RM_SIZE (gnu_type)) return TYPE_RM_SIZE (gnu_type); else if (TREE_CODE (gnu_type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (gnu_type)) @@ -6431,8 +6405,8 @@ rm_size (tree gnu_type) else if ((TREE_CODE (gnu_type) == RECORD_TYPE || TREE_CODE (gnu_type) == UNION_TYPE || TREE_CODE (gnu_type) == QUAL_UNION_TYPE) - && ! TYPE_IS_FAT_POINTER_P (gnu_type) - && TYPE_ADA_SIZE (gnu_type) != 0) + && !TYPE_IS_FAT_POINTER_P (gnu_type) + && TYPE_ADA_SIZE (gnu_type)) return TYPE_ADA_SIZE (gnu_type); else return TYPE_SIZE (gnu_type); @@ -6445,7 +6419,7 @@ rm_size (tree gnu_type) tree create_concat_name (Entity_Id gnat_entity, const char *suffix) { - const char *str = (suffix == 0 ? "" : suffix); + const char *str = (!suffix ? "" : suffix); String_Template temp = {1, strlen (str)}; Fat_Pointer fp = {str, &temp}; @@ -6456,7 +6430,6 @@ create_concat_name (Entity_Id gnat_entity, const char *suffix) on a Windows box) live in a DLL. Here we adjust its name to use the jump-table, the _imp__NAME contains the address for the NAME variable. */ - { Entity_Kind kind = Ekind (gnat_entity); const char *prefix = "_imp__"; diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 1eab6ef7c9e..7bc0a762f52 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -34,6 +34,7 @@ with Exp_Util; use Exp_Util; with Exp_Ch3; use Exp_Ch3; with Exp_Ch7; use Exp_Ch7; with Exp_Ch9; use Exp_Ch9; +with Exp_Tss; use Exp_Tss; with Freeze; use Freeze; with Hostparm; use Hostparm; with Itypes; use Itypes; @@ -823,14 +824,17 @@ package body Exp_Aggr is if not Present (Expr) then - Append_List_To (L, + if Present (Base_Init_Proc (Etype (Ctype))) + or else Has_Task (Base_Type (Ctype)) + then + Append_List_To (L, Build_Initialization_Call (Loc, Id_Ref => Indexed_Comp, Typ => Ctype, With_Default_Init => True)); + end if; else - -- Now generate the assignment with no associated controlled -- actions since the target of the assignment may not have -- been initialized, it is not possible to Finalize it as diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 7e51ca3ed9c..d1a7bbcd803 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -54,7 +54,6 @@ with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Sinfo; use Sinfo; -with Sinfo.CN; use Sinfo.CN; with Snames; use Snames; with Stand; use Stand; with Targparm; use Targparm; @@ -521,7 +520,17 @@ package body Exp_Ch4 is -- Normal case, not a secondary stack allocation else - Flist := Find_Final_List (PtrT); + if Controlled_Type (T) + and then Ekind (PtrT) = E_Anonymous_Access_Type + then + -- Create local finalization list for access parameter. + + Flist := + Get_Allocator_Final_List (N, Base_Type (T), PtrT); + else + Flist := Find_Final_List (PtrT); + end if; + Attach := Make_Integer_Literal (Loc, 2); end if; @@ -6108,8 +6117,16 @@ package body Exp_Ch4 is Condition => Cond, Reason => CE_Tag_Check_Failed)); - Change_Conversion_To_Unchecked (N); - Analyze_And_Resolve (N, Target_Type); + declare + Conv : Node_Id; + begin + Conv := + Make_Unchecked_Type_Conversion (Loc, + Subtype_Mark => New_Occurrence_Of (Target_Type, Loc), + Expression => Relocate_Node (Expression (N))); + Rewrite (N, Conv); + Analyze_And_Resolve (N, Target_Type); + end; end if; end; diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index 78a2f2b6f73..8d0917435d6 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -46,11 +46,11 @@ extern tree emit_stack_check (tree); /* GNU_TYPE is a type. Determine if it should be passed by reference by default. */ -extern int default_pass_by_ref (tree); +extern bool default_pass_by_ref (tree); /* GNU_TYPE is the type of a subprogram parameter. Determine from the type if it should be passed by reference. */ -extern int must_pass_by_ref (tree); +extern bool must_pass_by_ref (tree); /* Elaboration routines for the front end. */ extern void elab_all_gnat (void); @@ -145,7 +145,7 @@ extern tree create_concat_name (Entity_Id, const char *); /* If true, then gigi is being called on an analyzed but unexpanded tree, and the only purpose of the call is to properly annotate types with representation information. */ -extern int type_annotate_only; +extern bool type_annotate_only; /* Current file name without path */ extern const char *ref_filename; @@ -169,9 +169,6 @@ extern void gnat_expand_stmt (tree); extern int gnat_gimplify_expr (tree *, tree *, tree *); -/* Expand the body of GNU_DECL, which is not a nested function. */ -extern void gnat_expand_body (tree); - /* Do the processing for the declaration of a GNAT_ENTITY, a type. If a separate Freeze node exists, delay the bulk of the processing. Otherwise make a GCC type for GNAT_ENTITY and set up the correspondance. */ @@ -215,12 +212,6 @@ extern void set_second_error_entity (Entity_Id); /* Protect EXP from multiple evaluation. This may make a SAVE_EXPR. */ extern tree protect_multiple_eval (tree); -/* Signal abort, with "Gigi abort" as the error label, and error_gnat_node - as the relevant node that provides the location info for the error. - The single parameter CODE is an integer code that is included in the - additional error message generated. */ -extern void gigi_abort (int) ATTRIBUTE_NORETURN; - /* Initialize the table that maps GNAT codes to GCC codes for simple binary and unary operations. */ extern void init_code_table (void); @@ -232,8 +223,7 @@ extern Node_Id error_gnat_node; /* This is equivalent to stabilize_reference in GCC's tree.c, but we know how to handle our new nodes and we take an extra argument that says whether to force evaluation of everything. */ - -extern tree gnat_stabilize_reference (tree, int); +extern tree gnat_stabilize_reference (tree, bool); /* Highest number in the front-end node table. */ extern int max_gnat_nodes; @@ -427,7 +417,7 @@ extern tree convert (tree, tree); GNAT_ENTITY. Such gnu tree node is always an ..._DECL node. If NO_CHECK is nonzero, the latter check is suppressed. If GNU_DECL is zero, a previous association is to be reset. */ -extern void save_gnu_tree (Entity_Id, tree, int); +extern void save_gnu_tree (Entity_Id, tree, bool); /* GNAT_ENTITY is a GNAT tree node for a defining identifier. Return the ..._DECL node that was associated with it. If there is no tree @@ -435,29 +425,29 @@ extern void save_gnu_tree (Entity_Id, tree, int); extern tree get_gnu_tree (Entity_Id); /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */ -extern int present_gnu_tree (Entity_Id); +extern bool present_gnu_tree (Entity_Id); /* Initialize tables for above routines. */ extern void init_gnat_to_gnu (void); /* Given a record type (RECORD_TYPE) and a chain of FIELD_DECL nodes (FIELDLIST), finish constructing the record or union type. - If HAS_REP is nonzero, this record has a rep clause; don't call + If HAS_REP is true, this record has a rep clause; don't call layout_type but merely set the size and alignment ourselves. - If DEFER_DEBUG is nonzero, do not call the debugging routines + If DEFER_DEBUG is true, do not call the debugging routines on this type; it will be done later. */ -extern void finish_record_type (tree, tree, int, int); +extern void finish_record_type (tree, tree, bool, bool); /* Returns a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the subprogram. If it is void_type_node, then we are dealing with a procedure, otherwise we are dealing with a function. PARAM_DECL_LIST is a list of PARM_DECL nodes that are the subprogram arguments. CICO_LIST is the copy-in/copy-out list to be stored into TYPE_CI_CO_LIST. - RETURNS_UNCONSTRAINED is nonzero if the function returns an unconstrained - object. RETURNS_BY_REF is nonzero if the function returns by reference. - RETURNS_WITH_DSP is nonzero if the function is to return with a + RETURNS_UNCONSTRAINED is true if the function returns an unconstrained + object. RETURNS_BY_REF is true if the function returns by reference. + RETURNS_WITH_DSP is true if the function is to return with a depressed stack pointer. */ -extern tree create_subprog_type (tree, tree, tree, int, int, int); +extern tree create_subprog_type (tree, tree, tree, bool, bool, bool); /* Return a copy of TYPE, but safe to modify in any way. */ extern tree copy_type (tree); @@ -468,58 +458,36 @@ extern tree create_index_type (tree, tree, tree); /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type (a character string) and TYPE is a ..._TYPE node giving its data type. - ARTIFICIAL_P is nonzero if this is a declaration that was generated - by the compiler. DEBUG_INFO_P is nonzero if we need to write debugging + ARTIFICIAL_P is true if this is a declaration that was generated + by the compiler. DEBUG_INFO_P is true if we need to write debugging information about this type. GNAT_NODE is used for the position of the decl. */ -extern tree create_type_decl (tree, tree, struct attrib *, int, int, Node_Id); +extern tree create_type_decl (tree, tree, struct attrib *, bool, bool, + Node_Id); /* Returns a GCC VAR_DECL node. VAR_NAME gives the name of the variable. ASM_NAME is its assembler name (if provided). TYPE is its data type (a GCC ..._TYPE node). VAR_INIT is the GCC tree for an optional initial expression; NULL_TREE if none. - CONST_FLAG is nonzero if this variable is constant. + CONST_FLAG is true if this variable is constant. - PUBLIC_FLAG is nonzero if this definition is to be made visible outside of + PUBLIC_FLAG is true if this definition is to be made visible outside of the current compilation unit. This flag should be set when processing the variable definitions in a package specification. EXTERN_FLAG is nonzero when processing an external variable declaration (as opposed to a definition: no storage is to be allocated for the variable here). + STATIC_FLAG is only relevant when not at top level. In that case it indicates whether to always allocate storage to the variable. GNAT_NODE is used for the position of the decl. */ -extern tree create_var_decl (tree, tree, tree, tree, int, int, int, int, +extern tree create_var_decl (tree, tree, tree, tree, bool, bool, bool, bool, struct attrib *, Node_Id); /* Given a DECL and ATTR_LIST, apply the listed attributes. */ extern void process_attributes (tree, struct attrib *); -/* Obtain any pending elaborations and clear the old list. */ -extern tree get_pending_elaborations (void); - -/* Return nonzero if there are pending elaborations. */ -extern int pending_elaborations_p (void); - -/* Save a copy of the current pending elaboration list and make a new - one. */ -extern void push_pending_elaborations (void); - -/* Pop the stack of pending elaborations. */ -extern void pop_pending_elaborations (void); - -/* Return the current position in pending_elaborations so we can insert - elaborations after that point. */ -extern tree get_elaboration_location (void); - -/* Insert the current elaborations after ELAB, which is in some elaboration - list. */ -extern void insert_elaboration_list (tree); - -/* Add some pending elaborations to the current list. */ -extern void add_pending_elaborations (tree, tree); - /* Returns a FIELD_DECL node. FIELD_NAME the field name, FIELD_TYPE is its type, and RECORD_TYPE is the type of the parent. PACKED is nonzero if this field is in a record type with a "pragma pack". If SIZE is nonzero @@ -529,10 +497,10 @@ extern void add_pending_elaborations (tree, tree); extern tree create_field_decl (tree, tree, tree, int, tree, tree, int); /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter, - PARAM_TYPE is its type. READONLY is nonzero if the parameter is + PARAM_TYPE is its type. READONLY is true if the parameter is readonly (either an IN parameter or an address of a pass-by-ref parameter). */ -extern tree create_param_decl (tree, tree, int); +extern tree create_param_decl (tree, tree, bool); /* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram, ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE @@ -540,8 +508,8 @@ extern tree create_param_decl (tree, tree, int); PARM_DECL nodes chained through the TREE_CHAIN field). INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the - appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */ -extern tree create_subprog_decl (tree, tree, tree, tree, int, int, int, + appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */ +extern tree create_subprog_decl (tree, tree, tree, tree, bool, bool, bool, struct attrib *, Node_Id); /* Returns a LABEL_DECL node for LABEL_NAME. */ @@ -586,14 +554,14 @@ extern void update_pointer_to (tree, tree); /* EXP is an expression for the size of an object. If this size contains discriminant references, replace them with the maximum (if MAX_P) or - minimum (if ! MAX_P) possible value of the discriminant. */ -extern tree max_size (tree, int); + minimum (if !MAX_P) possible value of the discriminant. */ +extern tree max_size (tree, bool); /* Remove all conversions that are done in EXP. This includes converting from a padded type or to a left-justified modular type. If TRUE_ADDRESS - is nonzero, always return the address of the containing object even if + is true, always return the address of the containing object even if the address is not bit-aligned. */ -extern tree remove_conversions (tree, int); +extern tree remove_conversions (tree, bool); /* If EXP's type is an UNCONSTRAINED_ARRAY_TYPE, return an expression that refers to the underlying array. If its type has TYPE_CONTAINS_TEMPLATE_P, @@ -601,8 +569,8 @@ extern tree remove_conversions (tree, int); extern tree maybe_unconstrained_array (tree); /* Return an expression that does an unchecked converstion of EXPR to TYPE. - If NOTRUNC_P is set, truncation operations should be suppressed. */ -extern tree unchecked_convert (tree, tree, int); + If NOTRUNC_P is true, truncation operations should be suppressed. */ +extern tree unchecked_convert (tree, tree, bool); /* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical operation. @@ -664,7 +632,7 @@ extern tree gnat_build_constructor (tree, tree); /* Return a COMPONENT_REF to access a field that is given by COMPONENT, an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL, for the field, or both. Don't fold the result if NO_FOLD_P. */ -extern tree build_component_ref (tree, tree, tree, int); +extern tree build_component_ref (tree, tree, tree, bool); /* Build a GCC tree to call an allocation or deallocation function. If GNU_OBJ is nonzero, it is an object to deallocate. Otherwise, diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index fe29ca4e578..91b582a7331 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -1137,6 +1137,148 @@ begin Exec_Path : String_Access; begin + -- First deal with built-in command(s) + + if The_Command = Setup then + Process_Setup : + declare + Arg_Num : Positive := 1; + Argv : String_Access; + + begin + while Arg_Num <= Last_Switches.Last loop + Argv := Last_Switches.Table (Arg_Num); + + if Argv (Argv'First) /= '-' then + Fail ("invalid parameter """, Argv.all, """"); + + else + if Argv'Length = 1 then + Fail + ("switch character cannot be followed by a blank"); + end if; + + -- -vPx Specify verbosity while parsing project files + + if Argv'Length = 4 + and then Argv (Argv'First + 1 .. Argv'First + 2) = "vP" + then + case Argv (Argv'Last) is + when '0' => + Current_Verbosity := Prj.Default; + when '1' => + Current_Verbosity := Prj.Medium; + when '2' => + Current_Verbosity := Prj.High; + when others => + Fail ("Invalid switch: ", Argv.all); + end case; + + -- -Pproject_file Specify project file to be used + + elsif Argv (Argv'First + 1) = 'P' then + + -- Only one -P switch can be used + + if Project_File /= null then + Fail + (Argv.all, + ": second project file forbidden (first is """, + Project_File.all & """)"); + + elsif Argv'Length = 2 then + + -- There is space between -P and the project file + -- name. -P cannot be the last option. + + if Arg_Num = Last_Switches.Last then + Fail ("project file name missing after -P"); + + else + Arg_Num := Arg_Num + 1; + Argv := Last_Switches.Table (Arg_Num); + + -- After -P, there must be a project file name, + -- not another switch. + + if Argv (Argv'First) = '-' then + Fail ("project file name missing after -P"); + + else + Project_File := new String'(Argv.all); + end if; + end if; + + else + -- No space between -P and project file name + + Project_File := + new String'(Argv (Argv'First + 2 .. Argv'Last)); + end if; + + -- -Xexternal=value Specify an external reference to be + -- used in project files + + elsif Argv'Length >= 5 + and then Argv (Argv'First + 1) = 'X' + then + declare + Equal_Pos : constant Natural := + Index ('=', Argv (Argv'First + 2 .. Argv'Last)); + begin + if Equal_Pos >= Argv'First + 3 and then + Equal_Pos /= Argv'Last then + Add + (External_Name => + Argv (Argv'First + 2 .. Equal_Pos - 1), + Value => Argv (Equal_Pos + 1 .. Argv'Last)); + else + Fail + (Argv.all, + " is not a valid external assignment."); + end if; + end; + + elsif Argv.all = "-v" then + Verbose_Mode := True; + + elsif Argv.all = "-q" then + Quiet_Output := True; + + else + Fail ("invalid parameter """, Argv.all, """"); + end if; + end if; + + Arg_Num := Arg_Num + 1; + end loop; + + if Project_File = null then + Fail ("no project file specified"); + end if; + + Setup_Projects := True; + + Prj.Pars.Set_Verbosity (To => Current_Verbosity); + + -- Missing directories are created during processing of the + -- project tree. + + Prj.Pars.Parse + (Project => Project, + Project_File_Name => Project_File.all, + Packages_To_Check => All_Packages); + + if Project = Prj.No_Project then + Fail ("""", Project_File.all, """ processing failed"); + end if; + + -- Processing is done + + return; + end Process_Setup; + end if; + -- Locate the executable for the command Exec_Path := Locate_Exec_On_Path (Program); diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 8cc960a9bf5..8260ebdb301 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -4344,18 +4344,31 @@ package body Make is not MLib.Tgt.Library_Exists_For (Proj); if Projects.Table (Proj).Need_To_Build_Lib then - if Verbose_Mode then - Write_Str - ("Library file does not exist for project """); - Write_Str - (Get_Name_String (Projects.Table (Proj).Name)); - Write_Line (""""); - end if; + -- If there is no object directory, then it will be + -- impossible to build the library. So, we fail + -- immediately. - Insert_Project_Sources - (The_Project => Proj, - All_Projects => False, - Into_Q => True); + if Projects.Table (Proj).Object_Directory = No_Name then + Make_Failed + ("no object files to build library for project """, + Get_Name_String (Projects.Table (Proj).Name), + """"); + Projects.Table (Proj).Need_To_Build_Lib := False; + + else + if Verbose_Mode then + Write_Str + ("Library file does not exist for project """); + Write_Str + (Get_Name_String (Projects.Table (Proj).Name)); + Write_Line (""""); + end if; + + Insert_Project_Sources + (The_Project => Proj, + All_Projects => False, + Into_Q => True); + end if; end if; end if; end loop; diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index a22815c7952..9aef623ed4e 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -101,6 +101,7 @@ static int gnat_eh_type_covers (tree, tree); static void gnat_parse_file (int); static rtx gnat_expand_expr (tree, rtx, enum machine_mode, int, rtx *); +static void gnat_expand_body (tree); static void internal_error_function (const char *, va_list *); static void gnat_adjust_rli (record_layout_info); static tree gnat_type_max_size (tree); @@ -117,54 +118,51 @@ static tree gnat_type_max_size (tree); #define LANG_HOOKS_INIT_OPTIONS gnat_init_options #undef LANG_HOOKS_HANDLE_OPTION #define LANG_HOOKS_HANDLE_OPTION gnat_handle_option -#undef LANG_HOOKS_POST_OPTIONS +#undef LANG_HOOKS_POST_OPTIONS #define LANG_HOOKS_POST_OPTIONS gnat_post_options -#undef LANG_HOOKS_PARSE_FILE +#undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE gnat_parse_file -#undef LANG_HOOKS_HONOR_READONLY +#undef LANG_HOOKS_HONOR_READONLY #define LANG_HOOKS_HONOR_READONLY true -#undef LANG_HOOKS_HASH_TYPES +#undef LANG_HOOKS_HASH_TYPES #define LANG_HOOKS_HASH_TYPES false -#undef LANG_HOOKS_GETDECLS +#undef LANG_HOOKS_GETDECLS #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v -#undef LANG_HOOKS_PUSHDECL +#undef LANG_HOOKS_PUSHDECL #define LANG_HOOKS_PUSHDECL lhd_return_tree -#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL +#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #define LANG_HOOKS_FINISH_INCOMPLETE_DECL gnat_finish_incomplete_decl -#undef LANG_HOOKS_GET_ALIAS_SET +#undef LANG_HOOKS_GET_ALIAS_SET #define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set -#undef LANG_HOOKS_EXPAND_EXPR +#undef LANG_HOOKS_EXPAND_EXPR #define LANG_HOOKS_EXPAND_EXPR gnat_expand_expr -#undef LANG_HOOKS_MARK_ADDRESSABLE +#undef LANG_HOOKS_MARK_ADDRESSABLE #define LANG_HOOKS_MARK_ADDRESSABLE gnat_mark_addressable -#undef LANG_HOOKS_TRUTHVALUE_CONVERSION +#undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION gnat_truthvalue_conversion -#undef LANG_HOOKS_PRINT_DECL +#undef LANG_HOOKS_PRINT_DECL #define LANG_HOOKS_PRINT_DECL gnat_print_decl -#undef LANG_HOOKS_PRINT_TYPE +#undef LANG_HOOKS_PRINT_TYPE #define LANG_HOOKS_PRINT_TYPE gnat_print_type -#undef LANG_HOOKS_TYPES_COMPATIBLE_P +#undef LANG_HOOKS_TYPES_COMPATIBLE_P #define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p -#undef LANG_HOOKS_TYPE_MAX_SIZE +#undef LANG_HOOKS_TYPE_MAX_SIZE #define LANG_HOOKS_TYPE_MAX_SIZE gnat_type_max_size -#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#undef LANG_HOOKS_DECL_PRINTABLE_NAME #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name -#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION +#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gnat_expand_body -#undef LANG_HOOKS_RTL_EXPAND_STMT -#define LANG_HOOKS_RTL_EXPAND_STMT gnat_expand_stmt -#undef LANG_HOOKS_GIMPLIFY_EXPR -#define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr - -#undef LANG_HOOKS_TYPE_FOR_MODE +#undef LANG_HOOKS_GIMPLIFY_EXPR +#define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr +#undef LANG_HOOKS_TYPE_FOR_MODE #define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode -#undef LANG_HOOKS_TYPE_FOR_SIZE +#undef LANG_HOOKS_TYPE_FOR_SIZE #define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size -#undef LANG_HOOKS_SIGNED_TYPE +#undef LANG_HOOKS_SIGNED_TYPE #define LANG_HOOKS_SIGNED_TYPE gnat_signed_type -#undef LANG_HOOKS_UNSIGNED_TYPE +#undef LANG_HOOKS_UNSIGNED_TYPE #define LANG_HOOKS_UNSIGNED_TYPE gnat_unsigned_type -#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE +#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gnat_signed_or_unsigned_type const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -377,7 +375,7 @@ internal_error_function (const char *msgid, va_list *ap) vsprintf (buffer, msgid, *ap); /* Go up to the first newline. */ - for (p = buffer; *p != 0; p++) + for (p = buffer; *p; p++) if (*p == '\n') { *p = '\0'; @@ -427,7 +425,7 @@ gnat_init (void) static void gnat_finish_incomplete_decl (tree dont_care ATTRIBUTE_UNUSED) { - gigi_abort (202); + abort (); } /* Compute the alignment of the largest mode that can be used for copying @@ -639,12 +637,23 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, /* ... fall through ... */ default: - gigi_abort (201); + abort (); } return expand_expr_real (new, target, tmode, modifier, alt_rtl); } +/* Generate the RTL for the body of GNU_DECL. */ + +static void +gnat_expand_body (tree gnu_decl) +{ + if (!DECL_INITIAL (gnu_decl) || DECL_INITIAL (gnu_decl) == error_mark_node) + return; + + tree_rest_of_compilation (gnu_decl, false); +} + /* Adjusts the RLI used to layout a record after all the fields have been added. We only handle the packed case and cause it to use the alignment that will pad the record at the end. */ @@ -724,13 +733,13 @@ static tree gnat_type_max_size (gnu_type) tree gnu_type; { - return max_size (TYPE_SIZE_UNIT (gnu_type), 1); + return max_size (TYPE_SIZE_UNIT (gnu_type), true); } /* GNU_TYPE is a type. Determine if it should be passed by reference by default. */ -int +bool default_pass_by_ref (tree gnu_type) { /* We pass aggregates by reference if they are sufficiently large. The @@ -747,7 +756,7 @@ default_pass_by_ref (tree gnu_type) return true; if (AGGREGATE_TYPE_P (gnu_type) - && (! host_integerp (TYPE_SIZE (gnu_type), 1) + && (!host_integerp (TYPE_SIZE (gnu_type), 1) || 0 < compare_tree_int (TYPE_SIZE (gnu_type), 8 * TYPE_ALIGN (gnu_type)))) return true; @@ -758,7 +767,7 @@ default_pass_by_ref (tree gnu_type) /* GNU_TYPE is the type of a subprogram parameter. Determine from the type if it should be passed by reference. */ -int +bool must_pass_by_ref (tree gnu_type) { /* We pass only unconstrained objects, those required by the language @@ -768,7 +777,7 @@ must_pass_by_ref (tree gnu_type) not have such objects. */ return (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE || (AGGREGATE_TYPE_P (gnu_type) && TYPE_BY_REFERENCE_P (gnu_type)) - || (TYPE_SIZE (gnu_type) != 0 + || (TYPE_SIZE (gnu_type) && TREE_CODE (TYPE_SIZE (gnu_type)) != INTEGER_CST)); } diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb index b2079be7a9c..8ff9b87599f 100644 --- a/gcc/ada/mlib-prj.adb +++ b/gcc/ada/mlib-prj.adb @@ -1556,7 +1556,13 @@ package body MLib.Prj is Data : constant Project_Data := Projects.Table (For_Project); begin - if Data.Library and not Data.Need_To_Build_Lib then + -- No need to build the library if there is no object directory, + -- hence no object files to build the library. + + if Data.Library + and then not Data.Need_To_Build_Lib + and then Data.Object_Directory /= No_Name + then declare Current : constant Dir_Name_Str := Get_Current_Dir; Lib_Name : constant Name_Id := Library_File_Name_For (For_Project); diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index f7ca5e2d849..25223bcbf32 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -837,6 +837,11 @@ package Opt is -- Set True if generated code uses the System.Secondary_Stack package. -- For the binder, set if any unit uses the secondary stack package. + Setup_Projects : Boolean := False; + -- GNAT DRIVER + -- Set to True for GNAT SETUP: the Project Manager creates non existing + -- object, library and exec directories. + Shared_Libgnat : Boolean; -- GNATBIND -- Set to True if a shared libgnat is requested by using the -shared diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 6ae47557e22..c166baafa3a 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -29,6 +29,7 @@ with Fmap; use Fmap; with Hostparm; with MLib.Tgt; with Namet; use Namet; +with Opt; use Opt; with Osint; use Osint; with Output; use Output; with MLib.Tgt; use MLib.Tgt; @@ -237,12 +238,19 @@ package body Prj.Nmsc is -- a spec suffix, a body suffix or a separate suffix. procedure Locate_Directory - (Name : Name_Id; - Parent : Name_Id; - Dir : out Name_Id; - Display : out Name_Id); - -- Locate a directory. - -- Returns No_Name if directory does not exist. + (Name : Name_Id; + Parent : Name_Id; + Dir : out Name_Id; + Display : out Name_Id; + Project : Project_Id := No_Project; + Kind : String := ""; + Location : Source_Ptr := No_Location); + -- Locate a directory. Dir is the canonical path name. Display is the + -- path name for display purpose. + -- When the directory does not exist, Setup_Projects is True and Kind is + -- not the empty string, an attempt is made to create the directory. + -- Returns No_Name in Dir and Display if directory does not exist or + -- cannot be created. function Path_Name_Of (File_Name : Name_Id; @@ -1105,7 +1113,8 @@ package body Prj.Nmsc is -- the object directory or one of the source directories. -- This is the directory where copies of the interface -- sources will be copied. Note that this directory may be - -- the library directory. + -- the library directory. If setting up projects (gnat setup) + -- and the directory does not exist, attempt to create it. if Lib_Src_Dir.Value /= Empty_String then declare @@ -1115,11 +1124,18 @@ package body Prj.Nmsc is Locate_Directory (Dir_Id, Data.Display_Directory, Data.Library_Src_Dir, - Data.Display_Library_Src_Dir); + Data.Display_Library_Src_Dir, + Project => Project, + Kind => "library interface copy", + Location => Lib_Src_Dir.Location); - -- If directory does not exist, report an error + -- If directory does not exist, report an error. No need + -- to do that if Setup_Projects is True, as an error + -- has already been reported by Locate_Directory. - if Data.Library_Src_Dir = No_Name then + if not Setup_Projects + and then Data.Library_Src_Dir = No_Name + then -- Get the absolute name of the library directory -- that does not exist, to report an error. @@ -2514,11 +2530,12 @@ package body Prj.Nmsc is -- it is an error, except if it is an extending project. -- If a non extending project is not supposed to contain -- any source, then we never call Find_Sources. + -- No error either when setting up projects (gnat setup). if Current_Source /= Nil_String then Data.Ada_Sources_Present := True; - elsif Data.Extends = No_Project then + elsif not Setup_Projects and then Data.Extends = No_Project then Error_Msg (Project, "there are no Ada sources in this project", @@ -3289,13 +3306,18 @@ package body Prj.Nmsc is else -- We check that the specified object directory - -- does exist. + -- does exist, and attempt to create it if setting up projects + -- (gnat setup). Locate_Directory (Object_Dir.Value, Data.Display_Directory, - Data.Object_Directory, Data.Display_Object_Dir); + Data.Object_Directory, Data.Display_Object_Dir, + Project => Project, Kind => "object", + Location => Object_Dir.Location); - if Data.Object_Directory = No_Name then + if not Setup_Projects + and then Data.Object_Directory = No_Name + then -- The object directory does not exist, report an error Err_Vars.Error_Msg_Name_1 := Object_Dir.Value; Error_Msg @@ -3354,14 +3376,18 @@ package body Prj.Nmsc is Exec_Dir.Location); else - -- We check that the specified object directory - -- does exist. + -- We check that the specified exec directory does exist and + -- attempt to create it if setting up projects (gnat setup). Locate_Directory (Exec_Dir.Value, Data.Directory, - Data.Exec_Directory, Data.Display_Exec_Dir); + Data.Exec_Directory, Data.Display_Exec_Dir, + Project => Project, Kind => "exec", + Location => Exec_Dir.Location); - if Data.Exec_Directory = No_Name then + if not Setup_Projects + and then Data.Exec_Directory = No_Name + then Err_Vars.Error_Msg_Name_1 := Exec_Dir.Value; Error_Msg (Project, @@ -3553,13 +3579,16 @@ package body Prj.Nmsc is end if; else - -- Find path name, check that it is a directory + -- Find path name, check that it is a directory, and attempt + -- to create it if setting up projects (gnat setup). Locate_Directory (Lib_Dir.Value, Data.Display_Directory, - Data.Library_Dir, Data.Display_Library_Dir); + Data.Library_Dir, Data.Display_Library_Dir, + Project => Project, Kind => "library", + Location => Lib_Dir.Location); - if Data.Library_Dir = No_Name then + if not Setup_Projects and then Data.Library_Dir = No_Name then -- Get the absolute name of the library directory that -- does not exist, to report an error. @@ -3914,10 +3943,13 @@ package body Prj.Nmsc is ---------------------- procedure Locate_Directory - (Name : Name_Id; - Parent : Name_Id; - Dir : out Name_Id; - Display : out Name_Id) + (Name : Name_Id; + Parent : Name_Id; + Dir : out Name_Id; + Display : out Name_Id; + Project : Project_Id := No_Project; + Kind : String := ""; + Location : Source_Ptr := No_Location) is The_Name : constant String := Get_Name_String (Name); The_Parent : constant String := @@ -3925,6 +3957,64 @@ package body Prj.Nmsc is The_Parent_Last : constant Natural := Compute_Directory_Last (The_Parent); + procedure Create_Directory (Absolute_Path : String); + -- Attempt to create a new directory + + procedure Get_Names_For (Absolute_Path : String); + -- Create name ids Dir and Display for directory Absolute_Path + + ---------------------- + -- Create_Directory -- + ---------------------- + + procedure Create_Directory (Absolute_Path : String) is + begin + -- Attempt to create the directory + + Make_Dir (Absolute_Path); + + -- Setup Dir and Display if creation was successful + + Get_Names_For (Absolute_Path); + + exception + when Directory_Error => + Error_Msg + (Project, + "could not create " & Kind & " directory """ & + Absolute_Path & """", + Location); + end Create_Directory; + + ------------------- + -- Get_Names_For -- + ------------------- + + procedure Get_Names_For (Absolute_Path : String) is + Normed : constant String := + Normalize_Pathname + (Absolute_Path, + Resolve_Links => False, + Case_Sensitive => True); + + Canonical_Path : constant String := + Normalize_Pathname + (Normed, + Resolve_Links => True, + Case_Sensitive => False); + + begin + Name_Len := Normed'Length; + Name_Buffer (1 .. Name_Len) := Normed; + Display := Name_Find; + + Name_Len := Canonical_Path'Length; + Name_Buffer (1 .. Name_Len) := Canonical_Path; + Dir := Name_Find; + end Get_Names_For; + + -- Start of processing for Locate_Directory + begin if Current_Verbosity = High then Write_Str ("Locate_Directory ("""); @@ -3939,28 +4029,10 @@ package body Prj.Nmsc is if Is_Absolute_Path (The_Name) then if Is_Directory (The_Name) then - declare - Normed : constant String := - Normalize_Pathname - (The_Name, - Resolve_Links => False, - Case_Sensitive => True); - - Canonical_Path : constant String := - Normalize_Pathname - (Normed, - Resolve_Links => True, - Case_Sensitive => False); - - begin - Name_Len := Normed'Length; - Name_Buffer (1 .. Name_Len) := Normed; - Display := Name_Find; + Get_Names_For (The_Name); - Name_Len := Canonical_Path'Length; - Name_Buffer (1 .. Name_Len) := Canonical_Path; - Dir := Name_Find; - end; + elsif Kind /= "" and then Setup_Projects then + Create_Directory (The_Name); end if; else @@ -3971,28 +4043,10 @@ package body Prj.Nmsc is begin if Is_Directory (Full_Path) then - declare - Normed : constant String := - Normalize_Pathname - (Full_Path, - Resolve_Links => False, - Case_Sensitive => True); - - Canonical_Path : constant String := - Normalize_Pathname - (Normed, - Resolve_Links => True, - Case_Sensitive => False); + Get_Names_For (Full_Path); - begin - Name_Len := Normed'Length; - Name_Buffer (1 .. Name_Len) := Normed; - Display := Name_Find; - - Name_Len := Canonical_Path'Length; - Name_Buffer (1 .. Name_Len) := Canonical_Path; - Dir := Name_Find; - end; + elsif Kind /= "" and then Setup_Projects then + Create_Directory (Full_Path); end if; end; end if; diff --git a/gcc/ada/s-mastop-irix.adb b/gcc/ada/s-mastop-irix.adb index 6c85ce54f1a..c6d1d90c0c8 100644 --- a/gcc/ada/s-mastop-irix.adb +++ b/gcc/ada/s-mastop-irix.adb @@ -125,7 +125,9 @@ package body System.Machine_State_Operations is -- Offset from first byte of a __uint64 register save location where -- the register value is stored. For n32/64 we store the entire 64 -- bit register into the uint64. For o32, only 32 bits are stored - -- at an offset of 4 bytes. + -- at an offset of 4 bytes. This is used as part of expressions with + -- '+' signs on both sides, so a null offset has to be '0' and not ' ' + -- to avoid assembler syntax errors on "X + + Y" in the latter case. procedure Update_GP (Scp : Sigcontext_Ptr); diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 1e27760a04a..44c80e0910f 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -29,7 +29,6 @@ with Checks; use Checks; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; -with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Itypes; use Itypes; @@ -1684,15 +1683,7 @@ package body Sem_Aggr is -- of a component the expander will generate calls to -- the corresponding initialization subprogram. - if Present (Base_Init_Proc (Etype (Component_Typ))) - or else Has_Task (Base_Type (Component_Typ)) - then - null; - else - Error_Msg_N - ("(Ada 2005): no value supplied for this component", - Assoc); - end if; + null; elsif not Resolve_Aggr_Expr (Expression (Assoc), Single_Elmt => Single_Choice) @@ -1831,13 +1822,7 @@ package body Sem_Aggr is -- of a component the expander will generate calls to -- the corresponding initialization subprogram. - if Present (Base_Init_Proc (Etype (Component_Typ))) then - null; - else - Error_Msg_N - ("(Ada 2005): no value supplied for these components", - Assoc); - end if; + null; elsif not Resolve_Aggr_Expr (Expression (Assoc), Single_Elmt => False) @@ -2965,20 +2950,24 @@ package body Sem_Aggr is Component := Node (Component_Elmt); Expr := Get_Value (Component, Component_Associations (N), True); - if Mbox_Present and then Is_Limited_Type (Etype (Component)) then - - -- Ada 2005 (AI-287): In case of default initialization of - -- a limited component we pass the limited component to - -- the expander. The expander will generate calls to the - -- corresponding initialization subprograms. + -- Ada 2005 (AI-287): Default initialized limited component are + -- passed to the expander, that will generate calls to the + -- corresponding IP. + if Mbox_Present and then Is_Limited_Type (Etype (Component)) then Add_Association (Component => Component, Expr => Empty, Box_Present => True); + -- Ada 2005 (AI-287): No value supplied for component + + elsif Mbox_Present and No (Expr) then + null; + elsif No (Expr) then Error_Msg_NE ("no value supplied for component &!", N, Component); + else Resolve_Aggr_Expr (Expr, Component); end if; diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index d913aa6f59f..cbdfbc272d9 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -3248,13 +3248,6 @@ package body Sem_Ch10 is then Set_Is_Immediately_Visible (Id); - -- Ada 2005 (AI-262): Make visible the private entities of - -- private-withed siblings - - if Private_Present (Item) then - Install_Private_Declarations (Id); - end if; - -- Check for the presence of another unit in the context, -- that may be inadvertently hidden by the child. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 73c6b33a9e7..b7dc0a793ec 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -6251,7 +6251,17 @@ package body Sem_Ch3 is Subtype_Mark => New_Reference_To (Par, Loc), Constraint => New_Copy_Tree (Constr))); - Insert_Before (N, Indic); + -- If this is a component subtype for an outer itype, it is not + -- a list member, so simply set the parent link for analysis: if + -- the enclosing type does not need to be in a declarative list, + -- neither do the components. + + if Is_List_Member (N) then + Insert_Before (N, Indic); + else + Set_Parent (Indic, Parent (N)); + end if; + Analyze (Indic); Set_Underlying_Full_View (Typ, Full_View (Subt)); end Build_Underlying_Full_View; diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index eeff99475b7..790ca0014e8 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -1918,6 +1918,11 @@ package body Sem_Ch8 is Rewrite (N, Body_Node); Analyze (N); + if Is_Compilation_Unit (New_S) then + Error_Msg_N + ("a library unit can only rename another library unit", N); + end if; + Set_Etype (New_S, Base_Type (Etype (New_S))); -- We suppress elaboration warnings for the resulting entity, since @@ -2051,6 +2056,14 @@ package body Sem_Ch8 is then Error_Msg_N ("renamed unit must be a library unit", Name (N)); + -- Entities defined in Standard (operators and boolean literals) cannot + -- be renamed as library units. + + elsif Scope (Old_E) = Standard_Standard + and then Sloc (Old_E) = Standard_Location + then + Error_Msg_N ("renamed unit must be a library unit", Name (N)); + elsif Present (Parent_Spec (N)) and then Nkind (Unit (Parent_Spec (N))) = N_Generic_Package_Declaration and then not Is_Child_Unit (Old_E) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 23903e42ecb..9a7d711b5ec 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -2110,7 +2110,11 @@ package body Sem_Res is if not Is_Predefined_Op (Entity (N)) then Rewrite_Operator_As_Call (N, Entity (N)); - elsif Present (Alias (Entity (N))) then + elsif Present (Alias (Entity (N))) + and then + Nkind (Parent (Parent (Entity (N)))) + = N_Subprogram_Renaming_Declaration + then Rewrite_Renamed_Operator (N, Alias (Entity (N)), Typ); -- If the node is rewritten, it will be fully resolved in diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e8eadd2ebe0..3f9c7eeba1d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -4043,6 +4043,9 @@ package body Sem_Util is then return False; + elsif Nkind (Original_Node (AV)) = N_Type_Conversion then + return Is_OK_Variable_For_Out_Formal (Expression (AV)); + else return True; end if; @@ -5772,9 +5775,10 @@ package body Sem_Util is -- scope because the back end otherwise tries to allocate a -- variable length temporary for the particular variant. - if Opt.GCC_Version = 2 - and then Has_Discriminants (Typ) - then + -- ??? With tree-ssa, the back-end does not (yet) support these + -- types either, so disable this optimization for now. + + if Has_Discriminants (Typ) then return True; -- For GCC 3, or for a non-discriminated record in GCC 2, we are diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 6b7a174c369..f45783e9986 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -73,7 +73,7 @@ const char *ref_filename; /* If true, then gigi is being called on an analyzed but unexpanded tree, and the only purpose of the call is to properly annotate types with representation information. */ -int type_annotate_only; +bool type_annotate_only; /* A structure used to gather together information about a statement group. We use this to gather related statements, for example the "then" part @@ -120,7 +120,7 @@ static GTY(()) tree gnu_elab_proc_decl; /* Map GNAT tree codes to GCC tree codes for simple expressions. */ static enum tree_code gnu_codes[Number_Node_Kinds]; -/* Current node being treated, in case gigi_abort called. */ +/* Current node being treated, in case abort called. */ Node_Id error_gnat_node; static void record_code_position (Node_Id); @@ -135,21 +135,20 @@ static tree build_stmt_group (List_Id, bool); static void push_stack (tree *, tree, tree); static void pop_stack (tree *); static enum gimplify_status gnat_gimplify_stmt (tree *); -static void gnat_expand_body_1 (tree, bool); static void elaborate_all_entities (Node_Id); static void process_freeze_entity (Node_Id); static void process_inlined_subprograms (Node_Id); -static void process_decls (List_Id, List_Id, Node_Id, int, int); +static void process_decls (List_Id, List_Id, Node_Id, bool, bool); static tree emit_range_check (tree, Node_Id); static tree emit_index_check (tree, tree, tree, tree); static tree emit_check (tree, tree, int); -static tree convert_with_check (Entity_Id, tree, int, int, int); -static int addressable_p (tree); +static tree convert_with_check (Entity_Id, tree, bool, bool, bool); +static bool addressable_p (tree); static tree assoc_to_constructor (Node_Id, tree); static tree extract_values (tree, tree); static tree pos_to_constructor (Node_Id, tree, Entity_Id); static tree maybe_implicit_deref (tree); -static tree gnat_stabilize_reference_1 (tree, int); +static tree gnat_stabilize_reference_1 (tree, bool); static bool build_unit_elab (void); static void annotate_with_node (tree, Node_Id); @@ -203,8 +202,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, /* Save the type we made for integer as the type for Standard.Integer. Then make the rest of the standard types. Note that some of these may be subtypes. */ - save_gnu_tree (Base_Type (standard_integer), - TYPE_NAME (integer_type_node), 0); + save_gnu_tree (Base_Type (standard_integer), TYPE_NAME (integer_type_node), + false); gnu_except_ptr_stack = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); @@ -237,7 +236,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, = create_subprog_decl (create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"), - NULL_TREE, void_ftype, NULL_TREE, 0, 1, 0, 0, gnat_unit_entity); + NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, + gnat_unit_entity); DECL_ELABORATION_PROC_P (gnu_elab_proc_decl) = 1; allocate_struct_function (gnu_elab_proc_decl); @@ -247,7 +247,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, /* For a body, first process the spec if there is one. */ if (Nkind (Unit (gnat_root)) == N_Package_Body || (Nkind (Unit (gnat_root)) == N_Subprogram_Body - && ! Acts_As_Spec (gnat_root))) + && !Acts_As_Spec (gnat_root))) add_stmt (gnat_to_gnu (Library_Unit (gnat_root))); process_inlined_subprograms (gnat_root); @@ -263,7 +263,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, } process_decls (Declarations (Aux_Decls_Node (gnat_root)), Empty, Empty, - 1, 1); + true, true); add_stmt (gnat_to_gnu (Unit (gnat_root))); /* Process any pragmas and actions following the unit. */ @@ -322,22 +322,22 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) gnat_temp_type = Etype (gnat_temp); if (Etype (gnat_node) != gnat_temp_type - && ! (Is_Packed (gnat_temp_type) - && Etype (gnat_node) == Packed_Array_Type (gnat_temp_type)) - && ! (Is_Class_Wide_Type (Etype (gnat_node))) - && ! (IN (Ekind (gnat_temp_type), Private_Kind) - && Present (Full_View (gnat_temp_type)) - && ((Etype (gnat_node) == Full_View (gnat_temp_type)) - || (Is_Packed (Full_View (gnat_temp_type)) - && (Etype (gnat_node) - == Packed_Array_Type (Full_View (gnat_temp_type)))))) + && !(Is_Packed (gnat_temp_type) + && Etype (gnat_node) == Packed_Array_Type (gnat_temp_type)) + && !(Is_Class_Wide_Type (Etype (gnat_node))) + && !(IN (Ekind (gnat_temp_type), Private_Kind) + && Present (Full_View (gnat_temp_type)) + && ((Etype (gnat_node) == Full_View (gnat_temp_type)) + || (Is_Packed (Full_View (gnat_temp_type)) + && (Etype (gnat_node) + == Packed_Array_Type (Full_View (gnat_temp_type)))))) && (!Is_Itype (Etype (gnat_node)) || !Is_Itype (gnat_temp_type)) && (Ekind (gnat_temp) == E_Variable || Ekind (gnat_temp) == E_Component || Ekind (gnat_temp) == E_Constant || Ekind (gnat_temp) == E_Loop_Parameter || IN (Ekind (gnat_temp), Formal_Kind))) - gigi_abort (304); + abort (); /* If this is a reference to a deferred constant whose partial view is an unconstrained private type, the proper type is on the full view of the @@ -350,7 +350,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) if (Is_Private_Type (gnat_temp_type) && Has_Unknown_Discriminants (gnat_temp_type) && Present (Full_View (gnat_temp)) - && ! Is_Type (gnat_temp)) + && !Is_Type (gnat_temp)) { gnat_temp = Full_View (gnat_temp); gnat_temp_type = Etype (gnat_temp); @@ -365,8 +365,8 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) Actual_Subtype for packed arrays to simplify things. */ if ((Ekind (gnat_temp) == E_Constant || Ekind (gnat_temp) == E_Variable || Is_Formal (gnat_temp)) - && ! (Is_Array_Type (Etype (gnat_temp)) - && Present (Packed_Array_Type (Etype (gnat_temp)))) + && !(Is_Array_Type (Etype (gnat_temp)) + && Present (Packed_Array_Type (Etype (gnat_temp)))) && Present (Actual_Subtype (gnat_temp)) && present_gnu_tree (Actual_Subtype (gnat_temp))) gnat_temp_type = Actual_Subtype (gnat_temp); @@ -388,7 +388,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ??? Also, for now all we can do is make it volatile. But we only do this for SJLJ. */ - if (TREE_VALUE (gnu_except_ptr_stack) != 0 + if (TREE_VALUE (gnu_except_ptr_stack) && TREE_CODE (gnu_result) == VAR_DECL) TREE_THIS_VOLATILE (gnu_result) = TREE_SIDE_EFFECTS (gnu_result) = 1; @@ -402,7 +402,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) || (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (gnu_result)))) { - int ro = DECL_POINTS_TO_READONLY_P (gnu_result); + bool ro = DECL_POINTS_TO_READONLY_P (gnu_result); tree initial; if (TREE_CODE (gnu_result) == PARM_DECL @@ -465,37 +465,37 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) if (TREE_CODE (gnu_result) == CONST_DECL) { gnat_temp = Parent (gnat_node); - if (DECL_CONST_CORRESPONDING_VAR (gnu_result) == 0 + if (!DECL_CONST_CORRESPONDING_VAR (gnu_result) || (Nkind (gnat_temp) != N_Reference - && ! (Nkind (gnat_temp) == N_Attribute_Reference - && ((Get_Attribute_Id (Attribute_Name (gnat_temp)) - == Attr_Address) - || (Get_Attribute_Id (Attribute_Name (gnat_temp)) - == Attr_Access) - || (Get_Attribute_Id (Attribute_Name (gnat_temp)) + && !(Nkind (gnat_temp) == N_Attribute_Reference + && ((Get_Attribute_Id (Attribute_Name (gnat_temp)) + == Attr_Address) + || (Get_Attribute_Id (Attribute_Name (gnat_temp)) + == Attr_Access) + || (Get_Attribute_Id (Attribute_Name (gnat_temp)) == Attr_Unchecked_Access) - || (Get_Attribute_Id (Attribute_Name (gnat_temp)) - == Attr_Unrestricted_Access))))) + || (Get_Attribute_Id (Attribute_Name (gnat_temp)) + == Attr_Unrestricted_Access))))) gnu_result = DECL_INITIAL (gnu_result); } *gnu_result_type_p = gnu_result_type; return gnu_result; } + +/* Subroutine of gnat_to_gnu to process gnat_node, an N_Pragma. Return + any statements we generate. */ -/* Subroutine of gnat_to_gnu to process gnat_node, an N_Pragma. We don't - return anything. */ - -static void +static tree Pragma_to_gnu (Node_Id gnat_node) { Node_Id gnat_temp; + tree gnu_result = alloc_stmt_list (); /* Check for (and ignore) unrecognized pragma and do nothing if we are just annotating types. */ - if (type_annotate_only - || ! Is_Pragma_Name (Chars (gnat_node))) - return; + if (type_annotate_only || !Is_Pragma_Name (Chars (gnat_node))) + return gnu_result; switch (Get_Pragma_Id (Chars (gnat_node))) { @@ -514,7 +514,8 @@ Pragma_to_gnu (Node_Id gnat_node) gnu_expr = TREE_OPERAND (gnu_expr, 0); gnu_expr = build1 (USE_STMT, void_type_node, gnu_expr); - add_stmt (gnu_expr); + annotate_with_node (gnu_expr, gnat_node); + append_to_statement_list (gnu_expr, &gnu_result); } break; @@ -533,7 +534,7 @@ Pragma_to_gnu (Node_Id gnat_node) break; default: - gigi_abort (331); + abort (); break; } break; @@ -543,6 +544,8 @@ Pragma_to_gnu (Node_Id gnat_node) post_error ("must specify -g?", gnat_node); break; } + + return gnu_result; } /* Subroutine of gnat_to_gnu to translate gnat_node, an N_Attribute, to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer to @@ -573,12 +576,12 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) /* These are just conversions until since representation clauses for enumerations are handled in the front end. */ { - int check_p = Do_Range_Check (First (Expressions (gnat_node))); + bool checkp = Do_Range_Check (First (Expressions (gnat_node))); gnu_result = gnat_to_gnu (First (Expressions (gnat_node))); gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result = convert_with_check (Etype (gnat_node), gnu_result, - check_p, check_p, 1); + checkp, checkp, true); } break; @@ -614,7 +617,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) /* Conversions don't change something's address but can cause us to miss the COMPONENT_REF case below, so strip them off. */ gnu_prefix = remove_conversions (gnu_prefix, - ! Must_Be_Byte_Aligned (gnat_node)); + !Must_Be_Byte_Aligned (gnat_node)); /* If we are taking 'Address of an unconstrained object, this is the pointer to the underlying array. */ @@ -629,7 +632,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) gnu_result = build_unary_op (((attribute == Attr_Address || attribute == Attr_Unrestricted_Access) - && ! Must_Be_Byte_Aligned (gnat_node)) + && !Must_Be_Byte_Aligned (gnat_node)) ? ATTR_ADDR_EXPR : ADDR_EXPR, gnu_result_type, gnu_prefix); @@ -696,7 +699,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) gnu_expr = TREE_OPERAND (gnu_expr, 0) ; - gnu_prefix = remove_conversions (gnu_prefix, 1); + gnu_prefix = remove_conversions (gnu_prefix, true); prefix_unused = true; gnu_type = TREE_TYPE (gnu_prefix); @@ -734,8 +737,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) && TREE_CODE (gnu_expr) == COMPONENT_REF) { gnu_result = rm_size (gnu_type); - if (! (CONTAINS_PLACEHOLDER_P - (DECL_SIZE (TREE_OPERAND (gnu_expr, 1))))) + if (!(CONTAINS_PLACEHOLDER_P + (DECL_SIZE (TREE_OPERAND (gnu_expr, 1))))) gnu_result = size_binop (MAX_EXPR, gnu_result, DECL_SIZE (TREE_OPERAND (gnu_expr, 1))); @@ -746,8 +749,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) else gnu_result = rm_size (gnu_type); - if (gnu_result == 0) - gigi_abort (325); + if (!gnu_result) + abort (); /* Deal with a self-referential size by returning the maximum size for a type and by qualifying the size with the object for 'Size of an @@ -758,7 +761,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) gnu_result = substitute_placeholder_in_expr (gnu_result, gnu_expr); else - gnu_result = max_size (gnu_result, 1); + gnu_result = max_size (gnu_result, true); } /* If the type contains a template, subtract its size. */ @@ -862,7 +865,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) gnu_type = TREE_TYPE (gnu_type); if (TREE_CODE (gnu_type) != ARRAY_TYPE) - gigi_abort (309); + abort (); if (attribute == Attr_First) gnu_result @@ -918,7 +921,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) int unsignedp, volatilep; gnu_result_type = get_unpadded_type (Etype (gnat_node)); - gnu_prefix = remove_conversions (gnu_prefix, 1); + gnu_prefix = remove_conversions (gnu_prefix, true); prefix_unused = true; /* We can have 'Bit on any object, but if it isn't a COMPONENT_REF, @@ -932,9 +935,9 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) } else if (TREE_CODE (gnu_prefix) != COMPONENT_REF - && ! (attribute == Attr_Bit_Position - && TREE_CODE (gnu_prefix) == FIELD_DECL)) - gigi_abort (310); + && !(attribute == Attr_Bit_Position + && TREE_CODE (gnu_prefix) == FIELD_DECL)) + abort (); get_inner_reference (gnu_prefix, &bitsize, &bitpos, &gnu_offset, &mode, &unsignedp, &volatilep); @@ -1035,7 +1038,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) gnu_type = TREE_TYPE (gnu_type); if (TREE_CODE (gnu_type) != ARRAY_TYPE) - gigi_abort (330); + abort (); /* Note this size cannot be self-referential. */ gnu_result = TYPE_SIZE (TREE_TYPE (gnu_type)); @@ -1098,7 +1101,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) name. However, if an access check is needed, we must do it. See second example in AARM 11.6(5.e). */ if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix) - && ! Is_Entity_Name (Prefix (gnat_node))) + && !Is_Entity_Name (Prefix (gnat_node))) gnu_result = fold (build (COMPOUND_EXPR, TREE_TYPE (gnu_result), gnu_prefix, gnu_result)); @@ -1192,7 +1195,7 @@ Case_Statement_to_gnu (Node_Id gnat_node) break; default: - gigi_abort (316); + abort (); } add_stmt_with_node (build (CASE_LABEL_EXPR, void_type_node, @@ -1325,7 +1328,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node) LOOP_STMT. */ if (Present (Identifier (gnat_node))) save_gnu_tree (Entity (Identifier (gnat_node)), - LOOP_STMT_LABEL (gnu_loop_stmt), 1); + LOOP_STMT_LABEL (gnu_loop_stmt), true); /* Make the loop body into its own block, so any allocated storage will be released every iteration. This is needed for stack allocation. */ @@ -1406,7 +1409,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) gnu_subprog_decl = gnat_to_gnu_entity (gnat_subprog_id, NULL_TREE, Acts_As_Spec (gnat_node) - && ! present_gnu_tree (gnat_subprog_id)); + && !present_gnu_tree (gnat_subprog_id)); gnu_subprog_type = TREE_TYPE (gnu_subprog_decl); @@ -1440,7 +1443,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) { /* Skip any entries that have been already filled in; they must correspond to IN OUT parameters. */ - for (; gnu_cico_list != 0 && TREE_VALUE (gnu_cico_list) != 0; + for (; gnu_cico_list && TREE_VALUE (gnu_cico_list); gnu_cico_list = TREE_CHAIN (gnu_cico_list)) ; @@ -1450,7 +1453,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) gnat_to_gnu_entity (gnat_param, NULL_TREE, 1)); } - process_decls (Declarations (gnat_node), Empty, Empty, 1, 1); + process_decls (Declarations (gnat_node), Empty, Empty, true, true); /* Generate the code of the subprogram itself. A return statement will be present and any OUT parameters will be handled there. */ @@ -1461,7 +1464,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) /* If we made a special return label, we need to make a block that contains the definition of that label and the copying to the return value. That block first contains the function, then the label and copy statement. */ - if (TREE_VALUE (gnu_return_label_stack) != 0) + if (TREE_VALUE (gnu_return_label_stack)) { tree gnu_retval; @@ -1509,7 +1512,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) Present (gnat_param); gnat_param = Next_Formal_With_Extras (gnat_param)) if (TREE_CODE (get_gnu_tree (gnat_param)) == VAR_DECL) - save_gnu_tree (gnat_param, NULL_TREE, 0); + save_gnu_tree (gnat_param, NULL_TREE, false); mark_out_of_scope (Defining_Unit_Name (Specification (gnat_node))); write_symbols = save_write_symbols; @@ -1552,7 +1555,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) } if (TREE_CODE (gnu_subprog_type) != FUNCTION_TYPE) - gigi_abort (317); + abort (); /* If we are calling a stubbed function, make this into a raise of Program_Error. Elaborate all our args first. */ @@ -1606,6 +1609,9 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ? Expression (gnat_actual) : gnat_actual); tree gnu_name = gnat_to_gnu (gnat_name); tree gnu_name_type = gnat_to_gnu_type (Etype (gnat_name)); + tree gnu_formal + = (present_gnu_tree (gnat_formal) + ? get_gnu_tree (gnat_formal) : NULL_TREE); tree gnu_actual; /* If it's possible we may need to use this expression twice, make sure @@ -1618,14 +1624,13 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) of a copy and set up to copy back out after the call. */ if (Ekind (gnat_formal) != E_In_Parameter) { - gnu_name = gnat_stabilize_reference (gnu_name, 1); - if (! addressable_p (gnu_name) - && present_gnu_tree (gnat_formal) - && (DECL_BY_REF_P (get_gnu_tree (gnat_formal)) - || (TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL - && (DECL_BY_COMPONENT_PTR_P (get_gnu_tree (gnat_formal)) - || (DECL_BY_DESCRIPTOR_P - (get_gnu_tree (gnat_formal))))))) + gnu_name = gnat_stabilize_reference (gnu_name, true); + if (!addressable_p (gnu_name) + && gnu_formal + && (DECL_BY_REF_P (gnu_formal) + || (TREE_CODE (gnu_formal) == PARM_DECL + && (DECL_BY_COMPONENT_PTR_P (gnu_formal) + || (DECL_BY_DESCRIPTOR_P (gnu_formal)))))) { tree gnu_copy = gnu_name; tree gnu_temp; @@ -1682,7 +1687,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) gnu_name); if (Ekind (gnat_formal) != E_Out_Parameter - && ! unchecked_convert_p + && !unchecked_convert_p && Do_Range_Check (gnat_actual)) gnu_actual = emit_range_check (gnu_actual, Etype (gnat_formal)); @@ -1718,9 +1723,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) OUT parameter not passed by reference and that does not need to be copied in. Otherwise, look at the PARM_DECL to see if it is passed by reference. */ - if (present_gnu_tree (gnat_formal) - && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL - && DECL_BY_REF_P (get_gnu_tree (gnat_formal))) + if (gnu_formal + && TREE_CODE (gnu_formal) == PARM_DECL && DECL_BY_REF_P (gnu_formal)) { if (Ekind (gnat_formal) != E_In_Parameter) { @@ -1739,7 +1743,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) so, remove that operation since we have no way of allocating the required temporary. */ if (TREE_CODE (gnu_actual) == COMPONENT_REF - && ! TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_actual))) + && !TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_actual))) && (TREE_CODE (TREE_TYPE (TREE_OPERAND (gnu_actual, 0))) == RECORD_TYPE) && TYPE_IS_PADDING_P (TREE_TYPE @@ -1752,9 +1756,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal)); gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); } - else if (present_gnu_tree (gnat_formal) - && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL - && DECL_BY_COMPONENT_PTR_P (get_gnu_tree (gnat_formal))) + else if (gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL + && DECL_BY_COMPONENT_PTR_P (gnu_formal)) { gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal)); gnu_actual = maybe_implicit_deref (gnu_actual); @@ -1777,9 +1780,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) build_unary_op (ADDR_EXPR, NULL_TREE, gnu_actual)); } - else if (present_gnu_tree (gnat_formal) - && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL - && DECL_BY_DESCRIPTOR_P (get_gnu_tree (gnat_formal))) + else if (gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL + && DECL_BY_DESCRIPTOR_P (gnu_formal)) { /* If arg is 'Null_Parameter, pass zero descriptor. */ if ((TREE_CODE (gnu_actual) == INDIRECT_REF @@ -1797,11 +1799,9 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) tree gnu_actual_size = TYPE_SIZE (TREE_TYPE (gnu_actual)); if (Ekind (gnat_formal) != E_In_Parameter) - gnu_name_list = chainon (gnu_name_list, - build_tree_list (NULL_TREE, gnu_name)); + gnu_name_list = tree_cons (NULL_TREE, gnu_name, gnu_name_list); - if (! present_gnu_tree (gnat_formal) - || TREE_CODE (get_gnu_tree (gnat_formal)) != PARM_DECL) + if (!gnu_formal || TREE_CODE (gnu_formal) != PARM_DECL) continue; /* If this is 'Null_Parameter, pass a zero even though we are @@ -1812,24 +1812,24 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) && 0 >= compare_tree_int (gnu_actual_size, BITS_PER_WORD)) gnu_actual - = unchecked_convert - (DECL_ARG_TYPE (get_gnu_tree (gnat_formal)), - convert (gnat_type_for_size - (tree_low_cst (gnu_actual_size, 1), 1), - integer_zero_node), 0); + = unchecked_convert (DECL_ARG_TYPE (gnu_formal), + convert (gnat_type_for_size + (tree_low_cst (gnu_actual_size, 1), + 1), + integer_zero_node), + false); else - gnu_actual = convert (TYPE_MAIN_VARIANT - (DECL_ARG_TYPE (get_gnu_tree (gnat_formal))), - gnu_actual); + gnu_actual + = convert (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (gnu_formal)), + gnu_actual); } - gnu_actual_list = chainon (gnu_actual_list, - build_tree_list (NULL_TREE, gnu_actual)); + gnu_actual_list = tree_cons (NULL_TREE, gnu_actual, gnu_actual_list); } gnu_subprog_call = build (CALL_EXPR, TREE_TYPE (gnu_subprog_type), - gnu_subprog_addr, gnu_actual_list, NULL_TREE); - TREE_SIDE_EFFECTS (gnu_subprog_call) = 1; + gnu_subprog_addr, nreverse (gnu_actual_list), + NULL_TREE); /* If it is a function call, the result is the call expression. */ if (Nkind (gnat_node) == N_Function_Call) @@ -1861,13 +1861,15 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) tree gnu_name; gnu_subprog_call = protect_multiple_eval (gnu_subprog_call); + gnu_name_list = nreverse (gnu_name_list); /* If any of the names had side-effects, ensure they are all evaluated before the call. */ for (gnu_name = gnu_name_list; gnu_name; gnu_name = TREE_CHAIN (gnu_name)) if (TREE_SIDE_EFFECTS (TREE_VALUE (gnu_name))) - add_stmt (TREE_VALUE (gnu_name)); + append_to_statement_list (TREE_VALUE (gnu_name), + &gnu_before_list); } if (Nkind (Name (gnat_node)) == N_Explicit_Dereference) @@ -1881,14 +1883,13 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) gnat_actual = Next_Actual (gnat_actual)) /* If we are dealing with a copy in copy out parameter, we must retrieve its value from the record returned in the call. */ - if (! (present_gnu_tree (gnat_formal) - && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL - && (DECL_BY_REF_P (get_gnu_tree (gnat_formal)) - || (TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL - && ((DECL_BY_COMPONENT_PTR_P - (get_gnu_tree (gnat_formal)) - || (DECL_BY_DESCRIPTOR_P - (get_gnu_tree (gnat_formal)))))))) + if (!(present_gnu_tree (gnat_formal) + && TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL + && (DECL_BY_REF_P (get_gnu_tree (gnat_formal)) + || (TREE_CODE (get_gnu_tree (gnat_formal)) == PARM_DECL + && ((DECL_BY_COMPONENT_PTR_P (get_gnu_tree (gnat_formal)) + || (DECL_BY_DESCRIPTOR_P + (get_gnu_tree (gnat_formal)))))))) && Ekind (gnat_formal) != E_In_Parameter) { /* Get the value to assign to this OUT or IN OUT parameter. It is @@ -1897,7 +1898,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) tree gnu_result = length == 1 ? gnu_subprog_call : build_component_ref (gnu_subprog_call, NULL_TREE, - TREE_PURPOSE (scalar_return_list), 0); + TREE_PURPOSE (scalar_return_list), + false); bool unchecked_conversion = (Nkind (gnat_actual) == N_Unchecked_Type_Conversion); /* If the actual is a conversion, get the inner expression, which @@ -1932,9 +1934,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) gnu_result = emit_range_check (gnu_result, Etype (gnat_actual)); - if (! (! TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_actual))) - && TREE_CONSTANT (TYPE_SIZE - (TREE_TYPE (gnu_result))))) + if (!(!TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_actual))) + && TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_result))))) gnu_result = convert (TREE_TYPE (gnu_actual), gnu_result); } @@ -2011,10 +2012,12 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE, jmpbuf_ptr_type, build_call_0_expr (get_jmpbuf_decl), - 0, 0, 0, 0, 0, gnat_node); + false, false, false, false, NULL, + gnat_node); gnu_jmpbuf_decl = create_var_decl (get_identifier ("JMP_BUF"), NULL_TREE, jmpbuf_type, - NULL_TREE, 0, 0, 0, 0, 0, gnat_node); + NULL_TREE, false, false, false, false, + NULL, gnat_node); set_block_jmpbuf_decl (gnu_jmpbuf_decl); @@ -2034,7 +2037,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) if (Present (First_Real_Statement (gnat_node))) process_decls (Statements (gnat_node), Empty, - First_Real_Statement (gnat_node), 1, 1); + First_Real_Statement (gnat_node), true, true); /* Generate code for each statement in the block. */ for (gnat_temp = (Present (First_Real_Statement (gnat_node)) @@ -2060,8 +2063,8 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) create_var_decl (get_identifier ("EXCEPT_PTR"), NULL_TREE, build_pointer_type (except_type_node), - build_call_0_expr (get_excptr_decl), - 0, 0, 0, 0, 0, gnat_node)); + build_call_0_expr (get_excptr_decl), false, + false, false, false, NULL, gnat_node)); /* Generate code for each handler. The N_Exception_Handler case does the real work and returns a COND_EXPR for each handler, which we chain @@ -2181,7 +2184,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) (INDIRECT_REF, NULL_TREE, TREE_VALUE (gnu_except_ptr_stack)), get_identifier ("not_handled_by_others"), NULL_TREE, - 0)), + false)), integer_zero_node); } @@ -2206,7 +2209,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) = build_component_ref (build_unary_op (INDIRECT_REF, NULL_TREE, TREE_VALUE (gnu_except_ptr_stack)), - get_identifier ("lang"), NULL_TREE, 0); + get_identifier ("lang"), NULL_TREE, false); this_choice = build_binary_op @@ -2218,7 +2221,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) } } else - gigi_abort (318); + abort (); gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, gnu_choice, this_choice); @@ -2279,7 +2282,7 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node) by the personality routine. */ } else - gigi_abort (337); + abort (); /* The GCC interface expects NULL to be passed for catch all handlers, so it would be quite tempting to set gnu_etypes_list to NULL if gnu_etype @@ -2314,7 +2317,8 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node) gnu_current_exc_ptr = build (EXC_PTR_EXPR, ptr_type_node); gnu_incoming_exc_ptr = create_var_decl (get_identifier ("EXPTR"), NULL_TREE, ptr_type_node, gnu_current_exc_ptr, - 0, 0, 0, 0, 0, gnat_node); + false, false, false, false, NULL, + gnat_node); add_stmt_with_node (build_call_1_expr (begin_handler_decl, gnu_incoming_exc_ptr), @@ -2359,7 +2363,7 @@ gnat_to_gnu (Node_Id gnat_node) if (type_annotate_only && IN (Nkind (gnat_node), N_Subexpr) && Nkind (gnat_node) != N_Identifier - && ! Compile_Time_Known_Value (gnat_node)) + && !Compile_Time_Known_Value (gnat_node)) return build1 (NULL_EXPR, get_unpadded_type (Etype (gnat_node)), build_call_raise (CE_Range_Check_Failed)); @@ -2371,6 +2375,7 @@ gnat_to_gnu (Node_Id gnat_node) && Nkind (gnat_node) != N_Null_Statement) || Nkind (gnat_node) == N_Procedure_Call_Statement || Nkind (gnat_node) == N_Label + || Nkind (gnat_node) == N_Implicit_Label_Declaration || Nkind (gnat_node) == N_Handled_Sequence_Of_Statements || ((Nkind (gnat_node) == N_Raise_Constraint_Error || Nkind (gnat_node) == N_Raise_Storage_Error @@ -2416,7 +2421,7 @@ gnat_to_gnu (Node_Id gnat_node) will raise Constraint_Error and with biased representation, so we don't. */ if (TREE_CONSTANT_OVERFLOW (gnu_result)) - gigi_abort (305); + abort (); } break; @@ -2443,13 +2448,13 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = UI_To_gnu (Corresponding_Integer_Value (gnat_node), gnu_result_type); if (TREE_CONSTANT_OVERFLOW (gnu_result)) - gigi_abort (305); + abort (); } /* We should never see a Vax_Float type literal, since the front end is supposed to transform these using appropriate conversions */ else if (Vax_Float (Underlying_Type (Etype (gnat_node)))) - gigi_abort (334); + abort (); else { @@ -2464,7 +2469,7 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = convert (gnu_result_type, integer_zero_node); else { - if (! Is_Machine_Number (gnat_node)) + if (!Is_Machine_Number (gnat_node)) ur_realval = Machine (Base_Type (Underlying_Type (Etype (gnat_node))), ur_realval, Round_Even, gnat_node); @@ -2476,7 +2481,7 @@ gnat_to_gnu (Node_Id gnat_node) Otherwise, the base must be 2 and we scale the value, which we know can fit in the mantissa of the type (hence the use of that type above). */ - if (Rbase (ur_realval) == 0) + if (No (Rbase (ur_realval))) gnu_result = build_binary_op (RDIV_EXPR, get_base_type (gnu_result_type), @@ -2484,7 +2489,7 @@ gnat_to_gnu (Node_Id gnat_node) UI_To_gnu (Denominator (ur_realval), gnu_result_type)); else if (Rbase (ur_realval) != 2) - gigi_abort (336); + abort (); else { @@ -2560,8 +2565,7 @@ gnat_to_gnu (Node_Id gnat_node) break; case N_Pragma: - gnu_result = alloc_stmt_list (); - Pragma_to_gnu (gnat_node); + gnu_result = Pragma_to_gnu (gnat_node); break; /**************************************/ @@ -2588,14 +2592,14 @@ gnat_to_gnu (Node_Id gnat_node) if (type_annotate_only && (((Is_Array_Type (Etype (gnat_temp)) || Is_Record_Type (Etype (gnat_temp))) - && ! Is_Constrained (Etype (gnat_temp))) + && !Is_Constrained (Etype (gnat_temp))) || Is_Concurrent_Type (Etype (gnat_temp)))) break; if (Present (Expression (gnat_node)) - && ! (Nkind (gnat_node) == N_Object_Declaration - && No_Initialization (gnat_node)) - && (! type_annotate_only + && !(Nkind (gnat_node) == N_Object_Declaration + && No_Initialization (gnat_node)) + && (!type_annotate_only || Compile_Time_Known_Value (Expression (gnat_node)))) { gnu_expr = gnat_to_gnu (Expression (gnat_node)); @@ -2608,24 +2612,23 @@ gnat_to_gnu (Node_Id gnat_node) if (Present (Freeze_Node (gnat_temp))) { if ((Is_Public (gnat_temp) || global_bindings_p ()) - && ! TREE_CONSTANT (gnu_expr)) + && !TREE_CONSTANT (gnu_expr)) gnu_expr = create_var_decl (create_concat_name (gnat_temp, "init"), NULL_TREE, TREE_TYPE (gnu_expr), - gnu_expr, 0, Is_Public (gnat_temp), 0, - 0, 0, gnat_temp); + gnu_expr, false, Is_Public (gnat_temp), + false, false, NULL, gnat_temp); else gnu_expr = maybe_variable (gnu_expr); - save_gnu_tree (gnat_node, gnu_expr, 1); + save_gnu_tree (gnat_node, gnu_expr, true); } } else - gnu_expr = 0; + gnu_expr = NULL_TREE; - if (type_annotate_only && gnu_expr != 0 - && TREE_CODE (gnu_expr) == ERROR_MARK) - gnu_expr = 0; + if (type_annotate_only && gnu_expr && TREE_CODE (gnu_expr) == ERROR_MARK) + gnu_expr = NULL_TREE; if (No (Freeze_Node (gnat_temp))) gnat_to_gnu_entity (gnat_temp, gnu_expr, 1); @@ -2638,7 +2641,7 @@ gnat_to_gnu (Node_Id gnat_node) we are just annotating types and this object has a composite or task type, don't elaborate it. We return the result in case it has any SAVE_EXPRs in it that need to be evaluated here. */ - if (! Is_Renaming_Of_Object (gnat_temp) + if (!Is_Renaming_Of_Object (gnat_temp) && ! (type_annotate_only && (Is_Array_Type (Etype (gnat_temp)) || Is_Record_Type (Etype (gnat_temp)) @@ -2719,7 +2722,7 @@ gnat_to_gnu (Node_Id gnat_node) i < ndim; i++, gnu_type = TREE_TYPE (gnu_type)) { if (TREE_CODE (gnu_type) != ARRAY_TYPE) - gigi_abort (307); + abort (); gnat_temp = gnat_expr_array[i]; gnu_expr = gnat_to_gnu (gnat_temp); @@ -2861,8 +2864,8 @@ gnat_to_gnu (Node_Id gnat_node) == N_Attribute_Reference)); } - if (gnu_result == 0) - gigi_abort (308); + if (!gnu_result) + abort (); gnu_result_type = get_unpadded_type (Etype (gnat_node)); } @@ -2881,7 +2884,8 @@ gnat_to_gnu (Node_Id gnat_node) (create_concat_name (Entity (Prefix (gnat_node)), attribute == Attr_Elab_Body ? "elabb" : "elabs"), - NULL_TREE, void_ftype, NULL_TREE, 0, 1, 1, 0, gnat_node)); + NULL_TREE, void_ftype, NULL_TREE, false, true, true, NULL, + gnat_node)); gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attribute); } @@ -2945,7 +2949,7 @@ gnat_to_gnu (Node_Id gnat_node) (Next (First (Component_Associations (gnat_node)))))); else - gigi_abort (312); + abort (); gnu_result = convert (gnu_result_type, gnu_result); } @@ -2984,7 +2988,7 @@ gnat_to_gnu (Node_Id gnat_node) tree gnu_obj_type = TREE_TYPE (gnu_result_type); unsigned int oalign = TYPE_ALIGN (gnu_obj_type); - if (align != 0 && align < oalign && ! TYPE_ALIGN_OK (gnu_obj_type)) + if (align != 0 && align < oalign && !TYPE_ALIGN_OK (gnu_obj_type)) post_error_ne_tree_2 ("?source alignment (^) < alignment of & (^)", gnat_node, Designated_Type (Etype (gnat_node)), @@ -3019,7 +3023,7 @@ gnat_to_gnu (Node_Id gnat_node) gnu_high = TYPE_MAX_VALUE (gnu_range_type); } else - gigi_abort (313); + abort (); gnu_result_type = get_unpadded_type (Etype (gnat_node)); @@ -3115,7 +3119,7 @@ gnat_to_gnu (Node_Id gnat_node) /* If this is a shift whose count is not guaranteed to be correct, we need to adjust the shift count. */ if (IN (Nkind (gnat_node), N_Op_Shift) - && ! Shift_Count_OK (gnat_node)) + && !Shift_Count_OK (gnat_node)) { tree gnu_count_type = get_base_type (TREE_TYPE (gnu_rhs)); tree gnu_max_shift @@ -3140,7 +3144,7 @@ gnat_to_gnu (Node_Id gnat_node) /* For right shifts, the type says what kind of shift to do, so we may need to choose a different type. */ if (Nkind (gnat_node) == N_Op_Shift_Right - && ! TYPE_UNSIGNED (gnu_type)) + && !TYPE_UNSIGNED (gnu_type)) gnu_type = gnat_unsigned_type (gnu_type); else if (Nkind (gnat_node) == N_Op_Shift_Right_Arithmetic && TYPE_UNSIGNED (gnu_type)) @@ -3159,7 +3163,7 @@ gnat_to_gnu (Node_Id gnat_node) above in this case. */ if ((Nkind (gnat_node) == N_Op_Shift_Left || Nkind (gnat_node) == N_Op_Shift_Right) - && ! Shift_Count_OK (gnat_node)) + && !Shift_Count_OK (gnat_node)) gnu_result = build_cond_expr (gnu_type, @@ -3260,7 +3264,7 @@ gnat_to_gnu (Node_Id gnat_node) } } else - gigi_abort (315); + abort (); gnu_result_type = get_unpadded_type (Etype (gnat_node)); return build_allocator (gnu_type, gnu_init, gnu_result_type, @@ -3352,7 +3356,7 @@ gnat_to_gnu (Node_Id gnat_node) case N_Block_Statement: start_stmt_group (); gnat_pushlevel (); - process_decls (Declarations (gnat_node), Empty, Empty, 1, 1); + process_decls (Declarations (gnat_node), Empty, Empty, true, true); add_stmt (gnat_to_gnu (Handled_Statement_Sequence (gnat_node))); gnat_poplevel (); gnu_result = end_stmt_group (); @@ -3390,21 +3394,21 @@ gnat_to_gnu (Node_Id gnat_node) But if we have a return label defined, convert this into a branch to that label. */ - if (TREE_VALUE (gnu_return_label_stack) != 0) + if (TREE_VALUE (gnu_return_label_stack)) { gnu_result = build1 (GOTO_EXPR, void_type_node, TREE_VALUE (gnu_return_label_stack)); break; } - else if (TYPE_CI_CO_LIST (gnu_subprog_type) != NULL_TREE) + else if (TYPE_CI_CO_LIST (gnu_subprog_type)) { if (list_length (TYPE_CI_CO_LIST (gnu_subprog_type)) == 1) gnu_ret_val = TREE_VALUE (TYPE_CI_CO_LIST (gnu_subprog_type)); else gnu_ret_val = gnat_build_constructor (TREE_TYPE (gnu_subprog_type), - TYPE_CI_CO_LIST (gnu_subprog_type)); + TYPE_CI_CO_LIST (gnu_subprog_type)); } /* If the Ada subprogram is a function, we just need to return the @@ -3529,7 +3533,7 @@ gnat_to_gnu (Node_Id gnat_node) start_stmt_group (); process_decls (Visible_Declarations (gnat_node), - Private_Declarations (gnat_node), Empty, 1, 1); + Private_Declarations (gnat_node), Empty, true, true); gnu_result = end_stmt_group (); break; @@ -3543,7 +3547,7 @@ gnat_to_gnu (Node_Id gnat_node) } start_stmt_group (); - process_decls (Declarations (gnat_node), Empty, Empty, 1, 1); + process_decls (Declarations (gnat_node), Empty, Empty, true, true); if (Present (Handled_Statement_Sequence (gnat_node))) add_stmt (gnat_to_gnu (Handled_Statement_Sequence (gnat_node))); @@ -3587,12 +3591,12 @@ gnat_to_gnu (Node_Id gnat_node) /* For a body, first process the spec if there is one. */ if (Nkind (Unit (gnat_node)) == N_Package_Body || (Nkind (Unit (gnat_node)) == N_Subprogram_Body - && ! Acts_As_Spec (gnat_node))) + && !Acts_As_Spec (gnat_node))) add_stmt (gnat_to_gnu (Library_Unit (gnat_node))); process_inlined_subprograms (gnat_node); process_decls (Declarations (Aux_Decls_Node (gnat_node)), - Empty, Empty, 1, 1); + Empty, Empty, true, true); add_stmt (gnat_to_gnu (Unit (gnat_node))); /* Process any pragmas and actions following the unit. */ @@ -3623,12 +3627,12 @@ gnat_to_gnu (Node_Id gnat_node) /* If there is an At_End procedure attached to this node, and the EH mechanism is SJLJ, we must have at least a corresponding At_End handler, unless the No_Exception_Handlers restriction is set. */ - if (! type_annotate_only + if (!type_annotate_only && Exception_Mechanism == Setjmp_Longjmp && Present (At_End_Proc (gnat_node)) - && ! Present (Exception_Handlers (gnat_node)) - && ! No_Exception_Handlers_Set()) - gigi_abort (335); + && !Present (Exception_Handlers (gnat_node)) + && !No_Exception_Handlers_Set()) + abort (); gnu_result = Handled_Sequence_Of_Statements_to_gnu (gnat_node); break; @@ -3680,7 +3684,7 @@ gnat_to_gnu (Node_Id gnat_node) equivalent for GNAT_TEMP. When the object is frozen, gnat_to_gnu_entity will do the right thing. */ save_gnu_tree (Entity (Name (gnat_node)), - gnat_to_gnu (Expression (gnat_node)), 1); + gnat_to_gnu (Expression (gnat_node)), true); break; case N_Enumeration_Representation_Clause: @@ -3691,11 +3695,11 @@ gnat_to_gnu (Node_Id gnat_node) break; case N_Code_Statement: - if (! type_annotate_only) + if (!type_annotate_only) { tree gnu_template = gnat_to_gnu (Asm_Template (gnat_node)); - tree gnu_input_list = 0, gnu_output_list = 0; - tree gnu_clobber_list = 0; + tree gnu_input_list = NULL_TREE, gnu_output_list = NULL_TREE; + tree gnu_clobber_list = NULL_TREE; char *clobber; /* First process inputs, then outputs, then clobbers. */ @@ -3724,7 +3728,7 @@ gnat_to_gnu (Node_Id gnat_node) } Clobber_Setup (gnat_node); - while ((clobber = Clobber_Get_Next ()) != 0) + while ((clobber = Clobber_Get_Next ())) gnu_clobber_list = tree_cons (NULL_TREE, build_string (strlen (clobber) + 1, clobber), @@ -3749,19 +3753,19 @@ gnat_to_gnu (Node_Id gnat_node) case N_Freeze_Entity: start_stmt_group (); process_freeze_entity (gnat_node); - process_decls (Actions (gnat_node), Empty, Empty, 1, 1); + process_decls (Actions (gnat_node), Empty, Empty, true, true); gnu_result = end_stmt_group (); break; case N_Itype_Reference: - if (! present_gnu_tree (Itype (gnat_node))) + if (!present_gnu_tree (Itype (gnat_node))) process_type (Itype (gnat_node)); gnu_result = alloc_stmt_list (); break; case N_Free_Statement: - if (! type_annotate_only) + if (!type_annotate_only) { tree gnu_ptr = gnat_to_gnu (Expression (gnat_node)); tree gnu_obj_type; @@ -3880,8 +3884,8 @@ gnat_to_gnu (Node_Id gnat_node) case N_Component_Association: case N_Task_Body: default: - if (! type_annotate_only) - gigi_abort (321); + if (!type_annotate_only) + abort (); gnu_result = alloc_stmt_list (); } @@ -3951,22 +3955,22 @@ gnat_to_gnu (Node_Id gnat_node) || (Nkind (Parent (gnat_node)) == N_Procedure_Call_Statement && Name (Parent (gnat_node)) != gnat_node) || (Nkind (Parent (gnat_node)) == N_Unchecked_Type_Conversion - && ! AGGREGATE_TYPE_P (gnu_result_type) - && ! AGGREGATE_TYPE_P (TREE_TYPE (gnu_result))) + && !AGGREGATE_TYPE_P (gnu_result_type) + && !AGGREGATE_TYPE_P (TREE_TYPE (gnu_result))) || Nkind (Parent (gnat_node)) == N_Parameter_Association) - && ! (TYPE_SIZE (gnu_result_type) != 0 - && TYPE_SIZE (TREE_TYPE (gnu_result)) != 0 - && (AGGREGATE_TYPE_P (gnu_result_type) - == AGGREGATE_TYPE_P (TREE_TYPE (gnu_result))) - && ((TREE_CODE (TYPE_SIZE (gnu_result_type)) == INTEGER_CST - && (TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_result))) - != INTEGER_CST)) - || (TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST - && ! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type)) - && (CONTAINS_PLACEHOLDER_P - (TYPE_SIZE (TREE_TYPE (gnu_result)))))) - && ! (TREE_CODE (gnu_result_type) == RECORD_TYPE - && TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_result_type)))) + && !(TYPE_SIZE (gnu_result_type) + && TYPE_SIZE (TREE_TYPE (gnu_result)) + && (AGGREGATE_TYPE_P (gnu_result_type) + == AGGREGATE_TYPE_P (TREE_TYPE (gnu_result))) + && ((TREE_CODE (TYPE_SIZE (gnu_result_type)) == INTEGER_CST + && (TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_result))) + != INTEGER_CST)) + || (TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST + && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type)) + && (CONTAINS_PLACEHOLDER_P + (TYPE_SIZE (TREE_TYPE (gnu_result)))))) + && !(TREE_CODE (gnu_result_type) == RECORD_TYPE + && TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_result_type)))) { /* In this case remove padding only if the inner object is of self-referential size: in that case it must be an object of @@ -3984,7 +3988,7 @@ gnat_to_gnu (Node_Id gnat_node) else if (TREE_CODE (gnu_result) == LABEL_DECL || TREE_CODE (gnu_result) == FIELD_DECL || TREE_CODE (gnu_result) == ERROR_MARK - || (TYPE_SIZE (gnu_result_type) != 0 + || (TYPE_SIZE (gnu_result_type) && TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST && TREE_CODE (gnu_result) != INDIRECT_REF && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type))) @@ -4026,7 +4030,7 @@ record_code_position (Node_Id gnat_node) tree stmt_stmt = build (STMT_STMT, void_type_node, NULL_TREE); add_stmt_with_node (stmt_stmt, gnat_node); - save_gnu_tree (gnat_node, stmt_stmt, 1); + save_gnu_tree (gnat_node, stmt_stmt, true); } /* Insert the code for GNAT_NODE at the position saved for that node. */ @@ -4035,7 +4039,7 @@ static void insert_code_for (Node_Id gnat_node) { STMT_STMT_STMT (get_gnu_tree (gnat_node)) = gnat_to_gnu (gnat_node); - save_gnu_tree (gnat_node, NULL_TREE, 1); + save_gnu_tree (gnat_node, NULL_TREE, true); } /* Start a new statement group chained to the previous group. */ @@ -4069,7 +4073,7 @@ add_stmt (tree gnu_stmt) ??? If this is a DECL_EXPR for a VAR_DECL or CONST_DECL, we must walk the sizes and DECL_INITIAL since we won't be walking the BIND_EXPR here. This whole thing is a mess! */ - if (!current_function_decl) + if (global_bindings_p ()) { walk_tree (&gnu_stmt, mark_visited, NULL, NULL); if (TREE_CODE (gnu_stmt) == DECL_EXPR @@ -4353,7 +4357,10 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED, tree *post_p) convert (build_pointer_type (TREE_TYPE (expr)), integer_zero_node)); else - *expr_p = create_tmp_var (TREE_TYPE (expr), NULL); + { + *expr_p = create_tmp_var (TREE_TYPE (expr), NULL); + TREE_NO_WARNING (*expr_p) = 1; + } append_to_statement_list (TREE_OPERAND (expr, 0), post_p); return GS_OK; @@ -4364,6 +4371,20 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED, tree *post_p) *expr_p = TREE_OPERAND (*expr_p, 0); return GS_OK; + case COMPONENT_REF: + /* We have a kludge here. If the FIELD_DECL is from a fat pointer + and is from an early dummy type, replace it with the proper + FIELD_DECL. */ + if (TYPE_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) + && DECL_ORIGINAL_FIELD (TREE_OPERAND (*expr_p, 1))) + { + TREE_OPERAND (*expr_p, 1) + = DECL_ORIGINAL_FIELD (TREE_OPERAND (*expr_p, 1)); + return GS_OK; + } + + /* ... fall through ... */ + default: return GS_UNHANDLED; } @@ -4449,31 +4470,6 @@ gnat_gimplify_stmt (tree *stmt_p) } } -/* Generate the RTL for the body of GNU_DECL. If NESTED_P is nonzero, - then we are already in the process of generating RTL for another - function. */ - -static void -gnat_expand_body_1 (tree gnu_decl, bool nested_p) -{ - if (nested_p) - push_function_context (); - - tree_rest_of_compilation (gnu_decl, nested_p); - - if (nested_p) - pop_function_context (); -} - -/* Expand the body of GNU_DECL, which is not a nested function. */ - -void -gnat_expand_body (tree gnu_decl) -{ - if (DECL_INITIAL (gnu_decl) && DECL_INITIAL (gnu_decl) != error_mark_node) - gnat_expand_body_1 (gnu_decl, false); -} - /* Force references to each of the entities in packages GNAT_NODE with's so that the debugging information for all of them are identical in all clients. Operate recursively on anything it with's, but check @@ -4504,7 +4500,7 @@ elaborate_all_entities (Node_Id gnat_node) same generic unit repeatedly */ if (!present_gnu_tree (gnat_node)) - save_gnu_tree (gnat_node, integer_zero_node, 1); + save_gnu_tree (gnat_node, integer_zero_node, true); /* Save entities in all context units. A body may have an implicit_with on its own spec, if the context includes a child unit, so don't save @@ -4514,7 +4510,7 @@ elaborate_all_entities (Node_Id gnat_node) Present (gnat_with_clause); gnat_with_clause = Next (gnat_with_clause)) if (Nkind (gnat_with_clause) == N_With_Clause - && ! present_gnu_tree (Library_Unit (gnat_with_clause)) + && !present_gnu_tree (Library_Unit (gnat_with_clause)) && Library_Unit (gnat_with_clause) != Library_Unit (Cunit (Main_Unit))) { elaborate_all_entities (Library_Unit (gnat_with_clause)); @@ -4529,13 +4525,13 @@ elaborate_all_entities (Node_Id gnat_node) && Ekind (gnat_entity) != E_Package && Ekind (gnat_entity) != E_Package_Body && Ekind (gnat_entity) != E_Operator - && ! (IN (Ekind (gnat_entity), Type_Kind) - && ! Is_Frozen (gnat_entity)) - && ! ((Ekind (gnat_entity) == E_Procedure - || Ekind (gnat_entity) == E_Function) - && Is_Intrinsic_Subprogram (gnat_entity)) - && ! IN (Ekind (gnat_entity), Named_Kind) - && ! IN (Ekind (gnat_entity), Generic_Unit_Kind)) + && !(IN (Ekind (gnat_entity), Type_Kind) + && !Is_Frozen (gnat_entity)) + && !((Ekind (gnat_entity) == E_Procedure + || Ekind (gnat_entity) == E_Function) + && Is_Intrinsic_Subprogram (gnat_entity)) + && !IN (Ekind (gnat_entity), Named_Kind) + && !IN (Ekind (gnat_entity), Generic_Unit_Kind)) gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); } else if (Ekind (Entity (Name (gnat_with_clause))) == E_Generic_Package) @@ -4600,7 +4596,7 @@ process_freeze_entity (Node_Id gnat_node) /* Don't do anything for subprograms that may have been elaborated before their freeze nodes. This can happen, for example because of an inner call in an instance body. */ - if (gnu_old != 0 + if (gnu_old && TREE_CODE (gnu_old) == FUNCTION_DECL && (Ekind (gnat_entity) == E_Function || Ekind (gnat_entity) == E_Procedure)) @@ -4611,9 +4607,9 @@ process_freeze_entity (Node_Id gnat_node) delayed, this node was never delayed as it should have been. Also allow this to happen for concurrent types since we may have frozen both the Corresponding_Record_Type and this type. */ - if (gnu_old != 0 - && ! (TREE_CODE (gnu_old) == TYPE_DECL - && TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old)))) + if (gnu_old + && !(TREE_CODE (gnu_old) == TYPE_DECL + && TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old)))) { if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity)) @@ -4622,23 +4618,23 @@ process_freeze_entity (Node_Id gnat_node) else if (Is_Concurrent_Type (gnat_entity)) return; else - gigi_abort (320); + abort (); } /* Reset the saved tree, if any, and elaborate the object or type for real. If there is a full declaration, elaborate it and copy the type to GNAT_ENTITY. Likewise if this is the record subtype corresponding to a class wide type or subtype. */ - if (gnu_old != 0) + if (gnu_old) { - save_gnu_tree (gnat_entity, NULL_TREE, 0); + save_gnu_tree (gnat_entity, NULL_TREE, false); if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity)) && present_gnu_tree (Full_View (gnat_entity))) - save_gnu_tree (Full_View (gnat_entity), NULL_TREE, 0); + save_gnu_tree (Full_View (gnat_entity), NULL_TREE, false); if (Present (Class_Wide_Type (gnat_entity)) && Class_Wide_Type (gnat_entity) != gnat_entity) - save_gnu_tree (Class_Wide_Type (gnat_entity), NULL_TREE, 0); + save_gnu_tree (Class_Wide_Type (gnat_entity), NULL_TREE, false); } if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) @@ -4649,18 +4645,18 @@ process_freeze_entity (Node_Id gnat_node) /* The above call may have defined this entity (the simplest example of this is when we have a private enumeral type since the bounds will have the public view. */ - if (! present_gnu_tree (gnat_entity)) - save_gnu_tree (gnat_entity, gnu_new, 0); + if (!present_gnu_tree (gnat_entity)) + save_gnu_tree (gnat_entity, gnu_new, false); if (Present (Class_Wide_Type (gnat_entity)) && Class_Wide_Type (gnat_entity) != gnat_entity) - save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, 0); + save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, false); } else gnu_new = gnat_to_gnu_entity (gnat_entity, gnu_init, 1); /* If we've made any pointers to the old version of this type, we have to update them. */ - if (gnu_old != 0) + if (gnu_old) update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)), TREE_TYPE (gnu_new)); } @@ -4676,7 +4672,7 @@ process_inlined_subprograms (Node_Id gnat_node) /* If we can inline, generate RTL for all the inlined subprograms. Define the entity first so we set DECL_EXTERNAL. */ - if (optimize > 0 && ! flag_no_inline) + if (optimize > 0 && !flag_no_inline) for (gnat_entity = First_Inlined_Subprogram (gnat_node); Present (gnat_entity); gnat_entity = Next_Inlined_Subprogram (gnat_entity)) @@ -4716,7 +4712,7 @@ process_inlined_subprograms (Node_Id gnat_node) static void process_decls (List_Id gnat_decls, List_Id gnat_decls2, - Node_Id gnat_end_list, int pass1p, int pass2p) + Node_Id gnat_end_list, bool pass1p, bool pass2p) { List_Id gnat_decl_array[2]; Node_Id gnat_decl; @@ -4737,14 +4733,14 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2, == N_Package_Specification))) process_decls (Visible_Declarations (Specification (gnat_decl)), Private_Declarations (Specification (gnat_decl)), - Empty, 1, 0); + Empty, true, false); /* Similarly for any declarations in the actions of a freeze node. */ else if (Nkind (gnat_decl) == N_Freeze_Entity) { process_freeze_entity (gnat_decl); - process_decls (Actions (gnat_decl), Empty, Empty, 1, 0); + process_decls (Actions (gnat_decl), Empty, Empty, true, false); } /* Package bodies with freeze nodes get their elaboration deferred @@ -4818,10 +4814,10 @@ process_decls (List_Id gnat_decls, List_Id gnat_decls2, == N_Package_Specification))) process_decls (Visible_Declarations (Specification (gnat_decl)), Private_Declarations (Specification (gnat_decl)), - Empty, 0, 1); + Empty, false, true); else if (Nkind (gnat_decl) == N_Freeze_Entity) - process_decls (Actions (gnat_decl), Empty, Empty, 0, 1); + process_decls (Actions (gnat_decl), Empty, Empty, false, true); } } @@ -4914,11 +4910,10 @@ emit_index_check (tree gnu_array_object, gnu_expr, CE_Index_Check_Failed); } -/* Given GNU_COND which contains the condition corresponding to an access, - discriminant or range check, of value GNU_EXPR, build a COND_EXPR - that returns GNU_EXPR if GNU_COND is false and raises a - CONSTRAINT_ERROR if GNU_COND is true. REASON is the code that says - why the exception was raised. */ +/* GNU_COND contains the condition corresponding to an access, discriminant or + range check of value GNU_EXPR. Build a COND_EXPR that returns GNU_EXPR if + GNU_COND is false and raises a CONSTRAINT_ERROR if GNU_COND is true. + REASON is the code that says why the exception was raised. */ static tree emit_check (tree gnu_cond, tree gnu_expr, int reason) @@ -4959,11 +4954,8 @@ emit_check (tree gnu_cond, tree gnu_expr, int reason) truncation; otherwise round. */ static tree -convert_with_check (Entity_Id gnat_type, - tree gnu_expr, - int overflow_p, - int range_p, - int truncate_p) +convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflowp, + bool rangep, bool truncatep) { tree gnu_type = get_unpadded_type (gnat_type); tree gnu_in_type = TREE_TYPE (gnu_expr); @@ -4976,8 +4968,8 @@ convert_with_check (Entity_Id gnat_type, the input is not a floating type, just do the conversion. This shortcut is required to avoid problems with packed array types and simplifies code in all cases anyway. */ - if (! range_p && ! overflow_p && INTEGRAL_TYPE_P (gnu_base_type) - && ! FLOAT_TYPE_P (gnu_in_type)) + if (!rangep && !overflowp && INTEGRAL_TYPE_P (gnu_base_type) + && !FLOAT_TYPE_P (gnu_in_type)) return convert (gnu_type, gnu_expr); /* First convert the expression to its base type. This @@ -4991,8 +4983,8 @@ convert_with_check (Entity_Id gnat_type, /* If overflow checks are requested, we need to be sure the result will fit in the output base type. But don't do this if the input is integer and the output floating-point. */ - if (overflow_p - && ! (FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_basetype))) + if (overflowp + && !(FLOAT_TYPE_P (gnu_base_type) && INTEGRAL_TYPE_P (gnu_in_basetype))) { /* Ensure GNU_EXPR only gets evaluated once. */ tree gnu_input = protect_multiple_eval (gnu_result); @@ -5054,7 +5046,7 @@ convert_with_check (Entity_Id gnat_type, convert (gnu_in_basetype, gnu_out_ub)))); - if (! integer_zerop (gnu_cond)) + if (!integer_zerop (gnu_cond)) gnu_result = emit_check (gnu_cond, gnu_input, CE_Overflow_Check_Failed); } @@ -5062,7 +5054,7 @@ convert_with_check (Entity_Id gnat_type, /* Now convert to the result base type. If this is a non-truncating float-to-integer conversion, round. */ if (INTEGRAL_TYPE_P (gnu_ada_base_type) && FLOAT_TYPE_P (gnu_in_basetype) - && ! truncate_p) + && !truncatep) { tree gnu_point_5 = build_real (gnu_in_basetype, dconstp5); tree gnu_minus_point_5 = build_real (gnu_in_basetype, dconstmp5); @@ -5080,7 +5072,7 @@ convert_with_check (Entity_Id gnat_type, if (TREE_CODE (gnu_ada_base_type) == INTEGER_TYPE && TYPE_HAS_ACTUAL_BOUNDS_P (gnu_ada_base_type) && TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF) - gnu_result = unchecked_convert (gnu_ada_base_type, gnu_result, 0); + gnu_result = unchecked_convert (gnu_ada_base_type, gnu_result, false); else gnu_result = convert (gnu_ada_base_type, gnu_result); @@ -5088,9 +5080,9 @@ convert_with_check (Entity_Id gnat_type, result type is a modular type, the range check is actually an overflow check. */ - if (range_p + if (rangep || (TREE_CODE (gnu_base_type) == INTEGER_TYPE - && TYPE_MODULAR_P (gnu_base_type) && overflow_p)) + && TYPE_MODULAR_P (gnu_base_type) && overflowp)) gnu_result = emit_range_check (gnu_result, gnat_type); return convert (gnu_type, gnu_result); @@ -5101,7 +5093,7 @@ convert_with_check (Entity_Id gnat_type, reference. This returns the same as gnat_mark_addressable in most cases. */ -static int +static bool addressable_p (tree gnu_expr) { switch (TREE_CODE (gnu_expr)) @@ -5112,19 +5104,19 @@ addressable_p (tree gnu_expr) case RESULT_DECL: /* All DECLs are addressable: if they are in a register, we can force them to memory. */ - return 1; + return true; case UNCONSTRAINED_ARRAY_REF: case INDIRECT_REF: case CONSTRUCTOR: case NULL_EXPR: case SAVE_EXPR: - return 1; + return true; case COMPONENT_REF: - return (! DECL_BIT_FIELD (TREE_OPERAND (gnu_expr, 1)) - && (! DECL_NONADDRESSABLE_P (TREE_OPERAND (gnu_expr, 1)) - || ! flag_strict_aliasing) + return (!DECL_BIT_FIELD (TREE_OPERAND (gnu_expr, 1)) + && (!DECL_NONADDRESSABLE_P (TREE_OPERAND (gnu_expr, 1)) + || !flag_strict_aliasing) && addressable_p (TREE_OPERAND (gnu_expr, 0))); case ARRAY_REF: case ARRAY_RANGE_REF: @@ -5155,7 +5147,7 @@ addressable_p (tree gnu_expr) } default: - return 0; + return false; } } @@ -5180,20 +5172,20 @@ process_type (Entity_Id gnat_entity) || (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity)) && Freeze_Node (Full_View (gnat_entity)) - && ! present_gnu_tree (Full_View (gnat_entity)))) + && !present_gnu_tree (Full_View (gnat_entity)))) { elaborate_entity (gnat_entity); - if (gnu_old == 0) + if (!gnu_old) { tree gnu_decl = create_type_decl (get_entity_name (gnat_entity), make_dummy_type (gnat_entity), - 0, 0, 0, gnat_entity); + NULL, false, false, gnat_entity); - save_gnu_tree (gnat_entity, gnu_decl, 0); + save_gnu_tree (gnat_entity, gnu_decl, false); if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity))) - save_gnu_tree (Full_View (gnat_entity), gnu_decl, 0); + save_gnu_tree (Full_View (gnat_entity), gnu_decl, false); } return; @@ -5203,10 +5195,10 @@ process_type (Entity_Id gnat_entity) made the type that corresponds to the full type of an incomplete type. Clear that type for now and then update the type in the pointers. */ - if (gnu_old != 0) + if (gnu_old) { if (TREE_CODE (gnu_old) != TYPE_DECL - || ! TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old))) + || !TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old))) { /* If this was a withed access type, this is not an error and merely indicates we've already elaborated the type @@ -5214,20 +5206,20 @@ process_type (Entity_Id gnat_entity) if (Is_Type (gnat_entity) && From_With_Type (gnat_entity)) return; - gigi_abort (323); + abort (); } - save_gnu_tree (gnat_entity, NULL_TREE, 0); + save_gnu_tree (gnat_entity, NULL_TREE, false); } /* Now fully elaborate the type. */ gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1); if (TREE_CODE (gnu_new) != TYPE_DECL) - gigi_abort (324); + abort (); /* If we have an old type and we've made pointers to this type, update those pointers. */ - if (gnu_old != 0) + if (gnu_old) update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)), TREE_TYPE (gnu_new)); @@ -5244,9 +5236,9 @@ process_type (Entity_Id gnat_entity) = get_gnu_tree (Corresponding_Concurrent_Type (gnat_entity)); save_gnu_tree (Corresponding_Concurrent_Type (gnat_entity), - NULL_TREE, 0); + NULL_TREE, false); save_gnu_tree (Corresponding_Concurrent_Type (gnat_entity), - gnu_new, 0); + gnu_new, false); update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_task_old)), TREE_TYPE (gnu_new)); @@ -5278,7 +5270,7 @@ assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type) /* The expander is supposed to put a single component selector name in every record component association */ if (Next (gnat_field)) - gigi_abort (328); + abort (); /* Before assigning a value in an aggregate make sure range checks are done if required. Then convert to the type of the field. */ @@ -5295,8 +5287,8 @@ assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type) /* Verify every enty in GNU_LIST was used. */ for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field)) - if (! TREE_ADDRESSABLE (gnu_field)) - gigi_abort (311); + if (!TREE_ADDRESSABLE (gnu_field)) + abort (); return gnu_result; } @@ -5364,7 +5356,7 @@ extract_values (tree values, tree record_type) /* _Parent is an internal field, but may have values in the aggregate, so check for values first. */ - if ((tem = purpose_member (field, values)) != 0) + if ((tem = purpose_member (field, values))) { value = TREE_VALUE (tem); TREE_ADDRESSABLE (tem) = 1; @@ -5373,8 +5365,7 @@ extract_values (tree values, tree record_type) else if (DECL_INTERNAL_P (field)) { value = extract_values (values, TREE_TYPE (field)); - if (TREE_CODE (value) == CONSTRUCTOR - && CONSTRUCTOR_ELTS (value) == 0) + if (TREE_CODE (value) == CONSTRUCTOR && !CONSTRUCTOR_ELTS (value)) value = 0; } else @@ -5387,7 +5378,7 @@ extract_values (tree values, tree record_type) TREE_ADDRESSABLE (tem) = 1; } - if (value == 0) + if (!value) continue; result = tree_cons (field, value, result); @@ -5423,7 +5414,7 @@ protect_multiple_eval (tree exp) tree type = TREE_TYPE (exp); /* If this has no side effects, we don't need to do anything. */ - if (! TREE_SIDE_EFFECTS (exp)) + if (!TREE_SIDE_EFFECTS (exp)) return exp; /* If it is a conversion, protect what's inside the conversion. @@ -5457,7 +5448,7 @@ protect_multiple_eval (tree exp) whether to force evaluation of everything. */ tree -gnat_stabilize_reference (tree ref, int force) +gnat_stabilize_reference (tree ref, bool force) { tree type = TREE_TYPE (ref); enum tree_code code = TREE_CODE (ref); @@ -5555,7 +5546,7 @@ gnat_stabilize_reference (tree ref, int force) arg to force a SAVE_EXPR for everything. */ static tree -gnat_stabilize_reference_1 (tree e, int force) +gnat_stabilize_reference_1 (tree e, bool force) { enum tree_code code = TREE_CODE (e); tree type = TREE_TYPE (e); @@ -5792,7 +5783,7 @@ post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t) else start_yes = '[', end_yes = ']', start_no = '{', end_no = '}'; - for (p = msg, q = newmsg; *p != 0; p++) + for (p = msg, q = newmsg; *p; p++) { if (*p == start_yes) for (p++; *p != end_yes; p++) @@ -5833,21 +5824,6 @@ set_second_error_entity (Entity_Id e) Error_Msg_Node_2 = e; } -/* Signal abort, with "Gigi abort" as the error label, and error_gnat_node - as the relevant node that provides the location info for the error */ - -void -gigi_abort (int code) -{ - String_Template temp = {1, 10}; - Fat_Pointer fp; - - fp.Array = "Gigi abort", fp.Bounds = &temp; - - Current_Error_Node = error_gnat_node; - Compiler_Abort (fp, code); -} - /* Initialize the table that maps GNAT codes to GCC codes for simple binary and unary operations. */ diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index e307def7e80..2dc27d39b71 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -149,7 +149,7 @@ init_gnat_to_gnu (void) If GNU_DECL is zero, a previous association is to be reset. */ void -save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, int no_check) +save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check) { /* Check that GNAT_ENTITY is not already defined and that it is being set to something which is a decl. Raise gigi 401 if not. Usually, this @@ -157,8 +157,8 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, int no_check) Gigi problem. */ if (gnu_decl && (associate_gnat_to_gnu[gnat_entity - First_Node_Id] - || (! no_check && ! DECL_P (gnu_decl)))) - gigi_abort (401); + || (!no_check && !DECL_P (gnu_decl)))) + abort (); associate_gnat_to_gnu[gnat_entity - First_Node_Id] = gnu_decl; } @@ -173,18 +173,18 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, int no_check) tree get_gnu_tree (Entity_Id gnat_entity) { - if (! associate_gnat_to_gnu[gnat_entity - First_Node_Id]) - gigi_abort (402); + if (!associate_gnat_to_gnu[gnat_entity - First_Node_Id]) + abort (); return associate_gnat_to_gnu[gnat_entity - First_Node_Id]; } /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */ -int +bool present_gnu_tree (Entity_Id gnat_entity) { - return (associate_gnat_to_gnu[gnat_entity - First_Node_Id] != NULL_TREE); + return (associate_gnat_to_gnu[gnat_entity - First_Node_Id]) != 0; } @@ -193,8 +193,8 @@ present_gnu_tree (Entity_Id gnat_entity) int global_bindings_p (void) { - return (force_global != 0 || current_binding_level == 0 - || current_binding_level->chain == 0 ? -1 : 0); + return (force_global || !current_binding_level + || !current_binding_level->chain ? -1 : 0); } /* Enter a new binding level. */ @@ -356,12 +356,12 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) for now). */ if (TREE_CODE (decl) == TYPE_DECL - && DECL_NAME (decl) != 0 - && (TYPE_NAME (TREE_TYPE (decl)) == 0 + && DECL_NAME (decl) + && (!TYPE_NAME (TREE_TYPE (decl)) || TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) == IDENTIFIER_NODE || (TREE_CODE (TYPE_NAME (TREE_TYPE (decl))) == TYPE_DECL && DECL_ARTIFICIAL (TYPE_NAME (TREE_TYPE (decl))) - && ! DECL_ARTIFICIAL (decl)))) + && !DECL_ARTIFICIAL (decl)))) TYPE_NAME (TREE_TYPE (decl)) = decl; if (TREE_CODE (decl) != CONST_DECL) @@ -531,7 +531,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) TYPE_PRECISION (longest_float_type_node) = LONG_DOUBLE_TYPE_SIZE; layout_type (longest_float_type_node); create_type_decl (get_identifier ("longest float type"), - longest_float_type_node, NULL, 0, 1, Empty); + longest_float_type_node, NULL, false, true, Empty); } else longest_float_type_node = TREE_TYPE (long_long_float_type); @@ -540,10 +540,11 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) unsigned_type_node = gnat_type_for_size (INT_TYPE_SIZE, 1); create_type_decl (get_identifier ("unsigned int"), unsigned_type_node, - NULL, 0, 1, Empty); + NULL, false, true, Empty); void_type_decl_node = create_type_decl (get_identifier ("void"), - void_type_node, NULL, 0, 1, Empty); + void_type_node, NULL, false, true, + Empty); void_ftype = build_function_type (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); @@ -559,7 +560,8 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, sizetype, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, + Empty); /* free is a function declaration tree for a function to free memory. */ free_decl @@ -568,14 +570,14 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, ptr_void_type_node, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Make the types and functions used for exception processing. */ jmpbuf_type = build_array_type (gnat_type_for_mode (Pmode, 0), build_index_type (build_int_2 (5, 0))); create_type_decl (get_identifier ("JMPBUF_T"), jmpbuf_type, NULL, - 0, 1, Empty); + false, true, Empty); jmpbuf_ptr_type = build_pointer_type (jmpbuf_type); /* Functions to get and set the jumpbuf pointer for the current thread. */ @@ -583,7 +585,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) = create_subprog_decl (get_identifier ("system__soft_links__get_jmpbuf_address_soft"), NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); set_jmpbuf_decl = create_subprog_decl @@ -591,7 +593,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) NULL_TREE, build_function_type (void_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Function to get the current exception. */ get_excptr_decl @@ -599,7 +601,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) (get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE, build_function_type (build_pointer_type (except_type_node), NULL_TREE), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Functions that raise exceptions. */ raise_nodefer_decl @@ -609,7 +611,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, build_pointer_type (except_type_node), endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* Hooks to call when entering/leaving an exception handler. */ begin_handler_decl @@ -618,7 +620,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, ptr_void_type_node, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); end_handler_decl = create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE, @@ -626,7 +628,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, ptr_void_type_node, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); /* If in no exception handlers mode, all raise statements are redirected to __gnat_last_chance_handler. No need to redefine raise_nodefer_decl, since @@ -642,7 +644,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, integer_type_node, endlink))), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); for (i = 0; i < ARRAY_SIZE (gnat_raise_decls); i++) gnat_raise_decls[i] = decl; @@ -664,7 +666,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) tree_cons (NULL_TREE, integer_type_node, endlink))), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); } /* Indicate that these never return. */ @@ -690,7 +692,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) (get_identifier ("__builtin_setjmp"), NULL_TREE, build_function_type (integer_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP; @@ -702,7 +704,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) (get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE, build_function_type (void_type_node, tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), - NULL_TREE, 0, 1, 1, 0, Empty); + NULL_TREE, false, true, true, NULL, Empty); DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF; @@ -712,19 +714,19 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) /* Given a record type (RECORD_TYPE) and a chain of FIELD_DECL nodes (FIELDLIST), finish constructing the record or union type. If HAS_REP is - nonzero, this record has a rep clause; don't call layout_type but merely set - the size and alignment ourselves. If DEFER_DEBUG is nonzero, do not call + true, this record has a rep clause; don't call layout_type but merely set + the size and alignment ourselves. If DEFER_DEBUG is true, do not call the debugging routines on this type; it will be done later. */ void -finish_record_type (tree record_type, tree fieldlist, int has_rep, - int defer_debug) +finish_record_type (tree record_type, tree fieldlist, bool has_rep, + bool defer_debug) { enum tree_code code = TREE_CODE (record_type); tree ada_size = bitsize_zero_node; tree size = bitsize_zero_node; tree size_unit = size_zero_node; - int var_size = 0; + bool var_size = false; tree field; TYPE_FIELDS (record_type) = fieldlist; @@ -742,7 +744,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, { TYPE_ALIGN (record_type) = MAX (BITS_PER_UNIT, TYPE_ALIGN (record_type)); TYPE_MODE (record_type) = BLKmode; - if (TYPE_SIZE (record_type) == 0) + if (!TYPE_SIZE (record_type)) { TYPE_SIZE (record_type) = bitsize_zero_node; TYPE_SIZE_UNIT (record_type) = size_zero_node; @@ -789,13 +791,13 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, output routines (except Dwarf2) won't be able to output the fields, so we need to make the special record. */ if (TREE_CODE (this_size) != INTEGER_CST) - var_size = 1; + var_size = true; if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == QUAL_UNION_TYPE) - && ! TYPE_IS_FAT_POINTER_P (type) - && ! TYPE_CONTAINS_TEMPLATE_P (type) - && TYPE_ADA_SIZE (type) != 0) + && !TYPE_IS_FAT_POINTER_P (type) + && !TYPE_CONTAINS_TEMPLATE_P (type) + && TYPE_ADA_SIZE (type)) this_ada_size = TYPE_ADA_SIZE (type); /* Clear DECL_BIT_FIELD for the cases layout_decl does not handle. */ @@ -811,7 +813,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, DECL_NONADDRESSABLE_P (field) |= DECL_BIT_FIELD (field) && DECL_MODE (field) != BLKmode; - if (has_rep && ! DECL_BIT_FIELD (field)) + if (has_rep && !DECL_BIT_FIELD (field)) TYPE_ALIGN (record_type) = MAX (TYPE_ALIGN (record_type), DECL_ALIGN (field)); @@ -863,22 +865,22 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, /* If this is a padding record, we never want to make the size smaller than what was specified in it, if any. */ if (TREE_CODE (record_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type) != 0) + && TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type)) { size = TYPE_SIZE (record_type); size_unit = TYPE_SIZE_UNIT (record_type); } /* Now set any of the values we've just computed that apply. */ - if (! TYPE_IS_FAT_POINTER_P (record_type) - && ! TYPE_CONTAINS_TEMPLATE_P (record_type)) + if (!TYPE_IS_FAT_POINTER_P (record_type) + && !TYPE_CONTAINS_TEMPLATE_P (record_type)) SET_TYPE_ADA_SIZE (record_type, ada_size); if (has_rep) { - if (! (TREE_CODE (record_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (record_type) - && CONTAINS_PLACEHOLDER_P (size))) + if (!(TREE_CODE (record_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (record_type) + && CONTAINS_PLACEHOLDER_P (size))) { TYPE_SIZE (record_type) = round_up (size, TYPE_ALIGN (record_type)); TYPE_SIZE_UNIT (record_type) @@ -889,7 +891,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, compute_record_mode (record_type); } - if (! defer_debug) + if (!defer_debug) { /* If this record is of variable size, rename it so that the debugger knows it is and make a new, parallel, record @@ -897,8 +899,8 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, exp_dbug.ads. But don't do this for records that are padding since they confuse GDB. */ if (var_size - && ! (TREE_CODE (record_type) == RECORD_TYPE - && TYPE_IS_PADDING_P (record_type))) + && !(TREE_CODE (record_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (record_type))) { tree new_record_type = make_node (TREE_CODE (record_type) == QUAL_UNION_TYPE @@ -923,17 +925,19 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, DECL_IGNORED_P (TYPE_STUB_DECL (new_record_type)) = DECL_IGNORED_P (TYPE_STUB_DECL (record_type)); TYPE_SIZE (new_record_type) = size_int (TYPE_ALIGN (record_type)); + TYPE_SIZE_UNIT (new_record_type) + = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT); /* Now scan all the fields, replacing each field with a new field corresponding to the new encoding. */ - for (old_field = TYPE_FIELDS (record_type); old_field != 0; + for (old_field = TYPE_FIELDS (record_type); old_field; old_field = TREE_CHAIN (old_field)) { tree field_type = TREE_TYPE (old_field); tree field_name = DECL_NAME (old_field); tree new_field; tree curpos = bit_position (old_field); - int var = 0; + bool var = false; unsigned int align = 0; tree pos; @@ -953,14 +957,14 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, else pos = compute_related_constant (curpos, last_pos); - if (pos == 0 && TREE_CODE (curpos) == MULT_EXPR + if (!pos && TREE_CODE (curpos) == MULT_EXPR && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST) { align = TREE_INT_CST_LOW (TREE_OPERAND (curpos, 1)); pos = compute_related_constant (curpos, round_up (last_pos, align)); } - else if (pos == 0 && TREE_CODE (curpos) == PLUS_EXPR + else if (!pos && TREE_CODE (curpos) == PLUS_EXPR && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST && TREE_CODE (TREE_OPERAND (curpos, 0)) == MULT_EXPR && host_integerp (TREE_OPERAND @@ -986,7 +990,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, ??? We really should abort here, but it's too much work to get this correct for all cases. */ - if (pos == 0) + if (!pos) pos = bitsize_zero_node; /* See if this type is variable-size and make a new type @@ -994,7 +998,7 @@ finish_record_type (tree record_type, tree fieldlist, int has_rep, if (TREE_CODE (DECL_SIZE (old_field)) != INTEGER_CST) { field_type = build_pointer_type (field_type); - var = 1; + var = true; } /* Make a new field name, if necessary. */ @@ -1056,7 +1060,7 @@ merge_sizes (tree last_size, tree first_bit, tree size, bool special, tree type = TREE_TYPE (last_size); tree new; - if (! special || TREE_CODE (size) != COND_EXPR) + if (!special || TREE_CODE (size) != COND_EXPR) { new = size_binop (PLUS_EXPR, first_bit, size); if (has_rep) @@ -1149,10 +1153,11 @@ split_plus (tree in, tree *pvar) object. RETURNS_BY_REF is nonzero if the function returns by reference. RETURNS_WITH_DSP is nonzero if the function is to return with a depressed stack pointer. */ + tree create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, - int returns_unconstrained, int returns_by_ref, - int returns_with_dsp) + bool returns_unconstrained, bool returns_by_ref, + bool returns_with_dsp) { /* A chain of TREE_LIST nodes whose TREE_VALUEs are the data type nodes of the subprogram formal parameters. This list is generated by traversing the @@ -1164,7 +1169,7 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, for (param_decl = param_decl_list; param_decl; param_decl = TREE_CHAIN (param_decl)) param_type_list = tree_cons (NULL_TREE, TREE_TYPE (param_decl), - param_type_list); + param_type_list); /* The list of the function parameter types has to be terminated by the void type to signal to the back-end that we are not dealing with a variable @@ -1181,7 +1186,7 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, /* TYPE may have been shared since GCC hashes types. If it has a CICO_LIST or the new type should, make a copy of TYPE. Likewise for RETURNS_UNCONSTRAINED and RETURNS_BY_REF. */ - if (TYPE_CI_CO_LIST (type) != 0 || cico_list != 0 + if (TYPE_CI_CO_LIST (type) || cico_list || TYPE_RETURNS_UNCONSTRAINED_P (type) != returns_unconstrained || TYPE_RETURNS_BY_REF_P (type) != returns_by_ref) type = copy_type (type); @@ -1228,24 +1233,24 @@ create_index_type (tree min, tree max, tree index) only a small hole. */ if (TYPE_INDEX_TYPE (type) == index) return type; - else if (TYPE_INDEX_TYPE (type) != 0) + else if (TYPE_INDEX_TYPE (type)) type = copy_type (type); SET_TYPE_INDEX_TYPE (type, index); - create_type_decl (NULL_TREE, type, NULL, 1, 0, Empty); + create_type_decl (NULL_TREE, type, NULL, true, false, Empty); return type; } /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type (a character string) and TYPE is a ..._TYPE node giving its data type. - ARTIFICIAL_P is nonzero if this is a declaration that was generated - by the compiler. DEBUG_INFO_P is nonzero if we need to write debugging + ARTIFICIAL_P is true if this is a declaration that was generated + by the compiler. DEBUG_INFO_P is true if we need to write debugging information about this type. GNAT_NODE is used for the position of the decl. */ tree create_type_decl (tree type_name, tree type, struct attrib *attr_list, - int artificial_p, int debug_info_p, Node_Id gnat_node) + bool artificial_p, bool debug_info_p, Node_Id gnat_node) { tree type_decl = build_decl (TYPE_DECL, type_name, type); enum tree_code code = TREE_CODE (type); @@ -1260,11 +1265,11 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, a dummy type, which will be completed later, or a type for which debugging information was not requested. */ if (code == UNCONSTRAINED_ARRAY_TYPE || TYPE_IS_DUMMY_P (type) - || ! debug_info_p) + || !debug_info_p) DECL_IGNORED_P (type_decl) = 1; else if (code != ENUMERAL_TYPE && code != RECORD_TYPE - && ! ((code == POINTER_TYPE || code == REFERENCE_TYPE) - && TYPE_IS_DUMMY_P (TREE_TYPE (type)))) + && !((code == POINTER_TYPE || code == REFERENCE_TYPE) + && TYPE_IS_DUMMY_P (TREE_TYPE (type)))) rest_of_decl_compilation (type_decl, NULL, global_bindings_p (), 0); if (!TYPE_IS_DUMMY_P (type)) @@ -1278,9 +1283,9 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, (a GCC ..._TYPE node). VAR_INIT is the GCC tree for an optional initial expression; NULL_TREE if none. - CONST_FLAG is nonzero if this variable is constant. + CONST_FLAG is true if this variable is constant. - PUBLIC_FLAG is nonzero if this definition is to be made visible outside of + PUBLIC_FLAG is true if this definition is to be made visible outside of the current compilation unit. This flag should be set when processing the variable definitions in a package specification. EXTERN_FLAG is nonzero when processing an external variable declaration (as opposed to a @@ -1293,12 +1298,12 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, tree create_var_decl (tree var_name, tree asm_name, tree type, tree var_init, - int const_flag, int public_flag, int extern_flag, - int static_flag, struct attrib *attr_list, Node_Id gnat_node) + bool const_flag, bool public_flag, bool extern_flag, + bool static_flag, struct attrib *attr_list, Node_Id gnat_node) { - int init_const - = (var_init == 0 - ? 0 + bool init_const + = (!var_init + ? false : (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (var_init)) && (global_bindings_p () || static_flag ? 0 != initializer_constant_valid_p (var_init, @@ -1321,8 +1326,8 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init, just annotating types, throw away the initialization if it isn't a constant. */ if ((extern_flag && TREE_CODE (var_decl) != CONST_DECL) - || (type_annotate_only && var_init != 0 && ! TREE_CONSTANT (var_init))) - var_init = 0; + || (type_annotate_only && var_init && !TREE_CONSTANT (var_init))) + var_init = NULL_TREE; DECL_INITIAL (var_decl) = var_init; TREE_READONLY (var_decl) = const_flag; @@ -1337,7 +1342,7 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init, we allocate automatic storage unless requested not to. */ TREE_STATIC (var_decl) = global_bindings_p () ? !extern_flag : static_flag; - if (asm_name != 0) + if (asm_name) SET_DECL_ASSEMBLER_NAME (var_decl, asm_name); process_attributes (var_decl, attr_list); @@ -1380,7 +1385,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type, We always set a size in this case to trigger the checks for bitfield creation below, which is typically required when no position has been specified. */ - if (size != 0) + if (size) size = convert (bitsizetype, size); else if (packed == 1) { @@ -1408,35 +1413,35 @@ create_field_decl (tree field_name, tree field_type, tree record_type, We also don't look at STRICT_ALIGNMENT here, and rely on later processing in layout_decl or finish_record_type to clear the bit_field indication if it is in fact not needed. */ - if (size != 0 && TREE_CODE (size) == INTEGER_CST + if (size && TREE_CODE (size) == INTEGER_CST && TREE_CODE (TYPE_SIZE (field_type)) == INTEGER_CST - && ! addressable - && (! operand_equal_p (TYPE_SIZE (field_type), size, 0) - || (pos != 0 - && ! value_zerop (size_binop (TRUNC_MOD_EXPR, pos, - bitsize_int (TYPE_ALIGN - (field_type))))) + && !addressable + && (!operand_equal_p (TYPE_SIZE (field_type), size, 0) + || (pos + && !value_zerop (size_binop (TRUNC_MOD_EXPR, pos, + bitsize_int (TYPE_ALIGN + (field_type))))) || packed || (TYPE_ALIGN (record_type) != 0 && TYPE_ALIGN (record_type) < TYPE_ALIGN (field_type)))) { DECL_BIT_FIELD (field_decl) = 1; DECL_SIZE (field_decl) = size; - if (! packed && pos == 0) + if (!packed && !pos) DECL_ALIGN (field_decl) = (TYPE_ALIGN (record_type) != 0 ? MIN (TYPE_ALIGN (record_type), TYPE_ALIGN (field_type)) : TYPE_ALIGN (field_type)); } - DECL_PACKED (field_decl) = pos != 0 ? DECL_BIT_FIELD (field_decl) : packed; + DECL_PACKED (field_decl) = pos ? DECL_BIT_FIELD (field_decl) : packed; DECL_ALIGN (field_decl) = MAX (DECL_ALIGN (field_decl), DECL_BIT_FIELD (field_decl) ? 1 : packed && TYPE_MODE (field_type) != BLKmode ? BITS_PER_UNIT : TYPE_ALIGN (field_type)); - if (pos != 0) + if (pos) { /* We need to pass in the alignment the DECL is known to have. This is the lowest-order bit set in POS, but no more than @@ -1482,7 +1487,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type, copy. This is the case for true bitfields, but the DECL_BIT_FIELD value we have at this point is not accurate enough, so we don't account for this here and let finish_record_type decide. */ - DECL_NONADDRESSABLE_P (field_decl) = ! addressable; + DECL_NONADDRESSABLE_P (field_decl) = !addressable; return field_decl; } @@ -1500,12 +1505,12 @@ value_zerop (tree exp) } /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter, - PARAM_TYPE is its type. READONLY is nonzero if the parameter is + PARAM_TYPE is its type. READONLY is true if the parameter is readonly (either an IN parameter or an address of a pass-by-ref parameter). */ tree -create_param_decl (tree param_name, tree param_type, int readonly) +create_param_decl (tree param_name, tree param_type, bool readonly) { tree param_decl = build_decl (PARM_DECL, param_name, param_type); @@ -1606,7 +1611,7 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) { /* If this is the first field of the record, there cannot be any gap */ if (!prev_field) - return 0; + return false; /* If the previous field is a union type, then return False: The only time when such a field is not the last field of the record is when @@ -1614,13 +1619,13 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) was a rep clause for every field), in which case we don't want the alignment constraint to override them. */ if (TREE_CODE (TREE_TYPE (prev_field)) == QUAL_UNION_TYPE) - return 0; + return false; /* If the distance between the end of prev_field and the begining of curr_field is constant, then there is a gap if the value of this constant is not null. */ if (offset && host_integerp (offset, 1)) - return (!integer_zerop (offset)); + return !integer_zerop (offset); /* If the size and position of the previous field are constant, then check the sum of this size and position. There will be a gap @@ -1635,10 +1640,10 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) of the current field alignment, there can not be any gap. */ if (value_factor_p (bit_position (prev_field), DECL_ALIGN (curr_field)) && value_factor_p (DECL_SIZE (prev_field), DECL_ALIGN (curr_field))) - return 0; + return false; /* Fallback, return that there may be a potential gap */ - return 1; + return true; } /* Returns a LABEL_DECL node for LABEL_NAME. */ @@ -1665,8 +1670,8 @@ create_label_decl (tree label_name) tree create_subprog_decl (tree subprog_name, tree asm_name, - tree subprog_type, tree param_decl_list, int inline_flag, - int public_flag, int extern_flag, + tree subprog_type, tree param_decl_list, bool inline_flag, + bool public_flag, bool extern_flag, struct attrib *attr_list, Node_Id gnat_node) { tree return_type = TREE_TYPE (subprog_type); @@ -1675,9 +1680,9 @@ create_subprog_decl (tree subprog_name, tree asm_name, /* If this is a function nested inside an inlined external function, it means we aren't going to compile the outer function unless it is actually inlined, so do the same for us. */ - if (current_function_decl != 0 && DECL_INLINE (current_function_decl) + if (current_function_decl && DECL_INLINE (current_function_decl) && DECL_EXTERNAL (current_function_decl)) - extern_flag = 1; + extern_flag = true; DECL_EXTERNAL (subprog_decl) = extern_flag; TREE_PUBLIC (subprog_decl) = public_flag; @@ -1693,7 +1698,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, if (inline_flag) DECL_DECLARED_INLINE_P (subprog_decl) = 1; - if (asm_name != 0) + if (asm_name) SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name); process_attributes (subprog_decl, attr_list); @@ -1859,7 +1864,7 @@ gnat_type_for_size (unsigned precision, int unsignedp) char type_name[20]; if (precision <= 2 * MAX_BITS_PER_WORD - && signed_and_unsigned_types[precision][unsignedp] != 0) + && signed_and_unsigned_types[precision][unsignedp]) return signed_and_unsigned_types[precision][unsignedp]; if (unsignedp) @@ -1870,7 +1875,7 @@ gnat_type_for_size (unsigned precision, int unsignedp) if (precision <= 2 * MAX_BITS_PER_WORD) signed_and_unsigned_types[precision][unsignedp] = t; - if (TYPE_NAME (t) == 0) + if (!TYPE_NAME (t)) { sprintf (type_name, "%sSIGNED_%d", unsignedp ? "UN" : "", precision); TYPE_NAME (t) = get_identifier (type_name); @@ -1887,7 +1892,7 @@ float_type_for_precision (int precision, enum machine_mode mode) tree t; char type_name[20]; - if (float_types[(int) mode] != 0) + if (float_types[(int) mode]) return float_types[(int) mode]; float_types[(int) mode] = t = make_node (REAL_TYPE); @@ -1895,9 +1900,9 @@ float_type_for_precision (int precision, enum machine_mode mode) layout_type (t); if (TYPE_MODE (t) != mode) - gigi_abort (414); + abort (); - if (TYPE_NAME (t) == 0) + if (!TYPE_NAME (t)) { sprintf (type_name, "FLOAT_%d", precision); TYPE_NAME (t) = get_identifier (type_name); @@ -1934,7 +1939,7 @@ gnat_unsigned_type (tree type_node) type = copy_node (type); TREE_TYPE (type) = type_node; } - else if (TREE_TYPE (type_node) != 0 + else if (TREE_TYPE (type_node) && TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE && TYPE_MODULAR_P (TREE_TYPE (type_node))) { @@ -1957,7 +1962,7 @@ gnat_signed_type (tree type_node) type = copy_node (type); TREE_TYPE (type) = type_node; } - else if (TREE_TYPE (type_node) != 0 + else if (TREE_TYPE (type_node) && TREE_CODE (TREE_TYPE (type_node)) == INTEGER_TYPE && TYPE_MODULAR_P (TREE_TYPE (type_node))) { @@ -1974,7 +1979,7 @@ gnat_signed_type (tree type_node) tree gnat_signed_or_unsigned_type (int unsignedp, tree type) { - if (! INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp) + if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp) return type; else return gnat_type_for_size (TYPE_PRECISION (type), unsignedp); @@ -1982,10 +1987,10 @@ gnat_signed_or_unsigned_type (int unsignedp, tree type) /* EXP is an expression for the size of an object. If this size contains discriminant references, replace them with the maximum (if MAX_P) or - minimum (if ! MAX_P) possible value of the discriminant. */ + minimum (if !MAX_P) possible value of the discriminant. */ tree -max_size (tree exp, int max_p) +max_size (tree exp, bool max_p) { enum tree_code code = TREE_CODE (exp); tree type = TREE_TYPE (exp); @@ -2000,19 +2005,19 @@ max_size (tree exp, int max_p) if (code == TREE_LIST) return tree_cons (TREE_PURPOSE (exp), max_size (TREE_VALUE (exp), max_p), - TREE_CHAIN (exp) != 0 - ? max_size (TREE_CHAIN (exp), max_p) : 0); + TREE_CHAIN (exp) + ? max_size (TREE_CHAIN (exp), max_p) : NULL_TREE); break; case 'r': /* If this contains a PLACEHOLDER_EXPR, it is the thing we want to modify. Otherwise, we treat it like a variable. */ - if (! CONTAINS_PLACEHOLDER_P (exp)) + if (!CONTAINS_PLACEHOLDER_P (exp)) return exp; type = TREE_TYPE (TREE_OPERAND (exp, 1)); return - max_size (max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type), 1); + max_size (max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type), true); case '<': return max_p ? size_one_node : size_zero_node; @@ -2029,7 +2034,7 @@ max_size (tree exp, int max_p) return fold (build1 (code, type, max_size (TREE_OPERAND (exp, 0), - code == NEGATE_EXPR ? ! max_p : max_p))); + code == NEGATE_EXPR ? !max_p : max_p))); case 2: if (code == COMPOUND_EXPR) @@ -2038,7 +2043,7 @@ max_size (tree exp, int max_p) { tree lhs = max_size (TREE_OPERAND (exp, 0), max_p); tree rhs = max_size (TREE_OPERAND (exp, 1), - code == MINUS_EXPR ? ! max_p : max_p); + code == MINUS_EXPR ? !max_p : max_p); /* Special-case wanting the maximum value of a MIN_EXPR. In that case, if one side overflows, return the other. @@ -2053,7 +2058,7 @@ max_size (tree exp, int max_p) else if ((code == MINUS_EXPR || code == PLUS_EXPR) && ((TREE_CONSTANT (lhs) && TREE_OVERFLOW (lhs)) || operand_equal_p (lhs, TYPE_MAX_VALUE (type), 0)) - && ! TREE_CONSTANT (rhs)) + && !TREE_CONSTANT (rhs)) return lhs; else return fold (build (code, type, lhs, rhs)); @@ -2066,13 +2071,13 @@ max_size (tree exp, int max_p) return fold (build (max_p ? MAX_EXPR : MIN_EXPR, type, max_size (TREE_OPERAND (exp, 1), max_p), max_size (TREE_OPERAND (exp, 2), max_p))); - else if (code == CALL_EXPR && TREE_OPERAND (exp, 1) != 0) + else if (code == CALL_EXPR && TREE_OPERAND (exp, 1)) return build (CALL_EXPR, type, TREE_OPERAND (exp, 0), max_size (TREE_OPERAND (exp, 1), max_p), NULL); } } - gigi_abort (408); + abort (); } /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE. @@ -2102,7 +2107,7 @@ build_template (tree template_type, tree array_type, tree expr) nested arrays stop being the underlying object. */ for (field = TYPE_FIELDS (template_type); field; - (bound_list != 0 + (bound_list ? (bound_list = TREE_CHAIN (bound_list)) : (array_type = TREE_TYPE (array_type))), field = TREE_CHAIN (TREE_CHAIN (field))) @@ -2113,15 +2118,15 @@ build_template (tree template_type, tree array_type, tree expr) for an ARRAY_TYPE. Otherwise, if expr is a PARM_DECL with DECL_BY_COMPONENT_PTR_P, use the bounds of the field in the template. This will give us a maximum range. */ - if (bound_list != 0) + if (bound_list) bounds = TREE_VALUE (bound_list); else if (TREE_CODE (array_type) == ARRAY_TYPE) bounds = TYPE_INDEX_TYPE (TYPE_DOMAIN (array_type)); - else if (expr != 0 && TREE_CODE (expr) == PARM_DECL + else if (expr && TREE_CODE (expr) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (expr)) bounds = TREE_TYPE (field); else - gigi_abort (411); + abort (); min = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds)); max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds)); @@ -2426,9 +2431,9 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity) post_error ("unsupported descriptor type for &", gnat_entity); } - finish_record_type (record_type, field_list, 0, 1); + finish_record_type (record_type, field_list, false, true); create_type_decl (create_concat_name (gnat_entity, "DESC"), record_type, - NULL, 1, 0, gnat_entity); + NULL, true, false, gnat_entity); return record_type; } @@ -2467,7 +2472,7 @@ build_unc_object_type (tree template_type, tree object_type, tree name) finish_record_type (type, chainon (chainon (NULL_TREE, template_field), array_field), - 0, 0); + false, false); return type; } @@ -2486,12 +2491,12 @@ update_pointer_to (tree old_type, tree new_type) /* If this is the main variant, process all the other variants first. */ if (TYPE_MAIN_VARIANT (old_type) == old_type) - for (type = TYPE_NEXT_VARIANT (old_type); type != 0; + for (type = TYPE_NEXT_VARIANT (old_type); type; type = TYPE_NEXT_VARIANT (type)) update_pointer_to (type, new_type); /* If no pointer or reference, we are done. */ - if (ptr == 0 && ref == 0) + if (!ptr && !ref) return; /* Merge the old type qualifiers in the new type. @@ -2534,7 +2539,7 @@ update_pointer_to (tree old_type, tree new_type) { TREE_TYPE (ptr1) = new_type; - if (TYPE_NAME (ptr1) != 0 + if (TYPE_NAME (ptr1) && TREE_CODE (TYPE_NAME (ptr1)) == TYPE_DECL && TREE_CODE (new_type) != ENUMERAL_TYPE) rest_of_decl_compilation (TYPE_NAME (ptr1), NULL, @@ -2547,7 +2552,7 @@ update_pointer_to (tree old_type, tree new_type) { TREE_TYPE (ref1) = new_type; - if (TYPE_NAME (ref1) != 0 + if (TYPE_NAME (ref1) && TREE_CODE (TYPE_NAME (ref1)) == TYPE_DECL && TREE_CODE (new_type) != ENUMERAL_TYPE) rest_of_decl_compilation (TYPE_NAME (ref1), NULL, @@ -2559,8 +2564,8 @@ update_pointer_to (tree old_type, tree new_type) is actually a RECORD_TYPE where the types of both fields are pointers to void. In that case, copy the field list from the old type to the new one and update the fields' context. */ - else if (TREE_CODE (ptr) != RECORD_TYPE || ! TYPE_IS_FAT_POINTER_P (ptr)) - gigi_abort (412); + else if (TREE_CODE (ptr) != RECORD_TYPE || !TYPE_IS_FAT_POINTER_P (ptr)) + abort (); else { @@ -2569,6 +2574,12 @@ update_pointer_to (tree old_type, tree new_type) tree new_ref; tree var; + SET_DECL_ORIGINAL_FIELD (TYPE_FIELDS (ptr), + TYPE_FIELDS (TYPE_POINTER_TO (new_type))); + SET_DECL_ORIGINAL_FIELD (TREE_CHAIN (TYPE_FIELDS (ptr)), + TREE_CHAIN (TYPE_FIELDS + (TYPE_POINTER_TO (new_type)))); + TYPE_FIELDS (ptr) = TYPE_FIELDS (TYPE_POINTER_TO (new_type)); DECL_CONTEXT (TYPE_FIELDS (ptr)) = ptr; DECL_CONTEXT (TREE_CHAIN (TYPE_FIELDS (ptr))) = ptr; @@ -2656,10 +2667,10 @@ convert_to_fat_pointer (tree type, tree expr) else expr = build1 (INDIRECT_REF, TREE_TYPE (etype), expr); - template = build_component_ref (expr, NULL_TREE, fields, 0); + template = build_component_ref (expr, NULL_TREE, fields, false); expr = build_unary_op (ADDR_EXPR, NULL_TREE, build_component_ref (expr, NULL_TREE, - TREE_CHAIN (fields), 0)); + TREE_CHAIN (fields), false)); } else /* Otherwise, build the constructor for the template. */ @@ -2694,15 +2705,15 @@ convert_to_fat_pointer (tree type, tree expr) static tree convert_to_thin_pointer (tree type, tree expr) { - if (! TYPE_FAT_POINTER_P (TREE_TYPE (expr))) + if (!TYPE_FAT_POINTER_P (TREE_TYPE (expr))) expr = convert_to_fat_pointer (TREE_TYPE (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))), expr); /* We get the pointer to the data and use a NOP_EXPR to make it the proper GCC type. */ - expr - = build_component_ref (expr, NULL_TREE, TYPE_FIELDS (TREE_TYPE (expr)), 0); + expr = build_component_ref (expr, NULL_TREE, TYPE_FIELDS (TREE_TYPE (expr)), + false); expr = build1 (NOP_EXPR, type, expr); return expr; @@ -2732,20 +2743,21 @@ convert (tree type, tree expr) of variable size, do this as an unchecked conversion. */ else if (ecode == RECORD_TYPE && code == RECORD_TYPE && TYPE_IS_PADDING_P (type) && TYPE_IS_PADDING_P (etype) - && (! TREE_CONSTANT (TYPE_SIZE (type)) - || ! TREE_CONSTANT (TYPE_SIZE (etype)))) + && (!TREE_CONSTANT (TYPE_SIZE (type)) + || !TREE_CONSTANT (TYPE_SIZE (etype)))) ; else if (ecode == RECORD_TYPE && TYPE_IS_PADDING_P (etype)) { /* If we have just converted to this padded type, just get the inner expression. */ if (TREE_CODE (expr) == CONSTRUCTOR - && CONSTRUCTOR_ELTS (expr) != 0 + && CONSTRUCTOR_ELTS (expr) && TREE_PURPOSE (CONSTRUCTOR_ELTS (expr)) == TYPE_FIELDS (etype)) return TREE_VALUE (CONSTRUCTOR_ELTS (expr)); else - return convert (type, build_component_ref (expr, NULL_TREE, - TYPE_FIELDS (etype), 0)); + return convert (type, + build_component_ref (expr, NULL_TREE, + TYPE_FIELDS (etype), false)); } else if (code == RECORD_TYPE && TYPE_IS_PADDING_P (type)) { @@ -2753,7 +2765,7 @@ convert (tree type, tree expr) of variable size, remove the conversion to avoid the need for variable-size temporaries. */ if (TREE_CODE (expr) == VIEW_CONVERT_EXPR - && ! TREE_CONSTANT (TYPE_SIZE (type))) + && !TREE_CONSTANT (TYPE_SIZE (type))) expr = TREE_OPERAND (expr, 0); /* If we are just removing the padding from expr, convert the original @@ -2762,7 +2774,7 @@ convert (tree type, tree expr) if (TREE_CODE (expr) == COMPONENT_REF && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (expr, 0))) - && ! TREE_CONSTANT (TYPE_SIZE (type))) + && !TREE_CONSTANT (TYPE_SIZE (type))) return convert (type, TREE_OPERAND (expr, 0)); /* If the result type is a padded type with a self-referentially-sized @@ -2770,7 +2782,7 @@ convert (tree type, tree expr) unchecked converstion. */ else if (TREE_CODE (etype) == RECORD_TYPE && CONTAINS_PLACEHOLDER_P (DECL_SIZE (TYPE_FIELDS (type)))) - return unchecked_convert (type, expr, 0); + return unchecked_convert (type, expr, false); else return @@ -2795,7 +2807,7 @@ convert (tree type, tree expr) if (ecode == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (etype) && code != UNCONSTRAINED_ARRAY_TYPE) return convert (type, build_component_ref (expr, NULL_TREE, - TYPE_FIELDS (etype), 0)); + TYPE_FIELDS (etype), false)); /* If converting to a type that contains a template, convert to the data type and then build the template. */ @@ -2837,8 +2849,8 @@ convert (tree type, tree expr) /* If we are converting a STRING_CST to another constrained array type, just make a new one in the proper type. */ if (code == ecode && AGGREGATE_TYPE_P (etype) - && ! (TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST - && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) + && !(TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST + && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) && (TREE_CODE (expr) == STRING_CST || get_alias_set (etype) == get_alias_set (type))) { @@ -2854,14 +2866,14 @@ convert (tree type, tree expr) expr = build_unary_op (INDIRECT_REF, NULL_TREE, build_component_ref (TREE_OPERAND (expr, 0), get_identifier ("P_ARRAY"), - NULL_TREE, 0)); + NULL_TREE, false)); etype = TREE_TYPE (expr); ecode = TREE_CODE (etype); break; case VIEW_CONVERT_EXPR: if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (etype) - && ! TYPE_FAT_POINTER_P (type) && ! TYPE_FAT_POINTER_P (etype)) + && !TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert (type, TREE_OPERAND (expr, 0)); break; @@ -2878,7 +2890,7 @@ convert (tree type, tree expr) || TREE_CODE (type) == UNION_TYPE) && (TREE_CODE (etype) == RECORD_TYPE || TREE_CODE (etype) == UNION_TYPE) - && ! TYPE_FAT_POINTER_P (type) && ! TYPE_FAT_POINTER_P (etype)) + && !TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return build_unary_op (INDIRECT_REF, NULL_TREE, convert (build_pointer_type (type), TREE_OPERAND (expr, 0))); @@ -2889,7 +2901,7 @@ convert (tree type, tree expr) } /* Check for converting to a pointer to an unconstrained array. */ - if (TYPE_FAT_POINTER_P (type) && ! TYPE_FAT_POINTER_P (etype)) + if (TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)) return convert_to_fat_pointer (type, expr); /* If we're converting between two aggregate types that have the same main @@ -2916,7 +2928,7 @@ convert (tree type, tree expr) if (TYPE_HAS_ACTUAL_BOUNDS_P (type) && (ecode == ARRAY_TYPE || ecode == UNCONSTRAINED_ARRAY_TYPE || (ecode == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (etype)))) - return unchecked_convert (type, expr, 0); + return unchecked_convert (type, expr, false); else if (TYPE_BIASED_REPRESENTATION_P (type)) return fold (build1 (CONVERT_EXPR, type, fold (build (MINUS_EXPR, TREE_TYPE (type), @@ -2952,14 +2964,14 @@ convert (tree type, tree expr) /* If converting to a thin pointer, handle specially. */ if (TYPE_THIN_POINTER_P (type) - && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)) != 0) + && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))) return convert_to_thin_pointer (type, expr); /* If converting fat pointer to normal pointer, get the pointer to the array and then convert it. */ else if (TYPE_FAT_POINTER_P (etype)) expr = build_component_ref (expr, get_identifier ("P_ARRAY"), - NULL_TREE, 0); + NULL_TREE, false); return fold (convert_to_pointer (type, expr)); @@ -2967,7 +2979,7 @@ convert (tree type, tree expr) return fold (convert_to_real (type, expr)); case RECORD_TYPE: - if (TYPE_LEFT_JUSTIFIED_MODULAR_P (type) && ! AGGREGATE_TYPE_P (etype)) + if (TYPE_LEFT_JUSTIFIED_MODULAR_P (type) && !AGGREGATE_TYPE_P (etype)) return gnat_build_constructor (type, tree_cons (TYPE_FIELDS (type), @@ -2980,7 +2992,7 @@ convert (tree type, tree expr) /* In these cases, assume the front-end has validated the conversion. If the conversion is valid, it will be a bit-wise conversion, so it can be viewed as an unchecked conversion. */ - return unchecked_convert (type, expr, 0); + return unchecked_convert (type, expr, false); case UNION_TYPE: /* Just validate that the type is indeed that of a field @@ -2997,7 +3009,7 @@ convert (tree type, tree expr) convert (TREE_TYPE (tem), expr)); } - gigi_abort (413); + abort (); case UNCONSTRAINED_ARRAY_TYPE: /* If EXPR is a constrained array, take its address, convert it to a @@ -3025,23 +3037,23 @@ convert (tree type, tree expr) build_unary_op (ADDR_EXPR, NULL_TREE, expr))); else - gigi_abort (409); + abort (); case COMPLEX_TYPE: return fold (convert_to_complex (type, expr)); default: - gigi_abort (410); + abort (); } } /* Remove all conversions that are done in EXP. This includes converting from a padded type or to a left-justified modular type. If TRUE_ADDRESS - is nonzero, always return the address of the containing object even if + is true, always return the address of the containing object even if the address is not bit-aligned. */ tree -remove_conversions (tree exp, int true_address) +remove_conversions (tree exp, bool true_address) { switch (TREE_CODE (exp)) { @@ -3049,7 +3061,7 @@ remove_conversions (tree exp, int true_address) if (true_address && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (TREE_TYPE (exp))) - return remove_conversions (TREE_VALUE (CONSTRUCTOR_ELTS (exp)), 1); + return remove_conversions (TREE_VALUE (CONSTRUCTOR_ELTS (exp)), true); break; case COMPONENT_REF: @@ -3088,7 +3100,7 @@ maybe_unconstrained_array (tree exp) = build_unary_op (INDIRECT_REF, NULL_TREE, build_component_ref (TREE_OPERAND (exp, 0), get_identifier ("P_ARRAY"), - NULL_TREE, 0)); + NULL_TREE, false)); TREE_READONLY (new) = TREE_STATIC (new) = TREE_READONLY (exp); return new; } @@ -3126,10 +3138,10 @@ maybe_unconstrained_array (tree exp) } /* Return an expression that does an unchecked converstion of EXPR to TYPE. - If NOTRUNC_P is set, truncation operations should be suppressed. */ + If NOTRUNC_P is true, truncation operations should be suppressed. */ tree -unchecked_convert (tree type, tree expr, int notrunc_p) +unchecked_convert (tree type, tree expr, bool notrunc_p) { tree etype = TREE_TYPE (expr); @@ -3140,15 +3152,15 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* If both types types are integral just do a normal conversion. Likewise for a conversion to an unconstrained array. */ if ((((INTEGRAL_TYPE_P (type) - && ! (TREE_CODE (type) == INTEGER_TYPE - && TYPE_VAX_FLOATING_POINT_P (type))) + && !(TREE_CODE (type) == INTEGER_TYPE + && TYPE_VAX_FLOATING_POINT_P (type))) || (POINTER_TYPE_P (type) && ! TYPE_THIN_POINTER_P (type)) || (TREE_CODE (type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (type))) && ((INTEGRAL_TYPE_P (etype) - && ! (TREE_CODE (etype) == INTEGER_TYPE - && TYPE_VAX_FLOATING_POINT_P (etype))) - || (POINTER_TYPE_P (etype) && ! TYPE_THIN_POINTER_P (etype)) + && !(TREE_CODE (etype) == INTEGER_TYPE + && TYPE_VAX_FLOATING_POINT_P (etype))) + || (POINTER_TYPE_P (etype) && !TYPE_THIN_POINTER_P (etype)) || (TREE_CODE (etype) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (etype)))) || TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) @@ -3181,7 +3193,7 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* If we are converting TO an integral type whose precision is not the same as its size, first unchecked convert to a record that contains an object of the output type. Then extract the field. */ - else if (INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) != 0 + else if (INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type)))) { @@ -3198,7 +3210,7 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* Similarly for integral input type whose precision is not equal to its size. */ - else if (INTEGRAL_TYPE_P (etype) && TYPE_RM_SIZE (etype) != 0 + else if (INTEGRAL_TYPE_P (etype) && TYPE_RM_SIZE (etype) && 0 != compare_tree_int (TYPE_RM_SIZE (etype), GET_MODE_BITSIZE (TYPE_MODE (etype)))) { @@ -3240,19 +3252,19 @@ unchecked_convert (tree type, tree expr, int notrunc_p) the result. We need not do this in the case where the input is an integral type of the same precision and signedness or if the output is a biased type or if both the input and output are unsigned. */ - if (! notrunc_p - && INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) != 0 - && ! (TREE_CODE (type) == INTEGER_TYPE - && TYPE_BIASED_REPRESENTATION_P (type)) + if (!notrunc_p + && INTEGRAL_TYPE_P (type) && TYPE_RM_SIZE (type) + && !(TREE_CODE (type) == INTEGER_TYPE + && TYPE_BIASED_REPRESENTATION_P (type)) && 0 != compare_tree_int (TYPE_RM_SIZE (type), GET_MODE_BITSIZE (TYPE_MODE (type))) - && ! (INTEGRAL_TYPE_P (etype) - && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (etype) - && operand_equal_p (TYPE_RM_SIZE (type), - (TYPE_RM_SIZE (etype) != 0 - ? TYPE_RM_SIZE (etype) : TYPE_SIZE (etype)), - 0)) - && ! (TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype))) + && !(INTEGRAL_TYPE_P (etype) + && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (etype) + && operand_equal_p (TYPE_RM_SIZE (type), + (TYPE_RM_SIZE (etype) != 0 + ? TYPE_RM_SIZE (etype) : TYPE_SIZE (etype)), + 0)) + && !(TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype))) { tree base_type = gnat_type_for_mode (TYPE_MODE (type), TYPE_UNSIGNED (type)); @@ -3282,8 +3294,8 @@ unchecked_convert (tree type, tree expr, int notrunc_p) /* If the sizes of the types differ and this is an VIEW_CONVERT_EXPR, show no longer constant. */ if (TREE_CODE (expr) == VIEW_CONVERT_EXPR - && ! operand_equal_p (TYPE_SIZE_UNIT (type), TYPE_SIZE_UNIT (etype), - OEP_ONLY_CONST)) + && !operand_equal_p (TYPE_SIZE_UNIT (type), TYPE_SIZE_UNIT (etype), + OEP_ONLY_CONST)) TREE_CONSTANT (expr) = 0; return expr; diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index 2daefa3a552..6d8ba355944 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -46,11 +46,11 @@ #include "gigi.h" static tree find_common_type (tree, tree); -static int contains_save_expr_p (tree); +static bool contains_save_expr_p (tree); static tree contains_null_expr (tree); static tree compare_arrays (tree, tree, tree); static tree nonbinary_modular_operation (enum tree_code, tree, tree, tree); -static tree build_simple_component_ref (tree, tree, tree, int); +static tree build_simple_component_ref (tree, tree, tree, bool); /* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical operation. @@ -114,7 +114,7 @@ get_base_type (tree type) && TYPE_LEFT_JUSTIFIED_MODULAR_P (type)) type = TREE_TYPE (TYPE_FIELDS (type)); - while (TREE_TYPE (type) != 0 + while (TREE_TYPE (type) && (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == REAL_TYPE)) type = TREE_TYPE (type); @@ -126,10 +126,10 @@ get_base_type (tree type) tree get_ada_base_type (tree type) { - while (TREE_TYPE (type) != 0 + while (TREE_TYPE (type) && (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == REAL_TYPE) - && ! TYPE_EXTRA_SUBTYPE_P (type)) + && !TYPE_EXTRA_SUBTYPE_P (type)) type = TREE_TYPE (type); return type; @@ -159,7 +159,7 @@ known_alignment (tree exp) type_alignment value to 0 when the type information is to be ignored. */ type_alignment = ((POINTER_TYPE_P (TREE_TYPE (exp)) - && ! TYPE_IS_DUMMY_P (TREE_TYPE (TREE_TYPE (exp)))) + && !TYPE_IS_DUMMY_P (TREE_TYPE (TREE_TYPE (exp)))) ? TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp))) : 0); switch (TREE_CODE (exp)) @@ -248,13 +248,13 @@ find_common_type (tree t1, tree t2) ??? This is a real kludge, but is probably the best approach short of some very general solution. */ -static int +static bool contains_save_expr_p (tree exp) { switch (TREE_CODE (exp)) { case SAVE_EXPR: - return 1; + return true; case ADDR_EXPR: case INDIRECT_REF: case COMPONENT_REF: @@ -262,16 +262,16 @@ contains_save_expr_p (tree exp) return contains_save_expr_p (TREE_OPERAND (exp, 0)); case CONSTRUCTOR: - return (CONSTRUCTOR_ELTS (exp) != 0 + return (CONSTRUCTOR_ELTS (exp) && contains_save_expr_p (CONSTRUCTOR_ELTS (exp))); case TREE_LIST: return (contains_save_expr_p (TREE_VALUE (exp)) - || (TREE_CHAIN (exp) != 0 + || (TREE_CHAIN (exp) && contains_save_expr_p (TREE_CHAIN (exp)))); default: - return 0; + return false; } } @@ -294,7 +294,7 @@ contains_null_expr (tree exp) case '<': case '2': tem = contains_null_expr (TREE_OPERAND (exp, 0)); - if (tem != 0) + if (tem) return tem; return contains_null_expr (TREE_OPERAND (exp, 1)); @@ -307,11 +307,11 @@ contains_null_expr (tree exp) case COND_EXPR: tem = contains_null_expr (TREE_OPERAND (exp, 0)); - if (tem != 0) + if (tem) return tem; tem = contains_null_expr (TREE_OPERAND (exp, 1)); - if (tem != 0) + if (tem) return tem; return contains_null_expr (TREE_OPERAND (exp, 2)); @@ -342,7 +342,7 @@ compare_arrays (tree result_type, tree a1, tree a2) tree result = convert (result_type, integer_one_node); tree a1_is_null = convert (result_type, integer_zero_node); tree a2_is_null = convert (result_type, integer_zero_node); - int length_zero_p = 0; + bool length_zero_p = false; /* Process each dimension separately and compare the lengths. If any dimension has a size known to be zero, set SIZE_ZERO_P to 1 to @@ -364,8 +364,8 @@ compare_arrays (tree result_type, tree a1, tree a2) unless the length of the second array is the constant zero. Note that we have set the `length' values to the length - 1. */ if (TREE_CODE (length1) == INTEGER_CST - && ! integer_zerop (fold (build (PLUS_EXPR, bt, length2, - convert (bt, integer_one_node))))) + && !integer_zerop (fold (build (PLUS_EXPR, bt, length2, + convert (bt, integer_one_node))))) { tem = a1, a1 = a2, a2 = tem; tem = t1, t1 = t2, t2 = tem; @@ -388,7 +388,7 @@ compare_arrays (tree result_type, tree a1, tree a2) comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); - length_zero_p = 1; + length_zero_p = true; this_a1_is_null = comparison; this_a2_is_null = convert (result_type, integer_one_node); } @@ -450,11 +450,11 @@ compare_arrays (tree result_type, tree a1, tree a2) /* Unless the size of some bound is known to be zero, compare the data in the array. */ - if (! length_zero_p) + if (!length_zero_p) { tree type = find_common_type (TREE_TYPE (a1), TREE_TYPE (a2)); - if (type != 0) + if (type) a1 = convert (type, a1), a2 = convert (type, a2); result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, @@ -486,15 +486,13 @@ compare_arrays (tree result_type, tree a1, tree a2) modulus. */ static tree -nonbinary_modular_operation (enum tree_code op_code, - tree type, - tree lhs, +nonbinary_modular_operation (enum tree_code op_code, tree type, tree lhs, tree rhs) { tree modulus = TYPE_MODULUS (type); unsigned int needed_precision = tree_floor_log2 (modulus) + 1; unsigned int precision; - int unsignedp = 1; + bool unsignedp = true; tree op_type = type; tree result; @@ -516,7 +514,7 @@ nonbinary_modular_operation (enum tree_code op_code, /* Unsigned will do for everything but subtraction. */ if (op_code == MINUS_EXPR) - unsignedp = 0; + unsignedp = false; /* If our type is the wrong signedness or isn't wide enough, make a new type and convert both our operands to it. */ @@ -594,22 +592,22 @@ build_binary_op (enum tree_code op_code, tree result_type, tree left_base_type = get_base_type (left_type); tree right_base_type = get_base_type (right_type); tree operation_type = result_type; - tree best_type = 0; + tree best_type = NULL_TREE; tree modulus; tree result; - int has_side_effects = 0; + bool has_side_effects = false; - if (operation_type != 0 + if (operation_type && TREE_CODE (operation_type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (operation_type)) operation_type = TREE_TYPE (TYPE_FIELDS (operation_type)); - if (operation_type != 0 - && ! AGGREGATE_TYPE_P (operation_type) + if (operation_type + && !AGGREGATE_TYPE_P (operation_type) && TYPE_EXTRA_SUBTYPE_P (operation_type)) operation_type = get_base_type (operation_type); - modulus = (operation_type != 0 && TREE_CODE (operation_type) == INTEGER_TYPE + modulus = (operation_type && TREE_CODE (operation_type) == INTEGER_TYPE && TYPE_MODULAR_P (operation_type) ? TYPE_MODULUS (operation_type) : 0); @@ -633,7 +631,7 @@ build_binary_op (enum tree_code op_code, tree result_type, || (((TREE_CODE (left_type) == RECORD_TYPE /* Don't remove conversions to left-justified modular types. */ - && ! TYPE_LEFT_JUSTIFIED_MODULAR_P (left_type)) + && !TYPE_LEFT_JUSTIFIED_MODULAR_P (left_type)) || TREE_CODE (left_type) == ARRAY_TYPE) && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (left_operand, 0))) @@ -651,7 +649,7 @@ build_binary_op (enum tree_code op_code, tree result_type, left_type = TREE_TYPE (left_operand); } - if (operation_type == 0) + if (!operation_type) operation_type = left_type; /* If the RHS has a conversion between record and array types and @@ -661,18 +659,18 @@ build_binary_op (enum tree_code op_code, tree result_type, type, which we must not remove. */ while (TREE_CODE (right_operand) == VIEW_CONVERT_EXPR && ((TREE_CODE (right_type) == RECORD_TYPE - && ! TYPE_LEFT_JUSTIFIED_MODULAR_P (right_type) - && ! TYPE_ALIGN_OK (right_type) - && ! TYPE_IS_FAT_POINTER_P (right_type)) + && !TYPE_LEFT_JUSTIFIED_MODULAR_P (right_type) + && !TYPE_ALIGN_OK (right_type) + && !TYPE_IS_FAT_POINTER_P (right_type)) || TREE_CODE (right_type) == ARRAY_TYPE) && (((TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0))) == RECORD_TYPE) - && ! (TYPE_LEFT_JUSTIFIED_MODULAR_P - (TREE_TYPE (TREE_OPERAND (right_operand, 0)))) - && ! (TYPE_ALIGN_OK - (TREE_TYPE (TREE_OPERAND (right_operand, 0)))) - && ! (TYPE_IS_FAT_POINTER_P - (TREE_TYPE (TREE_OPERAND (right_operand, 0))))) + && !(TYPE_LEFT_JUSTIFIED_MODULAR_P + (TREE_TYPE (TREE_OPERAND (right_operand, 0)))) + && !(TYPE_ALIGN_OK + (TREE_TYPE (TREE_OPERAND (right_operand, 0)))) + && !(TYPE_IS_FAT_POINTER_P + (TREE_TYPE (TREE_OPERAND (right_operand, 0))))) || (TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0))) == ARRAY_TYPE)) && (0 == (best_type @@ -691,7 +689,7 @@ build_binary_op (enum tree_code op_code, tree result_type, && TREE_CODE (right_type) == ARRAY_TYPE) || (TREE_CODE (left_type) == RECORD_TYPE && TREE_CODE (right_type) == RECORD_TYPE)) - && (best_type = find_common_type (left_type, right_type)) != 0) + && (best_type = find_common_type (left_type, right_type))) operation_type = best_type; /* If a class-wide type may be involved, force use of the RHS type. */ @@ -735,38 +733,31 @@ build_binary_op (enum tree_code op_code, tree result_type, } if (TREE_CODE (result) != INDIRECT_REF && TREE_CODE (result) != NULL_EXPR - && ! DECL_P (result)) - gigi_abort (516); + && !DECL_P (result)) + abort (); /* Convert the right operand to the operation type unless it is either already of the correct type or if the type involves a placeholder, since the RHS may not have the same record type. */ if (operation_type != right_type - && (! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (operation_type)))) + && (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (operation_type)))) { right_operand = convert (operation_type, right_operand); right_type = operation_type; } - /* If the modes differ, make up a bogus type and convert the RHS to - it. This can happen with packed types. */ - if (TYPE_MODE (left_type) != TYPE_MODE (right_type)) - { - tree new_type = copy_node (left_type); - - TYPE_SIZE (new_type) = TYPE_SIZE (right_type); - TYPE_SIZE_UNIT (new_type) = TYPE_SIZE_UNIT (right_type); - TYPE_MAIN_VARIANT (new_type) = new_type; - right_operand = convert (new_type, right_operand); - } + /* If the left operand is not the same type as the operation type, + surround it in a VIEW_CONVERT_EXPR. */ + if (left_type != operation_type) + left_operand = unchecked_convert (operation_type, left_operand, false); - has_side_effects = 1; - modulus = 0; + has_side_effects = true; + modulus = NULL_TREE; break; case ARRAY_REF: - if (operation_type == 0) + if (!operation_type) operation_type = TREE_TYPE (left_type); /* ... fall through ... */ @@ -779,11 +770,11 @@ build_binary_op (enum tree_code op_code, tree result_type, right_operand = convert (right_base_type, right_operand); right_operand = convert (TYPE_DOMAIN (left_type), right_operand); - if (! TREE_CONSTANT (right_operand) - || ! TREE_CONSTANT (TYPE_MIN_VALUE (right_type))) + if (!TREE_CONSTANT (right_operand) + || !TREE_CONSTANT (TYPE_MIN_VALUE (right_type))) gnat_mark_addressable (left_operand); - modulus = 0; + modulus = NULL_TREE; break; case GE_EXPR: @@ -791,7 +782,7 @@ build_binary_op (enum tree_code op_code, tree result_type, case GT_EXPR: case LT_EXPR: if (POINTER_TYPE_P (left_type)) - gigi_abort (501); + abort (); /* ... fall through ... */ @@ -845,7 +836,7 @@ build_binary_op (enum tree_code op_code, tree result_type, else if (op_code == NE_EXPR) result = invert_truthvalue (result); else - gigi_abort (502); + abort (); return result; } @@ -862,28 +853,28 @@ build_binary_op (enum tree_code op_code, tree result_type, types have the same name. In that case, one of them must not be self-referential. Use that one as the best type. Even better is if one is of fixed size. */ - best_type = 0; + best_type = NULL_TREE; - if (TYPE_NAME (left_base_type) == 0 + if (!TYPE_NAME (left_base_type) || TYPE_NAME (left_base_type) != TYPE_NAME (right_base_type)) - gigi_abort (503); + abort (); if (TREE_CONSTANT (TYPE_SIZE (left_base_type))) best_type = left_base_type; else if (TREE_CONSTANT (TYPE_SIZE (right_base_type))) best_type = right_base_type; - else if (! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (left_base_type))) + else if (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (left_base_type))) best_type = left_base_type; - else if (! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (right_base_type))) + else if (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (right_base_type))) best_type = right_base_type; else - gigi_abort (504); + abort (); left_operand = convert (best_type, left_operand); right_operand = convert (best_type, right_operand); } else - gigi_abort (505); + abort (); } /* If we are comparing a fat pointer against zero, we need to @@ -895,7 +886,7 @@ build_binary_op (enum tree_code op_code, tree result_type, { right_operand = build_component_ref (left_operand, NULL_TREE, TYPE_FIELDS (left_base_type), - 0); + false); left_operand = convert (TREE_TYPE (right_operand), integer_zero_node); } @@ -905,7 +896,7 @@ build_binary_op (enum tree_code op_code, tree result_type, right_operand = convert (right_base_type, right_operand); } - modulus = 0; + modulus = NULL_TREE; break; case PREINCREMENT_EXPR: @@ -921,13 +912,13 @@ build_binary_op (enum tree_code op_code, tree result_type, be done for modular types. */ if (left_type != result_type) - gigi_abort (506); + abort (); operation_type = get_base_type (result_type); left_operand = convert (operation_type, left_operand); right_operand = convert (operation_type, right_operand); - has_side_effects = 1; - modulus = 0; + has_side_effects = true; + modulus = NULL_TREE; break; case LSHIFT_EXPR: @@ -938,9 +929,9 @@ build_binary_op (enum tree_code op_code, tree result_type, (we used to abort, but this is needed for unchecked conversion to modular types). Otherwise, processing is the same as normal. */ if (operation_type != left_base_type) - gigi_abort (514); + abort (); - modulus = 0; + modulus = NULL_TREE; left_operand = convert (operation_type, left_operand); break; @@ -958,15 +949,15 @@ build_binary_op (enum tree_code op_code, tree result_type, case BIT_XOR_EXPR: /* For binary modulus, if the inputs are in range, so are the outputs. */ - if (modulus != 0 && integer_pow2p (modulus)) - modulus = 0; + if (modulus && integer_pow2p (modulus)) + modulus = NULL_TREE; goto common; case COMPLEX_EXPR: if (TREE_TYPE (result_type) != left_base_type || TREE_TYPE (result_type) != right_base_type) - gigi_abort (515); + abort (); left_operand = convert (left_base_type, left_operand); right_operand = convert (right_base_type, right_operand); @@ -977,7 +968,7 @@ build_binary_op (enum tree_code op_code, tree result_type, case FLOOR_DIV_EXPR: case FLOOR_MOD_EXPR: case ROUND_DIV_EXPR: case ROUND_MOD_EXPR: /* These always produce results lower than either operand. */ - modulus = 0; + modulus = NULL_TREE; goto common; default: @@ -988,17 +979,17 @@ build_binary_op (enum tree_code op_code, tree result_type, if (operation_type != left_base_type || left_base_type != right_base_type) - gigi_abort (507); + abort (); left_operand = convert (operation_type, left_operand); right_operand = convert (operation_type, right_operand); } - if (modulus != 0 && ! integer_pow2p (modulus)) + if (modulus && !integer_pow2p (modulus)) { result = nonbinary_modular_operation (op_code, operation_type, left_operand, right_operand); - modulus = 0; + modulus = NULL_TREE; } /* If either operand is a NULL_EXPR, just return a new one. */ else if (TREE_CODE (left_operand) == NULL_EXPR) @@ -1023,11 +1014,11 @@ build_binary_op (enum tree_code op_code, tree result_type, /* If we are working with modular types, perform the MOD operation if something above hasn't eliminated the need for it. */ - if (modulus != 0) + if (modulus) result = fold (build (FLOOR_MOD_EXPR, operation_type, result, convert (operation_type, modulus))); - if (result_type != 0 && result_type != operation_type) + if (result_type && result_type != operation_type) result = convert (result_type, result); return result; @@ -1042,15 +1033,15 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) tree base_type = get_base_type (type); tree operation_type = result_type; tree result; - int side_effects = 0; + bool side_effects = false; - if (operation_type != 0 + if (operation_type && TREE_CODE (operation_type) == RECORD_TYPE && TYPE_LEFT_JUSTIFIED_MODULAR_P (operation_type)) operation_type = TREE_TYPE (TYPE_FIELDS (operation_type)); - if (operation_type != 0 - && ! AGGREGATE_TYPE_P (operation_type) + if (operation_type + && !AGGREGATE_TYPE_P (operation_type) && TYPE_EXTRA_SUBTYPE_P (operation_type)) operation_type = get_base_type (operation_type); @@ -1058,17 +1049,17 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) { case REALPART_EXPR: case IMAGPART_EXPR: - if (operation_type == 0) + if (!operation_type) result_type = operation_type = TREE_TYPE (type); else if (result_type != TREE_TYPE (type)) - gigi_abort (513); + abort (); result = fold (build1 (op_code, operation_type, operand)); break; case TRUTH_NOT_EXPR: if (result_type != base_type) - gigi_abort (508); + abort (); result = invert_truthvalue (gnat_truthvalue_conversion (operand)); break; @@ -1083,7 +1074,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) /* Make sure the type here is a pointer, not a reference. GCC wants pointer types for function addresses. */ - if (result_type == 0) + if (!result_type) result_type = build_pointer_type (type); break; @@ -1122,7 +1113,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) inner); /* Compute the offset as a byte offset from INNER. */ - if (offset == 0) + if (!offset) offset = size_zero_node; if (bitpos % BITS_PER_UNIT != 0) @@ -1176,9 +1167,8 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) && (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (TREE_OPERAND (operand, 0))))) return build_unary_op (ADDR_EXPR, - (result_type == 0 - ? build_pointer_type (type) - : result_type), + (result_type ? result_type + : build_pointer_type (type)), TREE_OPERAND (operand, 0)); goto common; @@ -1217,7 +1207,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) the backend. If TYPE is a thin pointer, first convert the operand to a fat pointer. */ if (TYPE_THIN_POINTER_P (type) - && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)) != 0) + && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))) { operand = convert (TREE_TYPE (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))), @@ -1242,26 +1232,26 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) } side_effects - = (! TYPE_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type))); + = (!TYPE_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type))); break; case NEGATE_EXPR: case BIT_NOT_EXPR: { - tree modulus = ((operation_type != 0 + tree modulus = ((operation_type && TREE_CODE (operation_type) == INTEGER_TYPE && TYPE_MODULAR_P (operation_type)) ? TYPE_MODULUS (operation_type) : 0); - int mod_pow2 = modulus != 0 && integer_pow2p (modulus); + int mod_pow2 = modulus && integer_pow2p (modulus); /* If this is a modular type, there are various possibilities depending on the operation and whether the modulus is a power of two or not. */ - if (modulus != 0) + if (modulus) { if (operation_type != base_type) - gigi_abort (509); + abort (); operand = convert (operation_type, operand); @@ -1278,7 +1268,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) else return the modulus minus the operand. If the modulus is a power of two minus one, we can do the subtraction as an XOR since it is equivalent and faster on most machines. */ - else if (op_code == NEGATE_EXPR && ! mod_pow2) + else if (op_code == NEGATE_EXPR && !mod_pow2) { if (integer_pow2p (fold (build (PLUS_EXPR, operation_type, modulus, @@ -1324,7 +1314,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) default: if (operation_type != base_type) - gigi_abort (509); + abort (); result = fold (build1 (op_code, operation_type, convert (operation_type, operand))); @@ -1337,7 +1327,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) TREE_THIS_VOLATILE (result) = TYPE_VOLATILE (TREE_TYPE (result)); } - if (result_type != 0 && TREE_TYPE (result) != result_type) + if (result_type && TREE_TYPE (result) != result_type) result = convert (result_type, result); return result; @@ -1350,7 +1340,7 @@ build_cond_expr (tree result_type, tree condition_operand, tree true_operand, tree false_operand) { tree result; - int addr_p = 0; + bool addr_p = false; /* The front-end verifies that result, true and false operands have same base type. Convert everything to the result type. */ @@ -1363,7 +1353,7 @@ build_cond_expr (tree result_type, tree condition_operand, if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) { - addr_p = 1; + addr_p = true; result_type = build_pointer_type (result_type); true_operand = build_unary_op (ADDR_EXPR, result_type, true_operand); false_operand = build_unary_op (ADDR_EXPR, result_type, false_operand); @@ -1469,22 +1459,22 @@ tree gnat_build_constructor (tree type, tree list) { tree elmt; - int allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST); - int side_effects = 0; + bool allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST); + bool side_effects = false; tree result; for (elmt = list; elmt; elmt = TREE_CHAIN (elmt)) { - if (! TREE_CONSTANT (TREE_VALUE (elmt)) + if (!TREE_CONSTANT (TREE_VALUE (elmt)) || (TREE_CODE (type) == RECORD_TYPE && DECL_BIT_FIELD (TREE_PURPOSE (elmt)) && TREE_CODE (TREE_VALUE (elmt)) != INTEGER_CST) - || ! initializer_constant_valid_p (TREE_VALUE (elmt), - TREE_TYPE (TREE_VALUE (elmt)))) - allconstant = 0; + || !initializer_constant_valid_p (TREE_VALUE (elmt), + TREE_TYPE (TREE_VALUE (elmt)))) + allconstant = false; if (TREE_SIDE_EFFECTS (TREE_VALUE (elmt))) - side_effects = 1; + side_effects = true; /* Propagate an NULL_EXPR from the size of the type. We won't ever be executing the code we generate here in that case, but handle it @@ -1510,7 +1500,7 @@ gnat_build_constructor (tree type, tree list) if (TREE_CODE (this_pos) != INTEGER_CST || tree_int_cst_lt (this_pos, last_pos)) { - allconstant = 0; + allconstant = false; break; } @@ -1529,14 +1519,14 @@ gnat_build_constructor (tree type, tree list) /* Return a COMPONENT_REF to access a field that is given by COMPONENT, an IDENTIFIER_NODE giving the name of the field, or FIELD, a FIELD_DECL, - for the field. Don't fold the result if NO_FOLD_P is nonzero. + for the field. Don't fold the result if NO_FOLD_P is true. We also handle the fact that we might have been passed a pointer to the actual record and know how to look for fields in variant parts. */ static tree build_simple_component_ref (tree record_variable, tree component, - tree field, int no_fold_p) + tree field, bool no_fold_p) { tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable)); tree ref; @@ -1544,23 +1534,20 @@ build_simple_component_ref (tree record_variable, tree component, if ((TREE_CODE (record_type) != RECORD_TYPE && TREE_CODE (record_type) != UNION_TYPE && TREE_CODE (record_type) != QUAL_UNION_TYPE) - || TYPE_SIZE (record_type) == 0) - gigi_abort (510); - - /* Either COMPONENT or FIELD must be specified, but not both. */ - if ((component != 0) == (field != 0)) - gigi_abort (511); + || !TYPE_SIZE (record_type) + || (component != 0) == (field != 0)) + abort (); /* If no field was specified, look for a field with the specified name in the current record only. */ - if (field == 0) + if (!field) for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field)) if (DECL_NAME (field) == component) break; - if (field == 0) - return 0; + if (!field) + return NULL_TREE; /* If this field is not in the specified record, see if we can find something in the record whose original field is the same as this one. */ @@ -1571,11 +1558,11 @@ build_simple_component_ref (tree record_variable, tree component, /* First loop thru normal components. */ - for (new_field = TYPE_FIELDS (record_type); new_field != 0; + for (new_field = TYPE_FIELDS (record_type); new_field; new_field = TREE_CHAIN (new_field)) if (DECL_ORIGINAL_FIELD (new_field) == field || new_field == DECL_ORIGINAL_FIELD (field) - || (DECL_ORIGINAL_FIELD (field) != 0 + || (DECL_ORIGINAL_FIELD (field) && (DECL_ORIGINAL_FIELD (field) == DECL_ORIGINAL_FIELD (new_field)))) break; @@ -1585,8 +1572,8 @@ build_simple_component_ref (tree record_variable, tree component, is required to avoiding hidden homonymous fields in the _Parent field. */ - if (new_field == 0) - for (new_field = TYPE_FIELDS (record_type); new_field != 0; + if (!new_field) + for (new_field = TYPE_FIELDS (record_type); new_field; new_field = TREE_CHAIN (new_field)) if (DECL_INTERNAL_P (new_field)) { @@ -1596,15 +1583,15 @@ build_simple_component_ref (tree record_variable, tree component, ref = build_simple_component_ref (field_ref, NULL_TREE, field, no_fold_p); - if (ref != 0) + if (ref) return ref; } field = new_field; } - if (field == 0) - return 0; + if (!field) + return NULL_TREE; /* It would be nice to call "fold" here, but that can lose a type we need to tag a PLACEHOLDER_EXPR with, so we can't do it. */ @@ -1625,23 +1612,23 @@ build_simple_component_ref (tree record_variable, tree component, tree build_component_ref (tree record_variable, tree component, - tree field, int no_fold_p) + tree field, bool no_fold_p) { tree ref = build_simple_component_ref (record_variable, component, field, no_fold_p); - if (ref != 0) + if (ref) return ref; /* If FIELD was specified, assume this is an invalid user field so raise constraint error. Otherwise, we can't find the type to return, so abort. */ - else if (field != 0) + else if (field) return build1 (NULL_EXPR, TREE_TYPE (field), build_call_raise (CE_Discriminant_Check_Failed)); else - gigi_abort (512); + abort (); } /* Build a GCC tree to call an allocation or deallocation function. @@ -1746,15 +1733,15 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align, { /* If the size is a constant, we can put it in the fixed portion of the stack frame to avoid the need to adjust the stack pointer. */ - if (TREE_CODE (gnu_size) == INTEGER_CST && ! flag_stack_check) + if (TREE_CODE (gnu_size) == INTEGER_CST && !flag_stack_check) { tree gnu_range = build_range_type (NULL_TREE, size_one_node, gnu_size); tree gnu_array_type = build_array_type (char_type_node, gnu_range); tree gnu_decl = create_var_decl (get_identifier ("RETVAL"), NULL_TREE, - gnu_array_type, NULL_TREE, 0, 0, 0, 0, 0, - gnat_node); + gnu_array_type, NULL_TREE, false, false, false, + false, NULL, gnat_node); return convert (ptr_void_type_node, build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl)); @@ -1787,7 +1774,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc, tree result; /* If the initializer, if present, is a NULL_EXPR, just return a new one. */ - if (init != 0 && TREE_CODE (init) == NULL_EXPR) + if (init && TREE_CODE (init) == NULL_EXPR) return build1 (NULL_EXPR, result_type, TREE_OPERAND (init, 0)); /* If RESULT_TYPE is a fat or thin pointer, set SIZE to be the sum of the @@ -1823,7 +1810,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc, { type = TREE_TYPE (TYPE_FIELDS (type)); - if (init != 0) + if (init) init = convert (type, init); } @@ -1831,7 +1818,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc, the entire object including the bounds and copy it into the object. If there is no initializing expression, just set the bounds. */ - if (init != 0) + if (init) { template_cons = tree_cons (TREE_CHAIN (TYPE_FIELDS (storage_type)), init, NULL_TREE); @@ -1865,7 +1852,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc, /* If we have an initializing expression, see if its size is simpler than the size from the type. */ - if (init != 0 && TYPE_SIZE_UNIT (TREE_TYPE (init)) != 0 + if (init && TYPE_SIZE_UNIT (TREE_TYPE (init)) && (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (init))) == INTEGER_CST || CONTAINS_PLACEHOLDER_P (size))) size = TYPE_SIZE_UNIT (TREE_TYPE (init)); @@ -1876,10 +1863,10 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc, the maximum size. */ if (CONTAINS_PLACEHOLDER_P (size)) { - if (init == 0) - size = max_size (size, 1); - else + if (init) size = substitute_placeholder_in_expr (size, init); + else + size = max_size (size, true); } /* If the size overflows, pass -1 so the allocator will raise @@ -1942,7 +1929,7 @@ fill_vms_descriptor (tree expr, Entity_Id gnat_formal) { tree record_type = TREE_TYPE (TREE_TYPE (get_gnu_tree (gnat_formal))); tree field; - tree const_list = 0; + tree const_list = NULL_TREE; expr = maybe_unconstrained_array (expr); gnat_mark_addressable (expr); @@ -1995,7 +1982,7 @@ gnat_mark_addressable (tree expr_node) return true; case CONST_DECL: - return (DECL_CONST_CORRESPONDING_VAR (expr_node) != 0 + return (DECL_CONST_CORRESPONDING_VAR (expr_node) && (gnat_mark_addressable (DECL_CONST_CORRESPONDING_VAR (expr_node)))); default: diff --git a/gcc/ada/vms_conv.adb b/gcc/ada/vms_conv.adb index 2ccafffb832..fc924434ad2 100644 --- a/gcc/ada/vms_conv.adb +++ b/gcc/ada/vms_conv.adb @@ -360,6 +360,16 @@ package body VMS_Conv is Params => new Parameter_Array'(1 => Unlimited_Files), Defext => " "), + Setup => + (Cname => new S'("SETUP"), + Usage => new S'("GNAT SETUP /qualifiers"), + VMS_Only => False, + Unixcmd => new S'(""), + Unixsws => null, + Switches => Setup_Switches'Access, + Params => new Parameter_Array'(1 => Unlimited_Files), + Defext => " "), + Shared => (Cname => new S'("SHARED"), Usage => new S'("GNAT SHARED [obj_&_lib_&_exe_&_opt" diff --git a/gcc/ada/vms_conv.ads b/gcc/ada/vms_conv.ads index 3bd22fab4a5..fb0e4dd9c0d 100644 --- a/gcc/ada/vms_conv.ads +++ b/gcc/ada/vms_conv.ads @@ -97,7 +97,8 @@ package VMS_Conv is type Command_Type is (Bind, Chop, Clean, Compile, Elim, Find, Krunch, Library, Link, List, - Make, Metric, Name, Preprocess, Pretty, Shared, Stub, Xref, Undefined); + Make, Metric, Name, Preprocess, Pretty, Setup, Shared, Stub, Xref, + Undefined); type Alternate_Command is (Comp, Ls, Kr, Pp, Prep); -- Alternate command libel for non VMS system diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads index de1512ca76d..e90ea6de862 100644 --- a/gcc/ada/vms_data.ads +++ b/gcc/ada/vms_data.ads @@ -4940,6 +4940,69 @@ package VMS_Data is S_Pretty_Verbose 'Access, S_Pretty_Warnings 'Access); + ----------------------------- + -- Switches for GNAT SETUP -- + ----------------------------- + + S_Setup_Ext : aliased constant S := "/EXTERNAL_REFERENCE=" & '"' & + "-X" & '"'; + -- /EXTERNAL_REFERENCE="name=val" + -- + -- Specifies an external reference to the project manager. Useful only if + -- /PROJECT_FILE is used. + -- + -- Example: + -- /EXTERNAL_REFERENCE="DEBUG=TRUE" + + S_Setup_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" & + "DEFAULT " & + "-vP0 " & + "MEDIUM " & + "-vP1 " & + "HIGH " & + "-vP2"; + -- /MESSAGES_PROJECT_FILE[=messages-option] + -- + -- Specifies the "verbosity" of the parsing of project files. + -- messages-option may be one of the following: + -- + -- DEFAULT (D) No messages are output if there is no error or warning. + -- + -- MEDIUM A small number of messages are output. + -- + -- HIGH A great number of messages are output, most of them not + -- being useful for the user. + + S_Setup_Project : aliased constant S := "/PROJECT_FILE=<" & + "-P>"; + -- /PROJECT_FILE=filename + -- + -- Specifies the main project file to be used. The project files rooted + -- at the main project file are parsed and non existing object + -- directories, library directories and exec directories are created. + + S_Setup_Quiet : aliased constant S := "/QUIET " & + "-q"; + -- /NOQUIET (D) + -- /QUIET + -- + -- Work quietly, only output warnings and errors. + + S_Setup_Verbose : aliased constant S := "/VERBOSE " & + "-v"; + -- /NOVERBOSE (D) + -- /VERBOSE + -- + -- Verbose mode; GNAT PRETTY generates version information and then a + -- trace of the actions it takes to produce or obtain the ASIS tree. + + Setup_Switches : aliased constant Switches := + (S_Setup_Ext 'Access, + S_Setup_Mess 'Access, + S_Setup_Project 'Access, + S_Setup_Quiet 'Access, + S_Setup_Verbose 'Access); + ------------------------------ -- Switches for GNAT SHARED -- ------------------------------ -- 2.30.2