diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2005-07-04 15:27:21 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2005-07-04 15:27:21 +0200 |
commit | d9e0a58787285a0753791dd83a5d831bbbc92117 (patch) | |
tree | 617e7a72024f1df19ef1395e2e890a2461922a3f /gcc/ada | |
parent | c73ae90f23fab6c872b09e02b0d1e34727883056 (diff) | |
download | gcc-d9e0a58787285a0753791dd83a5d831bbbc92117.zip gcc-d9e0a58787285a0753791dd83a5d831bbbc92117.tar.gz gcc-d9e0a58787285a0753791dd83a5d831bbbc92117.tar.bz2 |
decl.c (prepend_attributes): New case.
2005-07-04 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (prepend_attributes) <Pragma_Linker_Constructor>: New case.
<Pragma_Linker_Destructor>: Likewise.
* einfo.ads (Has_Gigi_Rep_Item): Document Pragma_Linker_Constructor and
Pragma_Linker_Destructor.
* gigi.h (attr_type): Add ATTR_LINK_CONSTRUCTOR and
ATTR_LINK_DESTRUCTOR.
(static_ctors, static_dtors): New variables.
* misc.c (gnat_expand_body): Output current function as constructor
and destructor if requested.
* par-prag.adb: Add processing for pragma Linker_Constructor and
Linker_Destructor.
* sem_prag.adb (Find_Unique_Parameterless_Procedure): New function
extracted from Check_Interrupt_Or_Attach_Handler.
(Check_Interrupt_Or_Attach_Handler): Invoke it.
Implement pragma Linker_Constructor and Linker_Destructor with the
help of Find_Unique_Parameterless_Procedure.
Replace Name_Alias with Name_Target for pragma Linker_Alias.
* snames.h, snames.ads, snames.adb:
Add Name_Linker_Constructor and Name_Linker_Destructor.
Add Pragma_Linker_Constructor and Pragma_Linker_Destructor.
* snames.adb: Remove Name_Alias.
* trans.c: Include cgraph.h.
(build_global_cdtor): New function.
(Compilation_Unit_to_gnu): Build global constructor and destructor if
needed.
(tree_transform) <N_Identifier>: Substitute renaming of view-conversions
of objects too.
(addressable_p) <COMPONENT_REF>: Unconditionally test
DECL_NONADDRESSABLE_P on STRICT_ALIGNMENT platforms.
* utils.c (process_attributes) <ATTR_LINK_ALIAS>: Do not assemble the
variable if it is external.
(static_ctors, static_dtors): New global variables.
(process_attributes) <ATTR_LINK_CONSTRUCTOR>: New case.
<ATTR_LINK_DESTRUCTOR>: Likewise.
(end_subprog_body): Chain function as constructor and destructor
if requested.
* exp_util.adb (Force_Evaluation): Unconditionally invoke
Remove_Side_Effects with Variable_Ref set to true.
(Remove_Side_Effects): Handle scalar types first. Use a renaming
for non-scalar types even if Variable_Ref is true and for class-wide
expressions.
From-SVN: r101576
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/decl.c | 8 | ||||
-rw-r--r-- | gcc/ada/einfo.ads | 10 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 176 | ||||
-rw-r--r-- | gcc/ada/gigi.h | 14 | ||||
-rw-r--r-- | gcc/ada/misc.c | 10 | ||||
-rw-r--r-- | gcc/ada/par-prag.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 238 | ||||
-rw-r--r-- | gcc/ada/snames.adb | 3 | ||||
-rw-r--r-- | gcc/ada/snames.ads | 939 | ||||
-rw-r--r-- | gcc/ada/snames.h | 102 | ||||
-rw-r--r-- | gcc/ada/trans.c | 45 | ||||
-rw-r--r-- | gcc/ada/utils.c | 30 |
12 files changed, 846 insertions, 731 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 02db88c..fb6d002 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -4523,6 +4523,14 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list) etype = ATTR_LINK_SECTION; break; + case Pragma_Linker_Constructor: + etype = ATTR_LINK_CONSTRUCTOR; + break; + + case Pragma_Linker_Destructor: + etype = ATTR_LINK_DESTRUCTOR; + break; + case Pragma_Weak_External: etype = ATTR_WEAK_EXTERNAL; break; diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index aecf1cc..4ba4ad9 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1358,13 +1358,15 @@ package Einfo is -- Has_Gigi_Rep_Item (Flag82) -- This flag is set if the rep item chain (referenced by First_Rep_Item --- and linked through the Next_Rep_Item chain contains a representation +-- and linked through the Next_Rep_Item chain) contains a representation -- item that needs to be specially processed by Gigi, i.e. one of the -- following items: -- -- Machine_Attribute pragma -- Linker_Alias pragma -- Linker_Section pragma +-- Linker_Constructor pragma +-- Linker_Destructor pragma -- Weak_External pragma -- -- If this flag is set, then Gigi should scan the rep item chain to @@ -2244,7 +2246,7 @@ package Einfo is -- Is_Private_Composite (Flag107) -- Present in composite types that have a private component. Used to -- enforce the rule that operations on the composite type that depend --- on the fulll view of the component, do not become visible until the +-- on the full view of the component, do not become visible until the -- immediate scope of the composite type itself (7.3.1 (5)). Both this -- flag and Is_Limited_Composite are needed. @@ -6017,7 +6019,7 @@ package Einfo is (E : Entity_Id; Id : Attribute_Id) return Node_Id; -- Searches the Rep_Item chain for a given entity E, for an instance - -- of an attribute definition clause with the given attibute Id Id. If + -- of an attribute definition clause with the given attribute Id. If -- found, the value returned is the N_Attribute_Definition_Clause node, -- otherwise Empty is returned. @@ -6035,7 +6037,7 @@ package Einfo is (E : Entity_Id; Id : Attribute_Id) return Boolean; -- Searches the Rep_Item chain for a given entity E, for an instance - -- of an attribute definition clause with the given attibute Id Id. If + -- of an attribute definition clause with the given attribute Id. If -- found, True is returned, otherwise False indicates that no matching -- entry was found. diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 9a880f3..9004213 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -1485,43 +1485,8 @@ package body Exp_Util is ---------------------- procedure Force_Evaluation (Exp : Node_Id; Name_Req : Boolean := False) is - Component_In_Lhs : Boolean := False; - Par : Node_Id; - begin - -- Loop to determine whether there is a component reference in the left - -- hand side if Exp appears on the left side of an assignment statement. - -- Needed to determine if form of result must be a variable. - - Par := Exp; - while Present (Par) - and then - (Nkind (Par) = N_Selected_Component - or else - Nkind (Par) = N_Indexed_Component) - loop - if Nkind (Parent (Par)) = N_Assignment_Statement - and then Par = Name (Parent (Par)) - then - Component_In_Lhs := True; - exit; - else - Par := Parent (Par); - end if; - end loop; - - -- If the expression is a selected component, it is being evaluated as - -- part of a discriminant check. If it is part of a left-hand side, this - -- is the last use of its value and it is safe to create a renaming for - -- it, rather than a temporary. In addition, if it is not an addressable - -- field, creating a temporary may be a problem for gigi, or might drop - -- the value of the assignment. Therefore, if the expression is on the - -- lhs of an assignment, remove side effects without requiring a - -- temporary, and create a renaming. (See remove_side_effects for - -- details). - - Remove_Side_Effects - (Exp, Name_Req, Variable_Ref => not Component_In_Lhs); + Remove_Side_Effects (Exp, Name_Req, Variable_Ref => True); end Force_Evaluation; ------------------------ @@ -3828,10 +3793,37 @@ package body Exp_Util is Scope_Suppress := (others => True); + -- If it is a scalar type and we need to capture the value, just + -- make a copy. Likewise for a function call. And if we have a + -- volatile variable and Nam_Req is not set (see comments above + -- for Side_Effect_Free). + + if Is_Elementary_Type (Exp_Type) + and then (Variable_Ref + or else Nkind (Exp) = N_Function_Call + or else (not Name_Req + and then Is_Entity_Name (Exp) + and then Treat_As_Volatile (Entity (Exp)))) + then + + Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); + Set_Etype (Def_Id, Exp_Type); + Res := New_Reference_To (Def_Id, Loc); + + E := + Make_Object_Declaration (Loc, + Defining_Identifier => Def_Id, + Object_Definition => New_Reference_To (Exp_Type, Loc), + Constant_Present => True, + Expression => Relocate_Node (Exp)); + + Set_Assignment_OK (E); + Insert_Action (Exp, E); + -- If the expression has the form v.all then we can just capture -- the pointer, and then do an explicit dereference on the result. - if Nkind (Exp) = N_Explicit_Dereference then + elsif Nkind (Exp) = N_Explicit_Dereference then Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Res := @@ -3873,26 +3865,51 @@ package body Exp_Util is Scope_Suppress := Svg_Suppress; return; + -- If this is an unchecked conversion that Gigi can't handle, make + -- a copy or a use a renaming to capture the value. + + elsif Nkind (Exp) = N_Unchecked_Type_Conversion + and then not Safe_Unchecked_Type_Conversion (Exp) + then + if Controlled_Type (Etype (Exp)) then + + -- Use a renaming to capture the expression, rather than create + -- a controlled temporary. + + Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); + Res := New_Reference_To (Def_Id, Loc); + + Insert_Action (Exp, + Make_Object_Renaming_Declaration (Loc, + Defining_Identifier => Def_Id, + Subtype_Mark => New_Reference_To (Exp_Type, Loc), + Name => Relocate_Node (Exp))); + + else + Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); + Set_Etype (Def_Id, Exp_Type); + Res := New_Reference_To (Def_Id, Loc); + + E := + Make_Object_Declaration (Loc, + Defining_Identifier => Def_Id, + Object_Definition => New_Reference_To (Exp_Type, Loc), + Constant_Present => not Is_Variable (Exp), + Expression => Relocate_Node (Exp)); + + Set_Assignment_OK (E); + Insert_Action (Exp, E); + end if; + -- For expressions that denote objects, we can use a renaming scheme. -- We skip using this if we have a volatile variable and we do not -- have Nam_Req set true (see comments above for Side_Effect_Free). - -- We also skip this scheme for class-wide expressions in order to - -- avoid recursive expansion (see Expand_N_Object_Renaming_Declaration) - -- If the object is a function call, we need to create a temporary and - -- not a renaming. - - -- Note that we could use ordinary object declarations in the case of - -- expressions not appearing as lvalues. That is left as a possible - -- optimization in the future but we prefer to generate renamings - -- right now, since we may indeed be transforming an lvalue. elsif Is_Object_Reference (Exp) and then Nkind (Exp) /= N_Function_Call - and then not Variable_Ref and then (Name_Req or else not Is_Entity_Name (Exp) or else not Treat_As_Volatile (Entity (Exp))) - and then not Is_Class_Wide_Type (Exp_Type) then Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); @@ -3917,12 +3934,6 @@ package body Exp_Util is New_Reference_To (Base_Type (Etype (Prefix (Exp))), Loc), Name => Relocate_Node (Prefix (Exp)))); - -- The temporary must be elaborated by gigi, and is of course - -- not to be replaced in-line by the expression it renames, - -- which would defeat the purpose of removing the side-effect. - - Set_Is_Renaming_Of_Object (Def_Id, False); - else Res := New_Reference_To (Def_Id, Loc); @@ -3932,62 +3943,13 @@ package body Exp_Util is Subtype_Mark => New_Reference_To (Exp_Type, Loc), Name => Relocate_Node (Exp))); - Set_Is_Renaming_Of_Object (Def_Id, False); end if; - -- If it is a scalar type, just make a copy - - elsif Is_Elementary_Type (Exp_Type) then - Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); - Set_Etype (Def_Id, Exp_Type); - Res := New_Reference_To (Def_Id, Loc); - - E := - Make_Object_Declaration (Loc, - Defining_Identifier => Def_Id, - Object_Definition => New_Reference_To (Exp_Type, Loc), - Constant_Present => True, - Expression => Relocate_Node (Exp)); - - Set_Assignment_OK (E); - Insert_Action (Exp, E); - - -- Always use a renaming for an unchecked conversion - -- If this is an unchecked conversion that Gigi can't handle, make - -- a copy or a use a renaming to capture the value. - - elsif Nkind (Exp) = N_Unchecked_Type_Conversion - and then not Safe_Unchecked_Type_Conversion (Exp) - then - if Controlled_Type (Etype (Exp)) then - - -- Use a renaming to capture the expression, rather than create - -- a controlled temporary. - - Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); - Res := New_Reference_To (Def_Id, Loc); - - Insert_Action (Exp, - Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Def_Id, - Subtype_Mark => New_Reference_To (Exp_Type, Loc), - Name => Relocate_Node (Exp))); - - else - Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); - Set_Etype (Def_Id, Exp_Type); - Res := New_Reference_To (Def_Id, Loc); - - E := - Make_Object_Declaration (Loc, - Defining_Identifier => Def_Id, - Object_Definition => New_Reference_To (Exp_Type, Loc), - Constant_Present => not Is_Variable (Exp), - Expression => Relocate_Node (Exp)); + -- The temporary must be elaborated by gigi, and is of course + -- not to be replaced in-line by the expression it renames, + -- which would defeat the purpose of removing the side-effect. - Set_Assignment_OK (E); - Insert_Action (Exp, E); - end if; + Set_Is_Renaming_Of_Object (Def_Id, False); -- Otherwise we generate a reference to the value diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index 307e167..0adf644 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -301,8 +301,15 @@ extern int force_global; /* Data structures used to represent attributes. */ -enum attr_type {ATTR_MACHINE_ATTRIBUTE, ATTR_LINK_ALIAS, - ATTR_LINK_SECTION, ATTR_WEAK_EXTERNAL}; +enum attr_type +{ + ATTR_MACHINE_ATTRIBUTE, + ATTR_LINK_ALIAS, + ATTR_LINK_SECTION, + ATTR_LINK_CONSTRUCTOR, + ATTR_LINK_DESTRUCTOR, + ATTR_WEAK_EXTERNAL +}; struct attrib { @@ -359,6 +366,9 @@ enum standard_datatypes extern GTY(()) tree gnat_std_decls[(int) ADT_LAST]; extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; +extern GTY(()) tree static_ctors; +extern GTY(()) tree static_dtors; + #define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type] #define void_type_decl_node gnat_std_decls[(int) ADT_void_type_decl] #define except_type_node gnat_std_decls[(int) ADT_except_type] diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 0279c2f..819e275 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -462,9 +462,9 @@ gnat_init_gcc_eh (void) using_eh_for_cleanups (); eh_personality_libfunc = init_one_libfunc ("__gnat_eh_personality"); - default_init_unwind_resume_libfunc (); lang_eh_type_covers = gnat_eh_type_covers; lang_eh_runtime_type = gnat_eh_runtime_type; + default_init_unwind_resume_libfunc (); /* Turn on -fexceptions and -fnon-call-exceptions. The first one triggers the generation of the necessary exception runtime tables. The second one @@ -634,6 +634,14 @@ gnat_expand_body (tree gnu_decl) return; tree_rest_of_compilation (gnu_decl); + + if (DECL_STATIC_CONSTRUCTOR (gnu_decl) && targetm.have_ctors_dtors) + targetm.asm_out.constructor (XEXP (DECL_RTL (gnu_decl), 0), + DEFAULT_INIT_PRIORITY); + + if (DECL_STATIC_DESTRUCTOR (gnu_decl) && targetm.have_ctors_dtors) + targetm.asm_out.destructor (XEXP (DECL_RTL (gnu_decl), 0), + DEFAULT_INIT_PRIORITY); } /* Adjusts the RLI used to layout a record after all the fields have been diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 7e510eb..fa17a3f 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -1054,6 +1054,8 @@ begin Pragma_License | Pragma_Link_With | Pragma_Linker_Alias | + Pragma_Linker_Constructor | + Pragma_Linker_Destructor | Pragma_Linker_Options | Pragma_Linker_Section | Pragma_Locking_Policy | diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index ec44d9a..797ab24 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -452,6 +452,13 @@ package body Sem_Prag is -- unit pragma that is not a compilation unit pragma, then the -- identifier must be visible. + function Find_Unique_Parameterless_Procedure + (Name : Entity_Id; + Arg : Node_Id) return Entity_Id; + -- Used for a procedure pragma to find the unique parameterless + -- procedure identified by Name, returns it if it exists, otherwise + -- errors out and uses Arg as the pragma argument for the message. + procedure Gather_Associations (Names : Name_List; Args : out Args_List); @@ -1075,107 +1082,41 @@ package body Sem_Prag is procedure Check_Interrupt_Or_Attach_Handler is Arg1_X : constant Node_Id := Expression (Arg1); + Handler_Proc, Proc_Scope : Entity_Id; begin Analyze (Arg1_X); - if not Is_Entity_Name (Arg1_X) then - Error_Pragma_Arg - ("argument of pragma% must be entity name", Arg1); - - elsif Prag_Id = Pragma_Interrupt_Handler then + if Prag_Id = Pragma_Interrupt_Handler then Check_Restriction (No_Dynamic_Attachment, N); end if; - declare - Handler_Proc : Entity_Id := Empty; - Proc_Scope : Entity_Id; - Found : Boolean := False; - - begin - if not Is_Overloaded (Arg1_X) then - Handler_Proc := Entity (Arg1_X); - - else - declare - It : Interp; - Index : Interp_Index; - - begin - Get_First_Interp (Arg1_X, Index, It); - while Present (It.Nam) loop - Handler_Proc := It.Nam; - - if Ekind (Handler_Proc) = E_Procedure - and then No (First_Formal (Handler_Proc)) - then - if not Found then - Found := True; - Set_Entity (Arg1_X, Handler_Proc); - Set_Is_Overloaded (Arg1_X, False); - else - Error_Pragma_Arg - ("ambiguous handler name for pragma% ", Arg1); - end if; - end if; - - Get_Next_Interp (Index, It); - end loop; - - if not Found then - Error_Pragma_Arg - ("argument of pragma% must be parameterless procedure", - Arg1); - else - Handler_Proc := Entity (Arg1_X); - end if; - end; - end if; - - Proc_Scope := Scope (Handler_Proc); + Handler_Proc := Find_Unique_Parameterless_Procedure (Arg1_X, Arg1); + Proc_Scope := Scope (Handler_Proc); - -- On AAMP only, a pragma Interrupt_Handler is supported for - -- nonprotected parameterless procedures. + -- On AAMP only, a pragma Interrupt_Handler is supported for + -- nonprotected parameterless procedures. - if AAMP_On_Target - and then Prag_Id = Pragma_Interrupt_Handler - then - if Ekind (Handler_Proc) /= E_Procedure then - Error_Pragma_Arg - ("argument of pragma% must be a procedure", Arg1); - end if; - - elsif Ekind (Handler_Proc) /= E_Procedure - or else Ekind (Proc_Scope) /= E_Protected_Type - then + if not AAMP_On_Target + or else Prag_Id = Pragma_Attach_Handler + then + if Ekind (Proc_Scope) /= E_Protected_Type then Error_Pragma_Arg ("argument of pragma% must be protected procedure", Arg1); end if; - if (not AAMP_On_Target or else Prag_Id = Pragma_Attach_Handler) - and then Ekind (Proc_Scope) = E_Protected_Type - then - if Parent (N) /= - Protected_Definition (Parent (Proc_Scope)) - then - Error_Pragma ("pragma% must be in protected definition"); - end if; - end if; - - if not Is_Library_Level_Entity (Proc_Scope) - or else (AAMP_On_Target - and then not Is_Library_Level_Entity (Handler_Proc)) - then - Error_Pragma_Arg - ("pragma% requires library-level entity", Arg1); + if Parent (N) /= Protected_Definition (Parent (Proc_Scope)) then + Error_Pragma ("pragma% must be in protected definition"); end if; + end if; - if Present (First_Formal (Handler_Proc)) then - Error_Pragma_Arg - ("argument of pragma% must be parameterless procedure", - Arg1); - end if; - end; + if not Is_Library_Level_Entity (Proc_Scope) + or else (AAMP_On_Target + and then not Is_Library_Level_Entity (Handler_Proc)) + then + Error_Pragma_Arg + ("argument for pragma% must be library level entity", Arg1); + end if; end Check_Interrupt_Or_Attach_Handler; ------------------------------------------- @@ -1614,9 +1555,74 @@ package body Sem_Prag is else Analyze (Id); end if; - end Find_Program_Unit_Name; + ----------------------------------------- + -- Find_Unique_Parameterless_Procedure -- + ----------------------------------------- + + function Find_Unique_Parameterless_Procedure + (Name : Entity_Id; + Arg : Node_Id) return Entity_Id + is + Proc : Entity_Id := Empty; + + begin + -- The body of this procedure needs some comments ??? + + if not Is_Entity_Name (Name) then + Error_Pragma_Arg + ("argument of pragma% must be entity name", Arg); + + elsif not Is_Overloaded (Name) then + Proc := Entity (Name); + + if Ekind (Proc) /= E_Procedure + or else Present (First_Formal (Proc)) then + Error_Pragma_Arg + ("argument of pragma% must be parameterless procedure", Arg); + end if; + + else + declare + Found : Boolean := False; + It : Interp; + Index : Interp_Index; + + begin + Get_First_Interp (Name, Index, It); + while Present (It.Nam) loop + Proc := It.Nam; + + if Ekind (Proc) = E_Procedure + and then No (First_Formal (Proc)) + then + if not Found then + Found := True; + Set_Entity (Name, Proc); + Set_Is_Overloaded (Name, False); + else + Error_Pragma_Arg + ("ambiguous handler name for pragma% ", Arg); + end if; + end if; + + Get_Next_Interp (Index, It); + end loop; + + if not Found then + Error_Pragma_Arg + ("argument of pragma% must be parameterless procedure", + Arg); + else + Proc := Entity (Name); + end if; + end; + end if; + + return Proc; + end Find_Unique_Parameterless_Procedure; + ------------------------- -- Gather_Associations -- ------------------------- @@ -2168,7 +2174,7 @@ package body Sem_Prag is Comp_Unit := Get_Source_Unit (E); Set_Convention_From_Pragma (E); - -- Treat a pragma Import as an implicit body, for GPS use. + -- Treat a pragma Import as an implicit body, for GPS use if Prag_Id = Pragma_Import then Generate_Reference (E, Id, 'b'); @@ -4403,7 +4409,7 @@ package body Sem_Prag is Lib_Entity := Find_Lib_Unit_Name; - -- This pragma should only apply to a RCI unit (RM E.2.3(23)). + -- This pragma should only apply to a RCI unit (RM E.2.3(23)) if Present (Lib_Entity) and then not Debug_Flag_U @@ -7659,14 +7665,14 @@ package body Sem_Prag is -- pragma Linker_Alias ( -- [Entity =>] LOCAL_NAME - -- [Alias =>] static_string_EXPRESSION); + -- [Target =>] static_string_EXPRESSION); when Pragma_Linker_Alias => GNAT_Pragma; - Check_Arg_Order ((Name_Entity, Name_Alias)); + Check_Arg_Order ((Name_Entity, Name_Target)); Check_Arg_Count (2); Check_Optional_Identifier (Arg1, Name_Entity); - Check_Optional_Identifier (Arg2, Name_Alias); + Check_Optional_Identifier (Arg2, Name_Target); Check_Arg_Is_Library_Level_Local_Name (Arg1); Check_Arg_Is_Static_Expression (Arg2, Standard_String); @@ -7681,6 +7687,52 @@ package body Sem_Prag is Set_Has_Gigi_Rep_Item (Entity (Expression (Arg1))); end if; + ------------------------ + -- Linker_Constructor -- + ------------------------ + + -- pragma Linker_Constructor (procedure_LOCAL_NAME); + + -- Code is shared with Linker_Destructor + + ----------------------- + -- Linker_Destructor -- + ----------------------- + + -- pragma Linker_Destructor (procedure_LOCAL_NAME); + + when Pragma_Linker_Constructor | + Pragma_Linker_Destructor => + Linker_Constructor : declare + Arg1_X : Node_Id; + Proc : Entity_Id; + + begin + GNAT_Pragma; + Check_Arg_Count (1); + Check_No_Identifiers; + Check_Arg_Is_Local_Name (Arg1); + Arg1_X := Expression (Arg1); + Analyze (Arg1_X); + Proc := Find_Unique_Parameterless_Procedure (Arg1_X, Arg1); + + if not Is_Library_Level_Entity (Proc) then + Error_Pragma_Arg + ("argument for pragma% must be library level entity", Arg1); + end if; + + -- The only processing required is to link this item on to the + -- list of rep items for the given entity. This is accomplished + -- by the call to Rep_Item_Too_Late (when no error is detected + -- and False is returned). + + if Rep_Item_Too_Late (Proc, N) then + return; + else + Set_Has_Gigi_Rep_Item (Proc); + end if; + end Linker_Constructor; + -------------------- -- Linker_Options -- -------------------- @@ -10555,6 +10607,8 @@ package body Sem_Prag is Pragma_License => -1, Pragma_Link_With => -1, Pragma_Linker_Alias => -1, + Pragma_Linker_Constructor => -1, + Pragma_Linker_Destructor => -1, Pragma_Linker_Options => -1, Pragma_Linker_Section => -1, Pragma_List => -1, diff --git a/gcc/ada/snames.adb b/gcc/ada/snames.adb index 23c8e82..e98f4c5 100644 --- a/gcc/ada/snames.adb +++ b/gcc/ada/snames.adb @@ -262,6 +262,8 @@ package body Snames is "keep_names#" & "link_with#" & "linker_alias#" & + "linker_constructor#" & + "linker_destructor#" & "linker_options#" & "linker_section#" & "list#" & @@ -322,7 +324,6 @@ package body Snames is "default#" & "dll#" & "win32#" & - "alias#" & "as_is#" & "attribute_name#" & "body_file_name#" & diff --git a/gcc/ada/snames.ads b/gcc/ada/snames.ads index 0bb9820..425f707 100644 --- a/gcc/ada/snames.ads +++ b/gcc/ada/snames.ads @@ -427,32 +427,34 @@ package Snames is Name_Keep_Names : constant Name_Id := N + 202; -- GNAT Name_Link_With : constant Name_Id := N + 203; -- GNAT Name_Linker_Alias : constant Name_Id := N + 204; -- GNAT - Name_Linker_Options : constant Name_Id := N + 205; - Name_Linker_Section : constant Name_Id := N + 206; -- GNAT - Name_List : constant Name_Id := N + 207; - Name_Machine_Attribute : constant Name_Id := N + 208; -- GNAT - Name_Main : constant Name_Id := N + 209; -- GNAT - Name_Main_Storage : constant Name_Id := N + 210; -- GNAT - Name_Memory_Size : constant Name_Id := N + 211; -- Ada 83 - Name_No_Return : constant Name_Id := N + 212; -- GNAT - Name_Obsolescent : constant Name_Id := N + 213; -- GNAT - Name_Optimize : constant Name_Id := N + 214; - Name_Optional_Overriding : constant Name_Id := N + 215; -- Ada 05 - Name_Pack : constant Name_Id := N + 216; - Name_Page : constant Name_Id := N + 217; - Name_Passive : constant Name_Id := N + 218; -- GNAT - Name_Preelaborate : constant Name_Id := N + 219; - Name_Preelaborate_05 : constant Name_Id := N + 220; -- GNAT - Name_Priority : constant Name_Id := N + 221; - Name_Psect_Object : constant Name_Id := N + 222; -- VMS - Name_Pure : constant Name_Id := N + 223; - Name_Pure_05 : constant Name_Id := N + 224; -- GNAT - Name_Pure_Function : constant Name_Id := N + 225; -- GNAT - Name_Remote_Call_Interface : constant Name_Id := N + 226; - Name_Remote_Types : constant Name_Id := N + 227; - Name_Share_Generic : constant Name_Id := N + 228; -- GNAT - Name_Shared : constant Name_Id := N + 229; -- Ada 83 - Name_Shared_Passive : constant Name_Id := N + 230; + Name_Linker_Constructor : constant Name_Id := N + 205; -- GNAT + Name_Linker_Destructor : constant Name_Id := N + 206; -- GNAT + Name_Linker_Options : constant Name_Id := N + 207; + Name_Linker_Section : constant Name_Id := N + 208; -- GNAT + Name_List : constant Name_Id := N + 209; + Name_Machine_Attribute : constant Name_Id := N + 210; -- GNAT + Name_Main : constant Name_Id := N + 211; -- GNAT + Name_Main_Storage : constant Name_Id := N + 212; -- GNAT + Name_Memory_Size : constant Name_Id := N + 213; -- Ada 83 + Name_No_Return : constant Name_Id := N + 214; -- GNAT + Name_Obsolescent : constant Name_Id := N + 215; -- GNAT + Name_Optimize : constant Name_Id := N + 216; + Name_Optional_Overriding : constant Name_Id := N + 217; -- Ada 05 + Name_Pack : constant Name_Id := N + 218; + Name_Page : constant Name_Id := N + 219; + Name_Passive : constant Name_Id := N + 220; -- GNAT + Name_Preelaborate : constant Name_Id := N + 221; + Name_Preelaborate_05 : constant Name_Id := N + 222; -- GNAT + Name_Priority : constant Name_Id := N + 223; + Name_Psect_Object : constant Name_Id := N + 224; -- VMS + Name_Pure : constant Name_Id := N + 225; + Name_Pure_05 : constant Name_Id := N + 226; -- GNAT + Name_Pure_Function : constant Name_Id := N + 227; -- GNAT + Name_Remote_Call_Interface : constant Name_Id := N + 228; + Name_Remote_Types : constant Name_Id := N + 229; + Name_Share_Generic : constant Name_Id := N + 230; -- GNAT + Name_Shared : constant Name_Id := N + 231; -- Ada 83 + Name_Shared_Passive : constant Name_Id := N + 232; -- Note: Storage_Size is not in this list because its name matches the -- name of the corresponding attribute. However, it is included in the @@ -462,27 +464,27 @@ package Snames is -- Note: Storage_Unit is also omitted from the list because of a clash -- with an attribute name, and is treated similarly. - Name_Source_Reference : constant Name_Id := N + 231; -- GNAT - Name_Stream_Convert : constant Name_Id := N + 232; -- GNAT - Name_Subtitle : constant Name_Id := N + 233; -- GNAT - Name_Suppress_All : constant Name_Id := N + 234; -- GNAT - Name_Suppress_Debug_Info : constant Name_Id := N + 235; -- GNAT - Name_Suppress_Initialization : constant Name_Id := N + 236; -- GNAT - Name_System_Name : constant Name_Id := N + 237; -- Ada 83 - Name_Task_Info : constant Name_Id := N + 238; -- GNAT - Name_Task_Name : constant Name_Id := N + 239; -- GNAT - Name_Task_Storage : constant Name_Id := N + 240; -- VMS - Name_Thread_Body : constant Name_Id := N + 241; -- GNAT - Name_Time_Slice : constant Name_Id := N + 242; -- GNAT - Name_Title : constant Name_Id := N + 243; -- GNAT - Name_Unchecked_Union : constant Name_Id := N + 244; -- GNAT - Name_Unimplemented_Unit : constant Name_Id := N + 245; -- GNAT - Name_Unreferenced : constant Name_Id := N + 246; -- GNAT - Name_Unreserve_All_Interrupts : constant Name_Id := N + 247; -- GNAT - Name_Volatile : constant Name_Id := N + 248; - Name_Volatile_Components : constant Name_Id := N + 249; - Name_Weak_External : constant Name_Id := N + 250; -- GNAT - Last_Pragma_Name : constant Name_Id := N + 250; + Name_Source_Reference : constant Name_Id := N + 233; -- GNAT + Name_Stream_Convert : constant Name_Id := N + 234; -- GNAT + Name_Subtitle : constant Name_Id := N + 235; -- GNAT + Name_Suppress_All : constant Name_Id := N + 236; -- GNAT + Name_Suppress_Debug_Info : constant Name_Id := N + 237; -- GNAT + Name_Suppress_Initialization : constant Name_Id := N + 238; -- GNAT + Name_System_Name : constant Name_Id := N + 239; -- Ada 83 + Name_Task_Info : constant Name_Id := N + 240; -- GNAT + Name_Task_Name : constant Name_Id := N + 241; -- GNAT + Name_Task_Storage : constant Name_Id := N + 242; -- VMS + Name_Thread_Body : constant Name_Id := N + 243; -- GNAT + Name_Time_Slice : constant Name_Id := N + 244; -- GNAT + Name_Title : constant Name_Id := N + 245; -- GNAT + Name_Unchecked_Union : constant Name_Id := N + 246; -- GNAT + Name_Unimplemented_Unit : constant Name_Id := N + 247; -- GNAT + Name_Unreferenced : constant Name_Id := N + 248; -- GNAT + Name_Unreserve_All_Interrupts : constant Name_Id := N + 249; -- GNAT + Name_Volatile : constant Name_Id := N + 250; + Name_Volatile_Components : constant Name_Id := N + 251; + Name_Weak_External : constant Name_Id := N + 252; -- GNAT + Last_Pragma_Name : constant Name_Id := N + 252; -- Language convention names for pragma Convention/Export/Import/Interface -- Note that Name_C is not included in this list, since it was already @@ -493,115 +495,114 @@ package Snames is -- Entry and Protected, this is because these conventions cannot be -- specified by a pragma. - First_Convention_Name : constant Name_Id := N + 251; - Name_Ada : constant Name_Id := N + 251; - Name_Assembler : constant Name_Id := N + 252; - Name_COBOL : constant Name_Id := N + 253; - Name_CPP : constant Name_Id := N + 254; - Name_Fortran : constant Name_Id := N + 255; - Name_Intrinsic : constant Name_Id := N + 256; - Name_Java : constant Name_Id := N + 257; - Name_Stdcall : constant Name_Id := N + 258; - Name_Stubbed : constant Name_Id := N + 259; - Last_Convention_Name : constant Name_Id := N + 259; + First_Convention_Name : constant Name_Id := N + 253; + Name_Ada : constant Name_Id := N + 253; + Name_Assembler : constant Name_Id := N + 254; + Name_COBOL : constant Name_Id := N + 255; + Name_CPP : constant Name_Id := N + 256; + Name_Fortran : constant Name_Id := N + 257; + Name_Intrinsic : constant Name_Id := N + 258; + Name_Java : constant Name_Id := N + 259; + Name_Stdcall : constant Name_Id := N + 260; + Name_Stubbed : constant Name_Id := N + 261; + Last_Convention_Name : constant Name_Id := N + 261; -- The following names are preset as synonyms for Assembler - Name_Asm : constant Name_Id := N + 260; - Name_Assembly : constant Name_Id := N + 261; + Name_Asm : constant Name_Id := N + 262; + Name_Assembly : constant Name_Id := N + 263; -- The following names are preset as synonyms for C - Name_Default : constant Name_Id := N + 262; + Name_Default : constant Name_Id := N + 264; -- Name_Exernal (previously defined as pragma) -- The following names are present as synonyms for Stdcall - Name_DLL : constant Name_Id := N + 263; - Name_Win32 : constant Name_Id := N + 264; + Name_DLL : constant Name_Id := N + 265; + Name_Win32 : constant Name_Id := N + 266; -- Other special names used in processing pragmas - Name_Alias : constant Name_Id := N + 265; - Name_As_Is : constant Name_Id := N + 266; - Name_Attribute_Name : constant Name_Id := N + 267; - Name_Body_File_Name : constant Name_Id := N + 268; - Name_Boolean_Entry_Barriers : constant Name_Id := N + 269; - Name_Check : constant Name_Id := N + 270; - Name_Casing : constant Name_Id := N + 271; - Name_Code : constant Name_Id := N + 272; - Name_Component : constant Name_Id := N + 273; - Name_Component_Size_4 : constant Name_Id := N + 274; - Name_Copy : constant Name_Id := N + 275; - Name_D_Float : constant Name_Id := N + 276; - Name_Descriptor : constant Name_Id := N + 277; - Name_Dot_Replacement : constant Name_Id := N + 278; - Name_Dynamic : constant Name_Id := N + 279; - Name_Entity : constant Name_Id := N + 280; - Name_Entry_Count : constant Name_Id := N + 281; - Name_External_Name : constant Name_Id := N + 282; - Name_First_Optional_Parameter : constant Name_Id := N + 283; - Name_Form : constant Name_Id := N + 284; - Name_G_Float : constant Name_Id := N + 285; - Name_Gcc : constant Name_Id := N + 286; - Name_Gnat : constant Name_Id := N + 287; - Name_GPL : constant Name_Id := N + 288; - Name_IEEE_Float : constant Name_Id := N + 289; - Name_Ignore : constant Name_Id := N + 290; - Name_Info : constant Name_Id := N + 291; - Name_Internal : constant Name_Id := N + 292; - Name_Link_Name : constant Name_Id := N + 293; - Name_Lowercase : constant Name_Id := N + 294; - Name_Max_Entry_Queue_Depth : constant Name_Id := N + 295; - Name_Max_Entry_Queue_Length : constant Name_Id := N + 296; - Name_Max_Size : constant Name_Id := N + 297; - Name_Mechanism : constant Name_Id := N + 298; - Name_Message : constant Name_Id := N + 299; - Name_Mixedcase : constant Name_Id := N + 300; - Name_Modified_GPL : constant Name_Id := N + 301; - Name_Name : constant Name_Id := N + 302; - Name_NCA : constant Name_Id := N + 303; - Name_No : constant Name_Id := N + 304; - Name_No_Dependence : constant Name_Id := N + 305; - Name_No_Dynamic_Attachment : constant Name_Id := N + 306; - Name_No_Dynamic_Interrupts : constant Name_Id := N + 307; - Name_No_Requeue : constant Name_Id := N + 308; - Name_No_Requeue_Statements : constant Name_Id := N + 309; - Name_No_Task_Attributes : constant Name_Id := N + 310; - Name_No_Task_Attributes_Package : constant Name_Id := N + 311; - Name_On : constant Name_Id := N + 312; - Name_Parameter_Types : constant Name_Id := N + 313; - Name_Reference : constant Name_Id := N + 314; - Name_Restricted : constant Name_Id := N + 315; - Name_Result_Mechanism : constant Name_Id := N + 316; - Name_Result_Type : constant Name_Id := N + 317; - Name_Runtime : constant Name_Id := N + 318; - Name_SB : constant Name_Id := N + 319; - Name_Secondary_Stack_Size : constant Name_Id := N + 320; - Name_Section : constant Name_Id := N + 321; - Name_Semaphore : constant Name_Id := N + 322; - Name_Simple_Barriers : constant Name_Id := N + 323; - Name_Spec_File_Name : constant Name_Id := N + 324; - Name_State : constant Name_Id := N + 325; - Name_Static : constant Name_Id := N + 326; - Name_Stack_Size : constant Name_Id := N + 327; - Name_Subunit_File_Name : constant Name_Id := N + 328; - Name_Task_Stack_Size_Default : constant Name_Id := N + 329; - Name_Task_Type : constant Name_Id := N + 330; - Name_Time_Slicing_Enabled : constant Name_Id := N + 331; - Name_Top_Guard : constant Name_Id := N + 332; - Name_UBA : constant Name_Id := N + 333; - Name_UBS : constant Name_Id := N + 334; - Name_UBSB : constant Name_Id := N + 335; - Name_Unit_Name : constant Name_Id := N + 336; - Name_Unknown : constant Name_Id := N + 337; - Name_Unrestricted : constant Name_Id := N + 338; - Name_Uppercase : constant Name_Id := N + 339; - Name_User : constant Name_Id := N + 340; - Name_VAX_Float : constant Name_Id := N + 341; - Name_VMS : constant Name_Id := N + 342; - Name_Vtable_Ptr : constant Name_Id := N + 343; - Name_Working_Storage : constant Name_Id := N + 344; + Name_As_Is : constant Name_Id := N + 267; + Name_Attribute_Name : constant Name_Id := N + 268; + Name_Body_File_Name : constant Name_Id := N + 269; + Name_Boolean_Entry_Barriers : constant Name_Id := N + 270; + Name_Check : constant Name_Id := N + 271; + Name_Casing : constant Name_Id := N + 272; + Name_Code : constant Name_Id := N + 273; + Name_Component : constant Name_Id := N + 274; + Name_Component_Size_4 : constant Name_Id := N + 275; + Name_Copy : constant Name_Id := N + 276; + Name_D_Float : constant Name_Id := N + 277; + Name_Descriptor : constant Name_Id := N + 278; + Name_Dot_Replacement : constant Name_Id := N + 279; + Name_Dynamic : constant Name_Id := N + 280; + Name_Entity : constant Name_Id := N + 281; + Name_Entry_Count : constant Name_Id := N + 282; + Name_External_Name : constant Name_Id := N + 283; + Name_First_Optional_Parameter : constant Name_Id := N + 284; + Name_Form : constant Name_Id := N + 285; + Name_G_Float : constant Name_Id := N + 286; + Name_Gcc : constant Name_Id := N + 287; + Name_Gnat : constant Name_Id := N + 288; + Name_GPL : constant Name_Id := N + 289; + Name_IEEE_Float : constant Name_Id := N + 290; + Name_Ignore : constant Name_Id := N + 291; + Name_Info : constant Name_Id := N + 292; + Name_Internal : constant Name_Id := N + 293; + Name_Link_Name : constant Name_Id := N + 294; + Name_Lowercase : constant Name_Id := N + 295; + Name_Max_Entry_Queue_Depth : constant Name_Id := N + 296; + Name_Max_Entry_Queue_Length : constant Name_Id := N + 297; + Name_Max_Size : constant Name_Id := N + 298; + Name_Mechanism : constant Name_Id := N + 299; + Name_Message : constant Name_Id := N + 300; + Name_Mixedcase : constant Name_Id := N + 301; + Name_Modified_GPL : constant Name_Id := N + 302; + Name_Name : constant Name_Id := N + 303; + Name_NCA : constant Name_Id := N + 304; + Name_No : constant Name_Id := N + 305; + Name_No_Dependence : constant Name_Id := N + 306; + Name_No_Dynamic_Attachment : constant Name_Id := N + 307; + Name_No_Dynamic_Interrupts : constant Name_Id := N + 308; + Name_No_Requeue : constant Name_Id := N + 309; + Name_No_Requeue_Statements : constant Name_Id := N + 310; + Name_No_Task_Attributes : constant Name_Id := N + 311; + Name_No_Task_Attributes_Package : constant Name_Id := N + 312; + Name_On : constant Name_Id := N + 313; + Name_Parameter_Types : constant Name_Id := N + 314; + Name_Reference : constant Name_Id := N + 315; + Name_Restricted : constant Name_Id := N + 316; + Name_Result_Mechanism : constant Name_Id := N + 317; + Name_Result_Type : constant Name_Id := N + 318; + Name_Runtime : constant Name_Id := N + 319; + Name_SB : constant Name_Id := N + 320; + Name_Secondary_Stack_Size : constant Name_Id := N + 321; + Name_Section : constant Name_Id := N + 322; + Name_Semaphore : constant Name_Id := N + 323; + Name_Simple_Barriers : constant Name_Id := N + 324; + Name_Spec_File_Name : constant Name_Id := N + 325; + Name_State : constant Name_Id := N + 326; + Name_Static : constant Name_Id := N + 327; + Name_Stack_Size : constant Name_Id := N + 328; + Name_Subunit_File_Name : constant Name_Id := N + 329; + Name_Task_Stack_Size_Default : constant Name_Id := N + 330; + Name_Task_Type : constant Name_Id := N + 331; + Name_Time_Slicing_Enabled : constant Name_Id := N + 332; + Name_Top_Guard : constant Name_Id := N + 333; + Name_UBA : constant Name_Id := N + 334; + Name_UBS : constant Name_Id := N + 335; + Name_UBSB : constant Name_Id := N + 336; + Name_Unit_Name : constant Name_Id := N + 337; + Name_Unknown : constant Name_Id := N + 338; + Name_Unrestricted : constant Name_Id := N + 339; + Name_Uppercase : constant Name_Id := N + 340; + Name_User : constant Name_Id := N + 341; + Name_VAX_Float : constant Name_Id := N + 342; + Name_VMS : constant Name_Id := N + 343; + Name_Vtable_Ptr : constant Name_Id := N + 344; + Name_Working_Storage : constant Name_Id := N + 345; -- Names of recognized attributes. The entries with the comment "Ada 83" -- are attributes that are defined in Ada 83, but not in Ada 95. These @@ -615,165 +616,165 @@ package Snames is -- The entries marked VMS are recognized only in OpenVMS implementations -- of GNAT, and are treated as illegal in all other contexts. - First_Attribute_Name : constant Name_Id := N + 345; - Name_Abort_Signal : constant Name_Id := N + 345; -- GNAT - Name_Access : constant Name_Id := N + 346; - Name_Address : constant Name_Id := N + 347; - Name_Address_Size : constant Name_Id := N + 348; -- GNAT - Name_Aft : constant Name_Id := N + 349; - Name_Alignment : constant Name_Id := N + 350; - Name_Asm_Input : constant Name_Id := N + 351; -- GNAT - Name_Asm_Output : constant Name_Id := N + 352; -- GNAT - Name_AST_Entry : constant Name_Id := N + 353; -- VMS - Name_Bit : constant Name_Id := N + 354; -- GNAT - Name_Bit_Order : constant Name_Id := N + 355; - Name_Bit_Position : constant Name_Id := N + 356; -- GNAT - Name_Body_Version : constant Name_Id := N + 357; - Name_Callable : constant Name_Id := N + 358; - Name_Caller : constant Name_Id := N + 359; - Name_Code_Address : constant Name_Id := N + 360; -- GNAT - Name_Component_Size : constant Name_Id := N + 361; - Name_Compose : constant Name_Id := N + 362; - Name_Constrained : constant Name_Id := N + 363; - Name_Count : constant Name_Id := N + 364; - Name_Default_Bit_Order : constant Name_Id := N + 365; -- GNAT - Name_Definite : constant Name_Id := N + 366; - Name_Delta : constant Name_Id := N + 367; - Name_Denorm : constant Name_Id := N + 368; - Name_Digits : constant Name_Id := N + 369; - Name_Elaborated : constant Name_Id := N + 370; -- GNAT - Name_Emax : constant Name_Id := N + 371; -- Ada 83 - Name_Enum_Rep : constant Name_Id := N + 372; -- GNAT - Name_Epsilon : constant Name_Id := N + 373; -- Ada 83 - Name_Exponent : constant Name_Id := N + 374; - Name_External_Tag : constant Name_Id := N + 375; - Name_First : constant Name_Id := N + 376; - Name_First_Bit : constant Name_Id := N + 377; - Name_Fixed_Value : constant Name_Id := N + 378; -- GNAT - Name_Fore : constant Name_Id := N + 379; - Name_Has_Access_Values : constant Name_Id := N + 380; -- GNAT - Name_Has_Discriminants : constant Name_Id := N + 381; -- GNAT - Name_Identity : constant Name_Id := N + 382; - Name_Img : constant Name_Id := N + 383; -- GNAT - Name_Integer_Value : constant Name_Id := N + 384; -- GNAT - Name_Large : constant Name_Id := N + 385; -- Ada 83 - Name_Last : constant Name_Id := N + 386; - Name_Last_Bit : constant Name_Id := N + 387; - Name_Leading_Part : constant Name_Id := N + 388; - Name_Length : constant Name_Id := N + 389; - Name_Machine_Emax : constant Name_Id := N + 390; - Name_Machine_Emin : constant Name_Id := N + 391; - Name_Machine_Mantissa : constant Name_Id := N + 392; - Name_Machine_Overflows : constant Name_Id := N + 393; - Name_Machine_Radix : constant Name_Id := N + 394; - Name_Machine_Rounds : constant Name_Id := N + 395; - Name_Machine_Size : constant Name_Id := N + 396; -- GNAT - Name_Mantissa : constant Name_Id := N + 397; -- Ada 83 - Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 398; - Name_Maximum_Alignment : constant Name_Id := N + 399; -- GNAT - Name_Mechanism_Code : constant Name_Id := N + 400; -- GNAT - Name_Mod : constant Name_Id := N + 401; - Name_Model_Emin : constant Name_Id := N + 402; - Name_Model_Epsilon : constant Name_Id := N + 403; - Name_Model_Mantissa : constant Name_Id := N + 404; - Name_Model_Small : constant Name_Id := N + 405; - Name_Modulus : constant Name_Id := N + 406; - Name_Null_Parameter : constant Name_Id := N + 407; -- GNAT - Name_Object_Size : constant Name_Id := N + 408; -- GNAT - Name_Partition_ID : constant Name_Id := N + 409; - Name_Passed_By_Reference : constant Name_Id := N + 410; -- GNAT - Name_Pool_Address : constant Name_Id := N + 411; - Name_Pos : constant Name_Id := N + 412; - Name_Position : constant Name_Id := N + 413; - Name_Range : constant Name_Id := N + 414; - Name_Range_Length : constant Name_Id := N + 415; -- GNAT - Name_Round : constant Name_Id := N + 416; - Name_Safe_Emax : constant Name_Id := N + 417; -- Ada 83 - Name_Safe_First : constant Name_Id := N + 418; - Name_Safe_Large : constant Name_Id := N + 419; -- Ada 83 - Name_Safe_Last : constant Name_Id := N + 420; - Name_Safe_Small : constant Name_Id := N + 421; -- Ada 83 - Name_Scale : constant Name_Id := N + 422; - Name_Scaling : constant Name_Id := N + 423; - Name_Signed_Zeros : constant Name_Id := N + 424; - Name_Size : constant Name_Id := N + 425; - Name_Small : constant Name_Id := N + 426; - Name_Storage_Size : constant Name_Id := N + 427; - Name_Storage_Unit : constant Name_Id := N + 428; -- GNAT - Name_Stream_Size : constant Name_Id := N + 429; -- Ada 05 - Name_Tag : constant Name_Id := N + 430; - Name_Target_Name : constant Name_Id := N + 431; -- GNAT - Name_Terminated : constant Name_Id := N + 432; - Name_To_Address : constant Name_Id := N + 433; -- GNAT - Name_Type_Class : constant Name_Id := N + 434; -- GNAT - Name_UET_Address : constant Name_Id := N + 435; -- GNAT - Name_Unbiased_Rounding : constant Name_Id := N + 436; - Name_Unchecked_Access : constant Name_Id := N + 437; - Name_Unconstrained_Array : constant Name_Id := N + 438; - Name_Universal_Literal_String : constant Name_Id := N + 439; -- GNAT - Name_Unrestricted_Access : constant Name_Id := N + 440; -- GNAT - Name_VADS_Size : constant Name_Id := N + 441; -- GNAT - Name_Val : constant Name_Id := N + 442; - Name_Valid : constant Name_Id := N + 443; - Name_Value_Size : constant Name_Id := N + 444; -- GNAT - Name_Version : constant Name_Id := N + 445; - Name_Wchar_T_Size : constant Name_Id := N + 446; -- GNAT - Name_Wide_Wide_Width : constant Name_Id := N + 447; -- Ada 05 - Name_Wide_Width : constant Name_Id := N + 448; - Name_Width : constant Name_Id := N + 449; - Name_Word_Size : constant Name_Id := N + 450; -- GNAT + First_Attribute_Name : constant Name_Id := N + 346; + Name_Abort_Signal : constant Name_Id := N + 346; -- GNAT + Name_Access : constant Name_Id := N + 347; + Name_Address : constant Name_Id := N + 348; + Name_Address_Size : constant Name_Id := N + 349; -- GNAT + Name_Aft : constant Name_Id := N + 350; + Name_Alignment : constant Name_Id := N + 351; + Name_Asm_Input : constant Name_Id := N + 352; -- GNAT + Name_Asm_Output : constant Name_Id := N + 353; -- GNAT + Name_AST_Entry : constant Name_Id := N + 354; -- VMS + Name_Bit : constant Name_Id := N + 355; -- GNAT + Name_Bit_Order : constant Name_Id := N + 356; + Name_Bit_Position : constant Name_Id := N + 357; -- GNAT + Name_Body_Version : constant Name_Id := N + 358; + Name_Callable : constant Name_Id := N + 359; + Name_Caller : constant Name_Id := N + 360; + Name_Code_Address : constant Name_Id := N + 361; -- GNAT + Name_Component_Size : constant Name_Id := N + 362; + Name_Compose : constant Name_Id := N + 363; + Name_Constrained : constant Name_Id := N + 364; + Name_Count : constant Name_Id := N + 365; + Name_Default_Bit_Order : constant Name_Id := N + 366; -- GNAT + Name_Definite : constant Name_Id := N + 367; + Name_Delta : constant Name_Id := N + 368; + Name_Denorm : constant Name_Id := N + 369; + Name_Digits : constant Name_Id := N + 370; + Name_Elaborated : constant Name_Id := N + 371; -- GNAT + Name_Emax : constant Name_Id := N + 372; -- Ada 83 + Name_Enum_Rep : constant Name_Id := N + 373; -- GNAT + Name_Epsilon : constant Name_Id := N + 374; -- Ada 83 + Name_Exponent : constant Name_Id := N + 375; + Name_External_Tag : constant Name_Id := N + 376; + Name_First : constant Name_Id := N + 377; + Name_First_Bit : constant Name_Id := N + 378; + Name_Fixed_Value : constant Name_Id := N + 379; -- GNAT + Name_Fore : constant Name_Id := N + 380; + Name_Has_Access_Values : constant Name_Id := N + 381; -- GNAT + Name_Has_Discriminants : constant Name_Id := N + 382; -- GNAT + Name_Identity : constant Name_Id := N + 383; + Name_Img : constant Name_Id := N + 384; -- GNAT + Name_Integer_Value : constant Name_Id := N + 385; -- GNAT + Name_Large : constant Name_Id := N + 386; -- Ada 83 + Name_Last : constant Name_Id := N + 387; + Name_Last_Bit : constant Name_Id := N + 388; + Name_Leading_Part : constant Name_Id := N + 389; + Name_Length : constant Name_Id := N + 390; + Name_Machine_Emax : constant Name_Id := N + 391; + Name_Machine_Emin : constant Name_Id := N + 392; + Name_Machine_Mantissa : constant Name_Id := N + 393; + Name_Machine_Overflows : constant Name_Id := N + 394; + Name_Machine_Radix : constant Name_Id := N + 395; + Name_Machine_Rounds : constant Name_Id := N + 396; + Name_Machine_Size : constant Name_Id := N + 397; -- GNAT + Name_Mantissa : constant Name_Id := N + 398; -- Ada 83 + Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 399; + Name_Maximum_Alignment : constant Name_Id := N + 400; -- GNAT + Name_Mechanism_Code : constant Name_Id := N + 401; -- GNAT + Name_Mod : constant Name_Id := N + 402; + Name_Model_Emin : constant Name_Id := N + 403; + Name_Model_Epsilon : constant Name_Id := N + 404; + Name_Model_Mantissa : constant Name_Id := N + 405; + Name_Model_Small : constant Name_Id := N + 406; + Name_Modulus : constant Name_Id := N + 407; + Name_Null_Parameter : constant Name_Id := N + 408; -- GNAT + Name_Object_Size : constant Name_Id := N + 409; -- GNAT + Name_Partition_ID : constant Name_Id := N + 410; + Name_Passed_By_Reference : constant Name_Id := N + 411; -- GNAT + Name_Pool_Address : constant Name_Id := N + 412; + Name_Pos : constant Name_Id := N + 413; + Name_Position : constant Name_Id := N + 414; + Name_Range : constant Name_Id := N + 415; + Name_Range_Length : constant Name_Id := N + 416; -- GNAT + Name_Round : constant Name_Id := N + 417; + Name_Safe_Emax : constant Name_Id := N + 418; -- Ada 83 + Name_Safe_First : constant Name_Id := N + 419; + Name_Safe_Large : constant Name_Id := N + 420; -- Ada 83 + Name_Safe_Last : constant Name_Id := N + 421; + Name_Safe_Small : constant Name_Id := N + 422; -- Ada 83 + Name_Scale : constant Name_Id := N + 423; + Name_Scaling : constant Name_Id := N + 424; + Name_Signed_Zeros : constant Name_Id := N + 425; + Name_Size : constant Name_Id := N + 426; + Name_Small : constant Name_Id := N + 427; + Name_Storage_Size : constant Name_Id := N + 428; + Name_Storage_Unit : constant Name_Id := N + 429; -- GNAT + Name_Stream_Size : constant Name_Id := N + 430; -- Ada 05 + Name_Tag : constant Name_Id := N + 431; + Name_Target_Name : constant Name_Id := N + 432; -- GNAT + Name_Terminated : constant Name_Id := N + 433; + Name_To_Address : constant Name_Id := N + 434; -- GNAT + Name_Type_Class : constant Name_Id := N + 435; -- GNAT + Name_UET_Address : constant Name_Id := N + 436; -- GNAT + Name_Unbiased_Rounding : constant Name_Id := N + 437; + Name_Unchecked_Access : constant Name_Id := N + 438; + Name_Unconstrained_Array : constant Name_Id := N + 439; + Name_Universal_Literal_String : constant Name_Id := N + 440; -- GNAT + Name_Unrestricted_Access : constant Name_Id := N + 441; -- GNAT + Name_VADS_Size : constant Name_Id := N + 442; -- GNAT + Name_Val : constant Name_Id := N + 443; + Name_Valid : constant Name_Id := N + 444; + Name_Value_Size : constant Name_Id := N + 445; -- GNAT + Name_Version : constant Name_Id := N + 446; + Name_Wchar_T_Size : constant Name_Id := N + 447; -- GNAT + Name_Wide_Wide_Width : constant Name_Id := N + 448; -- Ada 05 + Name_Wide_Width : constant Name_Id := N + 449; + Name_Width : constant Name_Id := N + 450; + Name_Word_Size : constant Name_Id := N + 451; -- GNAT -- Attributes that designate attributes returning renamable functions, -- i.e. functions that return other than a universal value and that -- have non-universal arguments. - First_Renamable_Function_Attribute : constant Name_Id := N + 451; - Name_Adjacent : constant Name_Id := N + 451; - Name_Ceiling : constant Name_Id := N + 452; - Name_Copy_Sign : constant Name_Id := N + 453; - Name_Floor : constant Name_Id := N + 454; - Name_Fraction : constant Name_Id := N + 455; - Name_Image : constant Name_Id := N + 456; - Name_Input : constant Name_Id := N + 457; - Name_Machine : constant Name_Id := N + 458; - Name_Max : constant Name_Id := N + 459; - Name_Min : constant Name_Id := N + 460; - Name_Model : constant Name_Id := N + 461; - Name_Pred : constant Name_Id := N + 462; - Name_Remainder : constant Name_Id := N + 463; - Name_Rounding : constant Name_Id := N + 464; - Name_Succ : constant Name_Id := N + 465; - Name_Truncation : constant Name_Id := N + 466; - Name_Value : constant Name_Id := N + 467; - Name_Wide_Image : constant Name_Id := N + 468; - Name_Wide_Wide_Image : constant Name_Id := N + 469; - Name_Wide_Value : constant Name_Id := N + 470; - Name_Wide_Wide_Value : constant Name_Id := N + 471; - Last_Renamable_Function_Attribute : constant Name_Id := N + 471; + First_Renamable_Function_Attribute : constant Name_Id := N + 452; + Name_Adjacent : constant Name_Id := N + 452; + Name_Ceiling : constant Name_Id := N + 453; + Name_Copy_Sign : constant Name_Id := N + 454; + Name_Floor : constant Name_Id := N + 455; + Name_Fraction : constant Name_Id := N + 456; + Name_Image : constant Name_Id := N + 457; + Name_Input : constant Name_Id := N + 458; + Name_Machine : constant Name_Id := N + 459; + Name_Max : constant Name_Id := N + 460; + Name_Min : constant Name_Id := N + 461; + Name_Model : constant Name_Id := N + 462; + Name_Pred : constant Name_Id := N + 463; + Name_Remainder : constant Name_Id := N + 464; + Name_Rounding : constant Name_Id := N + 465; + Name_Succ : constant Name_Id := N + 466; + Name_Truncation : constant Name_Id := N + 467; + Name_Value : constant Name_Id := N + 468; + Name_Wide_Image : constant Name_Id := N + 469; + Name_Wide_Wide_Image : constant Name_Id := N + 470; + Name_Wide_Value : constant Name_Id := N + 471; + Name_Wide_Wide_Value : constant Name_Id := N + 472; + Last_Renamable_Function_Attribute : constant Name_Id := N + 472; -- Attributes that designate procedures - First_Procedure_Attribute : constant Name_Id := N + 472; - Name_Output : constant Name_Id := N + 472; - Name_Read : constant Name_Id := N + 473; - Name_Write : constant Name_Id := N + 474; - Last_Procedure_Attribute : constant Name_Id := N + 474; + First_Procedure_Attribute : constant Name_Id := N + 473; + Name_Output : constant Name_Id := N + 473; + Name_Read : constant Name_Id := N + 474; + Name_Write : constant Name_Id := N + 475; + Last_Procedure_Attribute : constant Name_Id := N + 475; -- Remaining attributes are ones that return entities - First_Entity_Attribute_Name : constant Name_Id := N + 475; - Name_Elab_Body : constant Name_Id := N + 475; -- GNAT - Name_Elab_Spec : constant Name_Id := N + 476; -- GNAT - Name_Storage_Pool : constant Name_Id := N + 477; + First_Entity_Attribute_Name : constant Name_Id := N + 476; + Name_Elab_Body : constant Name_Id := N + 476; -- GNAT + Name_Elab_Spec : constant Name_Id := N + 477; -- GNAT + Name_Storage_Pool : constant Name_Id := N + 478; -- These attributes are the ones that return types - First_Type_Attribute_Name : constant Name_Id := N + 478; - Name_Base : constant Name_Id := N + 478; - Name_Class : constant Name_Id := N + 479; - Last_Type_Attribute_Name : constant Name_Id := N + 479; - Last_Entity_Attribute_Name : constant Name_Id := N + 479; - Last_Attribute_Name : constant Name_Id := N + 479; + First_Type_Attribute_Name : constant Name_Id := N + 479; + Name_Base : constant Name_Id := N + 479; + Name_Class : constant Name_Id := N + 480; + Last_Type_Attribute_Name : constant Name_Id := N + 480; + Last_Entity_Attribute_Name : constant Name_Id := N + 480; + Last_Attribute_Name : constant Name_Id := N + 480; -- Names of recognized locking policy identifiers @@ -781,10 +782,10 @@ package Snames is -- name (e.g. C for Ceiling_Locking). If new policy names are added, -- the first character must be distinct. - First_Locking_Policy_Name : constant Name_Id := N + 480; - Name_Ceiling_Locking : constant Name_Id := N + 480; - Name_Inheritance_Locking : constant Name_Id := N + 481; - Last_Locking_Policy_Name : constant Name_Id := N + 481; + First_Locking_Policy_Name : constant Name_Id := N + 481; + Name_Ceiling_Locking : constant Name_Id := N + 481; + Name_Inheritance_Locking : constant Name_Id := N + 482; + Last_Locking_Policy_Name : constant Name_Id := N + 482; -- Names of recognized queuing policy identifiers. @@ -792,10 +793,10 @@ package Snames is -- name (e.g. F for FIFO_Queuing). If new policy names are added, -- the first character must be distinct. - First_Queuing_Policy_Name : constant Name_Id := N + 482; - Name_FIFO_Queuing : constant Name_Id := N + 482; - Name_Priority_Queuing : constant Name_Id := N + 483; - Last_Queuing_Policy_Name : constant Name_Id := N + 483; + First_Queuing_Policy_Name : constant Name_Id := N + 483; + Name_FIFO_Queuing : constant Name_Id := N + 483; + Name_Priority_Queuing : constant Name_Id := N + 484; + Last_Queuing_Policy_Name : constant Name_Id := N + 484; -- Names of recognized task dispatching policy identifiers @@ -803,215 +804,215 @@ package Snames is -- name (e.g. F for FIFO_WIthinn_Priorities). If new policy names -- are added, the first character must be distinct. - First_Task_Dispatching_Policy_Name : constant Name_Id := N + 484; - Name_FIFO_Within_Priorities : constant Name_Id := N + 484; - Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 484; + First_Task_Dispatching_Policy_Name : constant Name_Id := N + 485; + Name_FIFO_Within_Priorities : constant Name_Id := N + 485; + Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 485; -- Names of recognized checks for pragma Suppress - First_Check_Name : constant Name_Id := N + 485; - Name_Access_Check : constant Name_Id := N + 485; - Name_Accessibility_Check : constant Name_Id := N + 486; - Name_Discriminant_Check : constant Name_Id := N + 487; - Name_Division_Check : constant Name_Id := N + 488; - Name_Elaboration_Check : constant Name_Id := N + 489; - Name_Index_Check : constant Name_Id := N + 490; - Name_Length_Check : constant Name_Id := N + 491; - Name_Overflow_Check : constant Name_Id := N + 492; - Name_Range_Check : constant Name_Id := N + 493; - Name_Storage_Check : constant Name_Id := N + 494; - Name_Tag_Check : constant Name_Id := N + 495; - Name_All_Checks : constant Name_Id := N + 496; - Last_Check_Name : constant Name_Id := N + 496; + First_Check_Name : constant Name_Id := N + 486; + Name_Access_Check : constant Name_Id := N + 486; + Name_Accessibility_Check : constant Name_Id := N + 487; + Name_Discriminant_Check : constant Name_Id := N + 488; + Name_Division_Check : constant Name_Id := N + 489; + Name_Elaboration_Check : constant Name_Id := N + 490; + Name_Index_Check : constant Name_Id := N + 491; + Name_Length_Check : constant Name_Id := N + 492; + Name_Overflow_Check : constant Name_Id := N + 493; + Name_Range_Check : constant Name_Id := N + 494; + Name_Storage_Check : constant Name_Id := N + 495; + Name_Tag_Check : constant Name_Id := N + 496; + Name_All_Checks : constant Name_Id := N + 497; + Last_Check_Name : constant Name_Id := N + 497; -- Names corresponding to reserved keywords, excluding those already -- declared in the attribute list (Access, Delta, Digits, Mod, Range). - Name_Abort : constant Name_Id := N + 497; - Name_Abs : constant Name_Id := N + 498; - Name_Accept : constant Name_Id := N + 499; - Name_And : constant Name_Id := N + 500; - Name_All : constant Name_Id := N + 501; - Name_Array : constant Name_Id := N + 502; - Name_At : constant Name_Id := N + 503; - Name_Begin : constant Name_Id := N + 504; - Name_Body : constant Name_Id := N + 505; - Name_Case : constant Name_Id := N + 506; - Name_Constant : constant Name_Id := N + 507; - Name_Declare : constant Name_Id := N + 508; - Name_Delay : constant Name_Id := N + 509; - Name_Do : constant Name_Id := N + 510; - Name_Else : constant Name_Id := N + 511; - Name_Elsif : constant Name_Id := N + 512; - Name_End : constant Name_Id := N + 513; - Name_Entry : constant Name_Id := N + 514; - Name_Exception : constant Name_Id := N + 515; - Name_Exit : constant Name_Id := N + 516; - Name_For : constant Name_Id := N + 517; - Name_Function : constant Name_Id := N + 518; - Name_Generic : constant Name_Id := N + 519; - Name_Goto : constant Name_Id := N + 520; - Name_If : constant Name_Id := N + 521; - Name_In : constant Name_Id := N + 522; - Name_Is : constant Name_Id := N + 523; - Name_Limited : constant Name_Id := N + 524; - Name_Loop : constant Name_Id := N + 525; - Name_New : constant Name_Id := N + 526; - Name_Not : constant Name_Id := N + 527; - Name_Null : constant Name_Id := N + 528; - Name_Of : constant Name_Id := N + 529; - Name_Or : constant Name_Id := N + 530; - Name_Others : constant Name_Id := N + 531; - Name_Out : constant Name_Id := N + 532; - Name_Package : constant Name_Id := N + 533; - Name_Pragma : constant Name_Id := N + 534; - Name_Private : constant Name_Id := N + 535; - Name_Procedure : constant Name_Id := N + 536; - Name_Raise : constant Name_Id := N + 537; - Name_Record : constant Name_Id := N + 538; - Name_Rem : constant Name_Id := N + 539; - Name_Renames : constant Name_Id := N + 540; - Name_Return : constant Name_Id := N + 541; - Name_Reverse : constant Name_Id := N + 542; - Name_Select : constant Name_Id := N + 543; - Name_Separate : constant Name_Id := N + 544; - Name_Subtype : constant Name_Id := N + 545; - Name_Task : constant Name_Id := N + 546; - Name_Terminate : constant Name_Id := N + 547; - Name_Then : constant Name_Id := N + 548; - Name_Type : constant Name_Id := N + 549; - Name_Use : constant Name_Id := N + 550; - Name_When : constant Name_Id := N + 551; - Name_While : constant Name_Id := N + 552; - Name_With : constant Name_Id := N + 553; - Name_Xor : constant Name_Id := N + 554; + Name_Abort : constant Name_Id := N + 498; + Name_Abs : constant Name_Id := N + 499; + Name_Accept : constant Name_Id := N + 500; + Name_And : constant Name_Id := N + 501; + Name_All : constant Name_Id := N + 502; + Name_Array : constant Name_Id := N + 503; + Name_At : constant Name_Id := N + 504; + Name_Begin : constant Name_Id := N + 505; + Name_Body : constant Name_Id := N + 506; + Name_Case : constant Name_Id := N + 507; + Name_Constant : constant Name_Id := N + 508; + Name_Declare : constant Name_Id := N + 509; + Name_Delay : constant Name_Id := N + 510; + Name_Do : constant Name_Id := N + 511; + Name_Else : constant Name_Id := N + 512; + Name_Elsif : constant Name_Id := N + 513; + Name_End : constant Name_Id := N + 514; + Name_Entry : constant Name_Id := N + 515; + Name_Exception : constant Name_Id := N + 516; + Name_Exit : constant Name_Id := N + 517; + Name_For : constant Name_Id := N + 518; + Name_Function : constant Name_Id := N + 519; + Name_Generic : constant Name_Id := N + 520; + Name_Goto : constant Name_Id := N + 521; + Name_If : constant Name_Id := N + 522; + Name_In : constant Name_Id := N + 523; + Name_Is : constant Name_Id := N + 524; + Name_Limited : constant Name_Id := N + 525; + Name_Loop : constant Name_Id := N + 526; + Name_New : constant Name_Id := N + 527; + Name_Not : constant Name_Id := N + 528; + Name_Null : constant Name_Id := N + 529; + Name_Of : constant Name_Id := N + 530; + Name_Or : constant Name_Id := N + 531; + Name_Others : constant Name_Id := N + 532; + Name_Out : constant Name_Id := N + 533; + Name_Package : constant Name_Id := N + 534; + Name_Pragma : constant Name_Id := N + 535; + Name_Private : constant Name_Id := N + 536; + Name_Procedure : constant Name_Id := N + 537; + Name_Raise : constant Name_Id := N + 538; + Name_Record : constant Name_Id := N + 539; + Name_Rem : constant Name_Id := N + 540; + Name_Renames : constant Name_Id := N + 541; + Name_Return : constant Name_Id := N + 542; + Name_Reverse : constant Name_Id := N + 543; + Name_Select : constant Name_Id := N + 544; + Name_Separate : constant Name_Id := N + 545; + Name_Subtype : constant Name_Id := N + 546; + Name_Task : constant Name_Id := N + 547; + Name_Terminate : constant Name_Id := N + 548; + Name_Then : constant Name_Id := N + 549; + Name_Type : constant Name_Id := N + 550; + Name_Use : constant Name_Id := N + 551; + Name_When : constant Name_Id := N + 552; + Name_While : constant Name_Id := N + 553; + Name_With : constant Name_Id := N + 554; + Name_Xor : constant Name_Id := N + 555; -- Names of intrinsic subprograms -- Note: Asm is missing from this list, since Asm is a legitimate -- convention name. So is To_Adress, which is a GNAT attribute. - First_Intrinsic_Name : constant Name_Id := N + 555; - Name_Divide : constant Name_Id := N + 555; - Name_Enclosing_Entity : constant Name_Id := N + 556; - Name_Exception_Information : constant Name_Id := N + 557; - Name_Exception_Message : constant Name_Id := N + 558; - Name_Exception_Name : constant Name_Id := N + 559; - Name_File : constant Name_Id := N + 560; - Name_Generic_Dispatching_Constructor : constant Name_Id := N + 561; - Name_Import_Address : constant Name_Id := N + 562; - Name_Import_Largest_Value : constant Name_Id := N + 563; - Name_Import_Value : constant Name_Id := N + 564; - Name_Is_Negative : constant Name_Id := N + 565; - Name_Line : constant Name_Id := N + 566; - Name_Rotate_Left : constant Name_Id := N + 567; - Name_Rotate_Right : constant Name_Id := N + 568; - Name_Shift_Left : constant Name_Id := N + 569; - Name_Shift_Right : constant Name_Id := N + 570; - Name_Shift_Right_Arithmetic : constant Name_Id := N + 571; - Name_Source_Location : constant Name_Id := N + 572; - Name_Unchecked_Conversion : constant Name_Id := N + 573; - Name_Unchecked_Deallocation : constant Name_Id := N + 574; - Name_To_Pointer : constant Name_Id := N + 575; - Last_Intrinsic_Name : constant Name_Id := N + 575; + First_Intrinsic_Name : constant Name_Id := N + 556; + Name_Divide : constant Name_Id := N + 556; + Name_Enclosing_Entity : constant Name_Id := N + 557; + Name_Exception_Information : constant Name_Id := N + 558; + Name_Exception_Message : constant Name_Id := N + 559; + Name_Exception_Name : constant Name_Id := N + 560; + Name_File : constant Name_Id := N + 561; + Name_Generic_Dispatching_Constructor : constant Name_Id := N + 562; + Name_Import_Address : constant Name_Id := N + 563; + Name_Import_Largest_Value : constant Name_Id := N + 564; + Name_Import_Value : constant Name_Id := N + 565; + Name_Is_Negative : constant Name_Id := N + 566; + Name_Line : constant Name_Id := N + 567; + Name_Rotate_Left : constant Name_Id := N + 568; + Name_Rotate_Right : constant Name_Id := N + 569; + Name_Shift_Left : constant Name_Id := N + 570; + Name_Shift_Right : constant Name_Id := N + 571; + Name_Shift_Right_Arithmetic : constant Name_Id := N + 572; + Name_Source_Location : constant Name_Id := N + 573; + Name_Unchecked_Conversion : constant Name_Id := N + 574; + Name_Unchecked_Deallocation : constant Name_Id := N + 575; + Name_To_Pointer : constant Name_Id := N + 576; + Last_Intrinsic_Name : constant Name_Id := N + 576; -- Reserved words used only in Ada 95 - First_95_Reserved_Word : constant Name_Id := N + 576; - Name_Abstract : constant Name_Id := N + 576; - Name_Aliased : constant Name_Id := N + 577; - Name_Protected : constant Name_Id := N + 578; - Name_Until : constant Name_Id := N + 579; - Name_Requeue : constant Name_Id := N + 580; - Name_Tagged : constant Name_Id := N + 581; - Last_95_Reserved_Word : constant Name_Id := N + 581; + First_95_Reserved_Word : constant Name_Id := N + 577; + Name_Abstract : constant Name_Id := N + 577; + Name_Aliased : constant Name_Id := N + 578; + Name_Protected : constant Name_Id := N + 579; + Name_Until : constant Name_Id := N + 580; + Name_Requeue : constant Name_Id := N + 581; + Name_Tagged : constant Name_Id := N + 582; + Last_95_Reserved_Word : constant Name_Id := N + 582; subtype Ada_95_Reserved_Words is Name_Id range First_95_Reserved_Word .. Last_95_Reserved_Word; -- Miscellaneous names used in semantic checking - Name_Raise_Exception : constant Name_Id := N + 582; + Name_Raise_Exception : constant Name_Id := N + 583; -- Additional reserved words and identifiers used in GNAT Project Files -- Note that Name_External is already previously declared - Name_Ada_Roots : constant Name_Id := N + 583; - Name_Binder : constant Name_Id := N + 584; - Name_Binder_Driver : constant Name_Id := N + 585; - Name_Body_Suffix : constant Name_Id := N + 586; - Name_Builder : constant Name_Id := N + 587; - Name_Compiler : constant Name_Id := N + 588; - Name_Compiler_Driver : constant Name_Id := N + 589; - Name_Compiler_Kind : constant Name_Id := N + 590; - Name_Compute_Dependency : constant Name_Id := N + 591; - Name_Cross_Reference : constant Name_Id := N + 592; - Name_Default_Linker : constant Name_Id := N + 593; - Name_Default_Switches : constant Name_Id := N + 594; - Name_Dependency_Option : constant Name_Id := N + 595; - Name_Exec_Dir : constant Name_Id := N + 596; - Name_Executable : constant Name_Id := N + 597; - Name_Executable_Suffix : constant Name_Id := N + 598; - Name_Extends : constant Name_Id := N + 599; - Name_Externally_Built : constant Name_Id := N + 600; - Name_Finder : constant Name_Id := N + 601; - Name_Global_Configuration_Pragmas : constant Name_Id := N + 602; - Name_Gnatls : constant Name_Id := N + 603; - Name_Gnatstub : constant Name_Id := N + 604; - Name_Implementation : constant Name_Id := N + 605; - Name_Implementation_Exceptions : constant Name_Id := N + 606; - Name_Implementation_Suffix : constant Name_Id := N + 607; - Name_Include_Option : constant Name_Id := N + 608; - Name_Language_Processing : constant Name_Id := N + 609; - Name_Languages : constant Name_Id := N + 610; - Name_Library_Dir : constant Name_Id := N + 611; - Name_Library_Auto_Init : constant Name_Id := N + 612; - Name_Library_GCC : constant Name_Id := N + 613; - Name_Library_Interface : constant Name_Id := N + 614; - Name_Library_Kind : constant Name_Id := N + 615; - Name_Library_Name : constant Name_Id := N + 616; - Name_Library_Options : constant Name_Id := N + 617; - Name_Library_Reference_Symbol_File : constant Name_Id := N + 618; - Name_Library_Src_Dir : constant Name_Id := N + 619; - Name_Library_Symbol_File : constant Name_Id := N + 620; - Name_Library_Symbol_Policy : constant Name_Id := N + 621; - Name_Library_Version : constant Name_Id := N + 622; - Name_Linker : constant Name_Id := N + 623; - Name_Local_Configuration_Pragmas : constant Name_Id := N + 624; - Name_Locally_Removed_Files : constant Name_Id := N + 625; - Name_Metrics : constant Name_Id := N + 626; - Name_Naming : constant Name_Id := N + 627; - Name_Object_Dir : constant Name_Id := N + 628; - Name_Pretty_Printer : constant Name_Id := N + 629; - Name_Project : constant Name_Id := N + 630; - Name_Separate_Suffix : constant Name_Id := N + 631; - Name_Source_Dirs : constant Name_Id := N + 632; - Name_Source_Files : constant Name_Id := N + 633; - Name_Source_List_File : constant Name_Id := N + 634; - Name_Spec : constant Name_Id := N + 635; - Name_Spec_Suffix : constant Name_Id := N + 636; - Name_Specification : constant Name_Id := N + 637; - Name_Specification_Exceptions : constant Name_Id := N + 638; - Name_Specification_Suffix : constant Name_Id := N + 639; - Name_Switches : constant Name_Id := N + 640; + Name_Ada_Roots : constant Name_Id := N + 584; + Name_Binder : constant Name_Id := N + 585; + Name_Binder_Driver : constant Name_Id := N + 586; + Name_Body_Suffix : constant Name_Id := N + 587; + Name_Builder : constant Name_Id := N + 588; + Name_Compiler : constant Name_Id := N + 589; + Name_Compiler_Driver : constant Name_Id := N + 590; + Name_Compiler_Kind : constant Name_Id := N + 591; + Name_Compute_Dependency : constant Name_Id := N + 592; + Name_Cross_Reference : constant Name_Id := N + 593; + Name_Default_Linker : constant Name_Id := N + 594; + Name_Default_Switches : constant Name_Id := N + 595; + Name_Dependency_Option : constant Name_Id := N + 596; + Name_Exec_Dir : constant Name_Id := N + 597; + Name_Executable : constant Name_Id := N + 598; + Name_Executable_Suffix : constant Name_Id := N + 599; + Name_Extends : constant Name_Id := N + 600; + Name_Externally_Built : constant Name_Id := N + 601; + Name_Finder : constant Name_Id := N + 602; + Name_Global_Configuration_Pragmas : constant Name_Id := N + 603; + Name_Gnatls : constant Name_Id := N + 604; + Name_Gnatstub : constant Name_Id := N + 605; + Name_Implementation : constant Name_Id := N + 606; + Name_Implementation_Exceptions : constant Name_Id := N + 607; + Name_Implementation_Suffix : constant Name_Id := N + 608; + Name_Include_Option : constant Name_Id := N + 609; + Name_Language_Processing : constant Name_Id := N + 610; + Name_Languages : constant Name_Id := N + 611; + Name_Library_Dir : constant Name_Id := N + 612; + Name_Library_Auto_Init : constant Name_Id := N + 613; + Name_Library_GCC : constant Name_Id := N + 614; + Name_Library_Interface : constant Name_Id := N + 615; + Name_Library_Kind : constant Name_Id := N + 616; + Name_Library_Name : constant Name_Id := N + 617; + Name_Library_Options : constant Name_Id := N + 618; + Name_Library_Reference_Symbol_File : constant Name_Id := N + 619; + Name_Library_Src_Dir : constant Name_Id := N + 620; + Name_Library_Symbol_File : constant Name_Id := N + 621; + Name_Library_Symbol_Policy : constant Name_Id := N + 622; + Name_Library_Version : constant Name_Id := N + 623; + Name_Linker : constant Name_Id := N + 624; + Name_Local_Configuration_Pragmas : constant Name_Id := N + 625; + Name_Locally_Removed_Files : constant Name_Id := N + 626; + Name_Metrics : constant Name_Id := N + 627; + Name_Naming : constant Name_Id := N + 628; + Name_Object_Dir : constant Name_Id := N + 629; + Name_Pretty_Printer : constant Name_Id := N + 630; + Name_Project : constant Name_Id := N + 631; + Name_Separate_Suffix : constant Name_Id := N + 632; + Name_Source_Dirs : constant Name_Id := N + 633; + Name_Source_Files : constant Name_Id := N + 634; + Name_Source_List_File : constant Name_Id := N + 635; + Name_Spec : constant Name_Id := N + 636; + Name_Spec_Suffix : constant Name_Id := N + 637; + Name_Specification : constant Name_Id := N + 638; + Name_Specification_Exceptions : constant Name_Id := N + 639; + Name_Specification_Suffix : constant Name_Id := N + 640; + Name_Switches : constant Name_Id := N + 641; -- Other miscellaneous names used in front end - Name_Unaligned_Valid : constant Name_Id := N + 641; + Name_Unaligned_Valid : constant Name_Id := N + 642; -- ---------------------------------------------------------------- - First_2005_Reserved_Word : constant Name_Id := N + 642; - Name_Interface : constant Name_Id := N + 642; - Name_Overriding : constant Name_Id := N + 643; - Name_Synchronized : constant Name_Id := N + 644; - Last_2005_Reserved_Word : constant Name_Id := N + 644; + First_2005_Reserved_Word : constant Name_Id := N + 643; + Name_Interface : constant Name_Id := N + 643; + Name_Overriding : constant Name_Id := N + 644; + Name_Synchronized : constant Name_Id := N + 645; + Last_2005_Reserved_Word : constant Name_Id := N + 645; subtype Ada_2005_Reserved_Words is Name_Id range First_2005_Reserved_Word .. Last_2005_Reserved_Word; -- Mark last defined name for consistency check in Snames body - Last_Predefined_Name : constant Name_Id := N + 644; + Last_Predefined_Name : constant Name_Id := N + 645; subtype Any_Operator_Name is Name_Id range First_Operator_Name .. Last_Operator_Name; @@ -1319,6 +1320,8 @@ package Snames is Pragma_Keep_Names, Pragma_Link_With, Pragma_Linker_Alias, + Pragma_Linker_Constructor, + Pragma_Linker_Destructor, Pragma_Linker_Options, Pragma_Linker_Section, Pragma_List, diff --git a/gcc/ada/snames.h b/gcc/ada/snames.h index 093dbd6..7dd1f39 100644 --- a/gcc/ada/snames.h +++ b/gcc/ada/snames.h @@ -307,55 +307,57 @@ extern unsigned char Get_Pragma_Id (int); #define Pragma_Keep_Names 93 #define Pragma_Link_With 94 #define Pragma_Linker_Alias 95 -#define Pragma_Linker_Options 96 -#define Pragma_Linker_Section 97 -#define Pragma_List 98 -#define Pragma_Machine_Attribute 99 -#define Pragma_Main 100 -#define Pragma_Main_Storage 101 -#define Pragma_Memory_Size 102 -#define Pragma_No_Return 103 -#define Pragma_Obsolescent 104 -#define Pragma_Optimize 105 -#define Pragma_Optional_Overriding 106 -#define Pragma_Pack 107 -#define Pragma_Page 108 -#define Pragma_Passive 109 -#define Pragma_Preelaborate 110 -#define Pragma_Preelaborate_05 111 -#define Pragma_Priority 112 -#define Pragma_Psect_Object 113 -#define Pragma_Pure 114 -#define Pragma_Pure_05 115 -#define Pragma_Pure_Function 116 -#define Pragma_Remote_Call_Interface 117 -#define Pragma_Remote_Types 118 -#define Pragma_Share_Generic 119 -#define Pragma_Shared 120 -#define Pragma_Shared_Passive 121 -#define Pragma_Source_Reference 122 -#define Pragma_Stream_Convert 123 -#define Pragma_Subtitle 124 -#define Pragma_Suppress_All 125 -#define Pragma_Suppress_Debug_Info 126 -#define Pragma_Suppress_Initialization 127 -#define Pragma_System_Name 128 -#define Pragma_Task_Info 129 -#define Pragma_Task_Name 130 -#define Pragma_Task_Storage 131 -#define Pragma_Thread_Body 132 -#define Pragma_Time_Slice 133 -#define Pragma_Title 134 -#define Pragma_Unchecked_Union 135 -#define Pragma_Unimplemented_Unit 136 -#define Pragma_Unreferenced 137 -#define Pragma_Unreserve_All_Interrupts 138 -#define Pragma_Volatile 139 -#define Pragma_Volatile_Components 140 -#define Pragma_Weak_External 141 -#define Pragma_AST_Entry 142 -#define Pragma_Interface 143 -#define Pragma_Storage_Size 144 -#define Pragma_Storage_Unit 145 +#define Pragma_Linker_Constructor 96 +#define Pragma_Linker_Destructor 97 +#define Pragma_Linker_Options 98 +#define Pragma_Linker_Section 99 +#define Pragma_List 100 +#define Pragma_Machine_Attribute 101 +#define Pragma_Main 102 +#define Pragma_Main_Storage 103 +#define Pragma_Memory_Size 104 +#define Pragma_No_Return 105 +#define Pragma_Obsolescent 106 +#define Pragma_Optimize 107 +#define Pragma_Optional_Overriding 108 +#define Pragma_Pack 109 +#define Pragma_Page 110 +#define Pragma_Passive 111 +#define Pragma_Preelaborate 112 +#define Pragma_Preelaborate_05 113 +#define Pragma_Priority 114 +#define Pragma_Psect_Object 115 +#define Pragma_Pure 116 +#define Pragma_Pure_05 117 +#define Pragma_Pure_Function 118 +#define Pragma_Remote_Call_Interface 119 +#define Pragma_Remote_Types 120 +#define Pragma_Share_Generic 121 +#define Pragma_Shared 122 +#define Pragma_Shared_Passive 123 +#define Pragma_Source_Reference 124 +#define Pragma_Stream_Convert 125 +#define Pragma_Subtitle 126 +#define Pragma_Suppress_All 127 +#define Pragma_Suppress_Debug_Info 128 +#define Pragma_Suppress_Initialization 129 +#define Pragma_System_Name 130 +#define Pragma_Task_Info 131 +#define Pragma_Task_Name 132 +#define Pragma_Task_Storage 133 +#define Pragma_Thread_Body 134 +#define Pragma_Time_Slice 135 +#define Pragma_Title 136 +#define Pragma_Unchecked_Union 137 +#define Pragma_Unimplemented_Unit 138 +#define Pragma_Unreferenced 139 +#define Pragma_Unreserve_All_Interrupts 140 +#define Pragma_Volatile 141 +#define Pragma_Volatile_Components 142 +#define Pragma_Weak_External 143 +#define Pragma_AST_Entry 144 +#define Pragma_Interface 145 +#define Pragma_Storage_Size 146 +#define Pragma_Storage_Unit 147 /* End of snames.h (C version of Snames package spec) */ diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index cdb5506..3a3327a 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -35,6 +35,7 @@ #include "rtl.h" #include "expr.h" #include "ggc.h" +#include "cgraph.h" #include "function.h" #include "except.h" #include "debug.h" @@ -164,6 +165,7 @@ static tree pos_to_constructor (Node_Id, tree, Entity_Id); static tree maybe_implicit_deref (tree); static tree gnat_stabilize_reference_1 (tree, bool); static void annotate_with_node (tree, Node_Id); +static void build_global_cdtor (int, tree *); /* This is the main program of the back-end. It sets up all the table @@ -410,7 +412,11 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) && (! DECL_RENAMING_GLOBAL_P (gnu_result) || global_bindings_p ()) /* Make sure it's an lvalue like INDIRECT_REF. */ - && (DECL_P (renamed_obj) || REFERENCE_CLASS_P (renamed_obj))) + && (DECL_P (renamed_obj) + || REFERENCE_CLASS_P (renamed_obj) + || (TREE_CODE (renamed_obj) == VIEW_CONVERT_EXPR + && (DECL_P (TREE_OPERAND (renamed_obj, 0)) + || REFERENCE_CLASS_P (TREE_OPERAND (renamed_obj,0)))))) gnu_result = renamed_obj; else gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, @@ -2405,7 +2411,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) Sloc_to_locus (Sloc (gnat_unit_entity), &cfun->function_end_locus); cfun = 0; - /* For a body, first process the spec if there is one. */ + /* 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))) @@ -2445,6 +2451,15 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) /* Generate elaboration code for this unit, if necessary, and say whether we did or not. */ pop_stack (&gnu_elab_proc_stack); + + /* Generate functions to call static constructors and destructors + for targets that do not support .ctors/.dtors sections. These + functions have magic names which are detected by collect2. */ + if (static_ctors) + build_global_cdtor ('I', &static_ctors); + + if (static_dtors) + build_global_cdtor ('D', &static_dtors); } /* This function is the driver of the GNAT to GCC tree transformation @@ -5353,8 +5368,8 @@ addressable_p (tree gnu_expr) case COMPONENT_REF: return (!DECL_BIT_FIELD (TREE_OPERAND (gnu_expr, 1)) - && (!DECL_NONADDRESSABLE_P (TREE_OPERAND (gnu_expr, 1)) - || !flag_strict_aliasing) + && !(STRICT_ALIGNMENT + && DECL_NONADDRESSABLE_P (TREE_OPERAND (gnu_expr, 1))) && addressable_p (TREE_OPERAND (gnu_expr, 0))); case ARRAY_REF: case ARRAY_RANGE_REF: @@ -5859,6 +5874,28 @@ gnat_stabilize_reference_1 (tree e, bool force) TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (e); return result; } + +/* Build a global constructor or destructor function. METHOD_TYPE gives + the type of the function and CDTORS points to the list of constructor + or destructor functions to be invoked. FIXME: Migrate into cgraph. */ + +static void +build_global_cdtor (int method_type, tree *cdtors) +{ + tree body = 0; + + for (; *cdtors; *cdtors = TREE_CHAIN (*cdtors)) + { + tree fn = TREE_VALUE (*cdtors); + tree fntype = TREE_TYPE (fn); + tree fnaddr = build1 (ADDR_EXPR, build_pointer_type (fntype), fn); + tree fncall = build3 (CALL_EXPR, TREE_TYPE (fntype), fnaddr, NULL_TREE, + NULL_TREE); + append_to_statement_list (fncall, &body); + } + + cgraph_build_static_cdtor (method_type, body, DEFAULT_INIT_PRIORITY); +} extern char *__gnat_to_canonical_file_spec (char *); diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 4c2a7c9..b19cb45 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -74,6 +74,11 @@ tree gnat_std_decls[(int) ADT_LAST]; /* Functions to call for each of the possible raise reasons. */ tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; +/* List of functions called automatically at the beginning and + end of execution, on targets without .ctors/.dtors sections. */ +tree static_ctors; +tree static_dtors; + /* Associates a GNAT tree node to a GCC tree node. It is used in `save_gnu_tree', `get_gnu_tree' and `present_gnu_tree'. See documentation of `save_gnu_tree' for more info. */ @@ -1509,8 +1514,11 @@ process_attributes (tree decl, struct attrib *attr_list) break; case ATTR_LINK_ALIAS: - TREE_STATIC (decl) = 1; - assemble_alias (decl, attr_list->name); + if (! DECL_EXTERNAL (decl)) + { + TREE_STATIC (decl) = 1; + assemble_alias (decl, attr_list->name); + } break; case ATTR_WEAK_EXTERNAL: @@ -1533,6 +1541,16 @@ process_attributes (tree decl, struct attrib *attr_list) post_error ("?section attributes are not supported for this target", attr_list->error_point); break; + + case ATTR_LINK_CONSTRUCTOR: + DECL_STATIC_CONSTRUCTOR (decl) = 1; + TREE_USED (decl) = 1; + break; + + case ATTR_LINK_DESTRUCTOR: + DECL_STATIC_DESTRUCTOR (decl) = 1; + TREE_USED (decl) = 1; + break; } } @@ -1728,6 +1746,14 @@ end_subprog_body (tree body) if (type_annotate_only) return; + /* If we don't have .ctors/.dtors sections, and this is a static + constructor or destructor, it must be recorded now. */ + if (DECL_STATIC_CONSTRUCTOR (fndecl) && !targetm.have_ctors_dtors) + static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors); + + if (DECL_STATIC_DESTRUCTOR (fndecl) && !targetm.have_ctors_dtors) + static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors); + /* We do different things for nested and non-nested functions. ??? This should be in cgraph. */ if (!DECL_CONTEXT (fndecl)) |