aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_prag.adb
AgeCommit message (Collapse)AuthorFilesLines
2019-01-08[Ada] Bump copyright years to 2019Pierre-Marie de Rodat1-1/+1
From-SVN: r267683
2018-12-11[Ada] Suppress call to Initial_Condition when the annotation is ignoredHristian Kirtchev1-1/+7
This patch suppresses the generation of the Initial_Condition procedure tasked with verifying the run-time semantics of the pragma when the pragma is ignored by means of -gnata, pragma Assertion_Policy, etc. ------------ -- Source -- ------------ -- all_asserts_off.adc pragma Assertion_Policy (Ignore); -- all_asserts_on.adc pragma Assertion_Policy (Check); -- ic_off.adc pragma Assertion_Policy (Initial_Condition => Ignore); -- ic_on.adc pragma Assertion_Policy (Initial_Condition => Check); -- init_cond.ads package Init_Cond with SPARK_Mode, Initial_Condition => Flag = False is Flag : Boolean := True; procedure Set_Flag; end Init_Cond; -- init_cond.adb package body Init_Cond with SPARK_Mode is procedure Set_Flag is begin Flag := True; end Set_Flag; end Init_Cond; ---------------------------- -- Compilation and output -- ---------------------------- & gcc -c -S -gnatDG init_cond.adb -gnatec=all_asserts_on.adc & grep -c "Initial_Condition;" init_cond.adb.dg & grep -c "_elabb" init_cond.s & gcc -c -S -gnatDG init_cond.adb -gnatec=ic_on.adc & grep -c "Initial_Condition;" init_cond.adb.dg & grep -c "_elabb" init_cond.s & gcc -c -S -gnatDG init_cond.adb -gnatec=all_asserts_off.adc & grep -c "Initial_Condition;" init_cond.adb.dg & grep -c "_elabb" init_cond.s & gcc -c -S -gnatDG init_cond.adb -gnatec=ic_off.adc & grep -c "Initial_Condition;" init_cond.adb.dg & grep -c "_elabb" init_cond.s 2 4 2 4 0 0 0 0 2018-12-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_prag.adb (Expand_Pragma_Initial_Condition): Do not generate an Initial_Condition procedure and a call to it when the associated pragma is ignored. * sem_ch10.adb (Analyze_Compilation_Unit): Minor cleanup. From-SVN: r266977
2018-11-14[Ada] Lingering loop for ignored Ghost assignmentHristian Kirtchev1-2/+2
The following patch ensures that loops generated for aggregates as part of ignored Ghost assignments are correctly eliminated from the generated code. ------------ -- Source -- ------------ -- pack.ads package Pack is type addr4k is new Integer range 0 .. 100 with Size => 32; type Four_KB_Page_Property is record Is_Scrubbed : Boolean := False; end record with Ghost; type Four_KB_Page_Array is array (addr4k range <>) of Four_KB_Page_Property with Ghost; type Base_Memory is tagged record Four_KB_Pages : Four_KB_Page_Array (addr4k) := (others => (Is_Scrubbed => False)); end record with Ghost; subtype Memory is Base_Memory with Ghost; Global_Memory : Memory with Ghost; procedure Assign; end Pack; -- pack.adb package body Pack is procedure Assign is begin Global_Memory.Four_KB_Pages := (others => (Is_Scrubbed => True)); end Assign; end Pack; ---------------------------- -- Compilation and output -- ---------------------------- $ gcc -c -gnatDG pack.adb $ grep -c "loop" pack.adb.dg 0 2018-11-14 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_Concatenate): Use the proper routine to set the need for debug info. * exp_dbug.adb (Build_Subprogram_Instance_Renamings): Use the proper routine to set the need for debug info. * exp_prag.adb (Expand_Pragma_Initial_Condition): Use the proper routine to set the need for debug info. * exp_util.adb (Build_DIC_Procedure_Declaration): Use the proper routine to set the need for debug info. (Build_Invariant_Procedure_Declaration): Use the proper routine to set the need for debug info. * ghost.adb (Record_Ignored_Ghost_Node): Add statements as a whole class to the list of top level ignored Ghost nodes. * sem_util.adb (Set_Debug_Info_Needed): Do not generate debug info for an ignored Ghost entity. From-SVN: r266111
2018-06-11[Ada] Suppress the expansion of ignored assertion pragmasHristian Kirtchev1-4/+18
This patch suppresses the expansion of ignored assertion pragmas. 2018-06-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * contracts.adb (Process_Body_Postconditions): Expand only checked postconditions. (Process_Contract_Cases_For): Expand only checked contract cases. (Process_Inherited_Preconditions): Ignored class-wide preconditions are partially expanded because some of their semantic checks are tied to the expansion. (Process_Preconditions_For): Expand only checked preconditions. (Process_Spec_Postconditions): Expand only checked preconditions. Ignored class-wide preconditions are partially expanded because some of their semantic checks are tied to the expansion. * exp_prag.adb (Expand_N_Pragma): Suppress the expansion of ignored assertion pragmas. * exp_util.adb (Add_Inherited_Invariants): Code clean up. * sem_util.adb (Propagate_Invariant_Attributes): Code clean up. gcc/testsuite/ * gnat.dg/assertion_policy1.adb, gnat.dg/assertion_policy1_pkg.adb, gnat.dg/assertion_policy1_pkg.ads: New testcase. From-SVN: r261430
2018-01-11[Ada] Bump copyright notices to 2018Arnaud Charlet1-1/+1
2018-01-11 Arnaud Charlet <charlet@adacore.com> gcc/ada/ Bump copyright notices to 2018. From-SVN: r256519
2017-11-09[multiple changes]Pierre-Marie de Rodat1-1/+1
2017-11-09 Javier Miranda <miranda@adacore.com> * rtsfind.ads (RE_Id, RE_Unit_Table): Add RE_HT_Link. * exp_disp.adb (Make_DT): Initialize the HT_Link field of the TSD only if available. 2017-11-09 Bob Duff <duff@adacore.com> * exp_ch4.adb, exp_ch9.adb, exp_prag.adb, par-ch3.adb, sem_aggr.adb, sem_ch12.adb, sem_ch13.adb, sem_ch4.adb, sem_disp.adb, sem_prag.adb, sem_res.adb, sem_util.adb: Get rid of warnings about uninitialized variables. From-SVN: r254577
2017-10-09[multiple changes]Pierre-Marie de Rodat1-47/+253
2017-10-09 Bob Duff <duff@adacore.com> * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): Use Defining_Identifier (Obj_Decl) in two places, because it might have changed. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Deal with cases involving 'Input on (not visibly) derived types. 2017-10-09 Hristian Kirtchev <kirtchev@adacore.com> * atree.adb: Add new soft link Rewriting_Proc. (Rewrite): Invoke the subprogram attached to the rewriting soft link. (Set_Rewriting_Proc): New routine. * attree.ads: Add new access-to-subprogram type Rewrite_Proc. (Set_Rewriting_Proc): New routine. * checks.adb (Install_Primitive_Elaboration_Check): Use 'E' character for *E*laboration flag to maintain consistency with other elaboration flag generating subprograms. * debug.adb: Document the new usage of flag -gnatdL. * einfo.adb: Node19 is now used as Receiving_Entry. Node39 is now used as Protected_Subprogram. Flag148 is now used as Is_Elaboration_Checks_OK_Id. Flag302 is now used as Is_Initial_Condition_Procedure. (Is_Elaboration_Checks_OK_Id): New routine. (Is_Initial_Condition_Procedure): New routine. (Protected_Subprogram): New routine. (Receiving_Entry): New routine. (SPARK_Pragma): Update assertion. (SPARK_Pragma_Inherited): Update assertion. (Suppress_Elaboration_Warnings): Removed. (Set_Is_Elaboration_Checks_OK_Id): New routine. (Set_Is_Initial_Condition_Procedure): New routine. (Set_Protected_Subprogram): New routine. (Set_Receiving_Entry): New routine. (Set_SPARK_Pragma): Update assertion. (Set_SPARK_Pragma_Inherited): Update assertion. (Write_Entity_Flags): Update the output for Flag148 and Flag302. (Write_Field19_Name): Add output for Receiving_Entry. (Write_Field39_Name): Add output for Protected_Subprogram. (Write_Field40_Name): Update the output for SPARK_Pragma. * einfo.ads: New attributes Is_Elaboration_Checks_OK_Id, Is_Initial_Condition_Procedure, Protected_Subprogram, Receiving_Entry. Remove attribute Suppress_Elaboration_Warnings. Update the stricture of various entities. (Is_Elaboration_Checks_OK_Id): New routine along with pragma Inline. (Is_Initial_Condition_Procedure): New routine along with pragma Inline. (Protected_Subprogram): New routine along with pragma Inline. (Receiving_Entry): New routine along with pragma Inline. (Suppress_Elaboration_Warnings): Removed. (Set_Is_Elaboration_Checks_OK_Id): New routine along with pragma Inline. (Set_Is_Initial_Condition_Procedure): New routine along with pragma Inline. (Set_Protected_Subprogram): New routine along with pragma Inline. (Set_Receiving_Entry): New routine along with pragma Inline. (Set_Suppress_Elaboration_Warnings): Removed. * exp_ch3.adb (Build_Init_Procedure): Use name _Finalizer to maintain consistency with other finalizer generating subprograms. (Default_Initialize_Object): Mark the block which wraps the call to finalize as being part of initialization. * exp_ch7.adb (Expand_N_Package_Declaration): Directly expand pragma Initial_Condition. (Expand_N_Package_Body): Directly expand pragma Initial_Condition. (Next_Suitable_Statement): Update the comment on usage. Skip over call markers generated by the ABE mechanism. * exp_ch9.adb (Activation_Call_Loc): New routine. (Add_Accept): Link the accept procedure to the original entry. (Build_Protected_Sub_Specification): Link the protected or unprotected version to the original subprogram. (Build_Task_Activation_Call): Code cleanup. Use a source location which is very close to the "begin" or "end" keywords when generating the activation call. * exp_prag.adb (Expand_Pragma_Initial_Condition): Reimplemented. * exp_spark.adb (Expand_SPARK): Use Expand_SPARK_N_Loop_Statement to process loops. (Expand_SPARK_N_Loop_Statement): New routine. (Expand_SPARK_N_Object_Declaration): Code cleanup. Partially insert the call to the Default_Initial_Condition procedure. (Expand_SPARK_Op_Ne): Renamed to Expand_SPARK_N_Op_Ne. * exp_util.adb (Build_DIC_Procedure_Body): Capture the SPARK_Mode in effect. (Build_DIC_Procedure_Declaration): Capture the SPARK_Mode in effect. (Insert_Actions): Add processing for N_Call_Marker. (Kill_Dead_Code): Explicitly kill an elaboration scenario. * exp_util.ads (Make_Invariant_Call): Update the comment on usage. * frontend.adb: Initialize Sem_Elab. Process all saved top level elaboration scenarios for ABE issues. * gcc-interface/trans.c (gnat_to_gnu): Add processing for N_Call_Marker nodes. * lib.adb (Earlier_In_Extended_Unit): New variant. * sem.adb (Analyze): Ignore N_Call_Marker nodes. (Preanalysis_Active): New routine. * sem.ads (Preanalysis_Active): New routine. * sem_attr.adb (Analyze_Access_Attribute): Save certain elaboration-related attributes. Save the scenario for ABE processing. * sem_ch3.adb (Analyze_Object_Declaration): Save the SPARK mode in effect. Save certain elaboration-related attributes. * sem_ch5.adb (Analyze_Assignment): Save certain elaboration-related attributes. Save the scenario for ABE processing. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Save the SPARK mode in effect. Save certain elaboration-related attributes. (Analyze_Subprogram_Body_Helper): Skip N_Call_Marker nodes when locating the first real statement. (Analyze_Subprogram_Declaration): Save the SPARK mode in effect. Save certain elaboration-related attributes. * sem_ch7.adb (Analyze_Package_Declaration): Do not suppress elaboration warnings. * sem_ch8.adb (Attribute_Renaming): Mark a subprogram body which was generated for purposes of wrapping an attribute used as a generic actual. (Find_Direct_Name): Save certain elaboration-related attributes. Save the scenario for ABE processing. (Find_Expanded_Name): Save certain elaboration-related attributes. Save the scenario for ABE processing. * sem_ch9.adb (Analyze_Entry_Declaration): Save certain elaboration-related attributes. (Analyze_Requeue): Save certain elaboration-related attributes. Save the scenario for ABE processing. (Analyze_Single_Task_Declaration): Save certain elaboration-related attributes. (Analyze_Task_Type_Declaration): Save certain elaboration-related attributes. * sem_ch12.adb (Analyze_Generic_Package_Declaration): Save certain elaboration-related attributes. (Analyze_Generic_Subprogram_Declaration): Save the SPARK mode in effect. Save certain elaboration-related attributes. (Analyze_Package_Instantiation): Save certain elaboration-related attributes. Save the scenario for ABE processing. Create completing bodies in case the instantiation results in a guaranteed ABE. (Analyze_Subprogram_Instantiation): Save certain elaboration-related attributes Save the scenario for ABE processing. Create a completing body in case the instantiation results in a guaranteed ABE. (Provide_Completing_Bodies): New routine. * sem_elab.ads: Brand new implementation. * sem_prag.adb (Analyze_Pragma, cases Elaborate, Elaborate_All, Elaborate_Body): Do not suppress elaboration warnings. * sem_res.adb (Make_Call_Into_Operator): Set the parent field of the operator. (Resolve_Call): Save certain elaboration-related attributes. Save the scenario for ABE processing. (Resolve_Entity_Name): Do not perform any ABE processing here. (Resolve_Entry_Call): Inherit certain attributes from the original call. * sem_util.adb (Begin_Keyword_Location): New routine. (Defining_Entity): Update the parameter profile. Add processing for concurrent subunits that are rewritten as null statements. (End_Keyword_Location): New routine. (Find_Enclosing_Scope): New routine. (In_Instance_Visible_Part): Code cleanup. (In_Subtree): Update the parameter profile. Add new version. (Is_Preelaborable_Aggregate): New routine. (Is_Preelaborable_Construct): New routine. (Mark_Elaboration_Attributes): New routine. (Scope_Within): Update the parameter profile. (Scope_Within_Or_Same): Update the parameter profile. * sem_util.ads (Begin_Keyword_Location): New routine. (Defining_Entity): Update the parameter profile and the comment on usage. (End_Keyword_Location): New routine. (Find_Enclosing_Scope): New routine. (In_Instance_Visible_Part): Update the parameter profile. (In_Subtree): Update the parameter profile. Add new version. (Is_Preelaborable_Aggregate): New routine. (Is_Preelaborable_Construct): New routine. (Mark_Elaboration_Attributes): New routine. (Scope_Within): Update the parameter profile and the comment on usage. (Scope_Within_Or_Same): Update the parameter profile and the comment on usage. * sem_warn.adb (Check_Infinite_Loop_Warning): Use Has_Condition_Actions to determine whether a loop has meaningful condition actions. (Has_Condition_Actions): New routine. * sinfo.adb (ABE_Is_Certain): Removed. (Is_Declaration_Level_Node): New routine. (Is_Dispatching_Call): New routine. (Is_Elaboration_Checks_OK_Node): New routine. (Is_Initialization_Block): New routine. (Is_Known_Guaranteed_ABE): New routine. (Is_Recorded_Scenario): New routine. (Is_Source_Call): New routine. (Is_SPARK_Mode_On_Node): New routine. (No_Elaboration_Check): Removed. (Target): New routine. (Was_Attribute_Reference): New routine. (Set_ABE_Is_Certain): Removed. (Set_Is_Declaration_Level_Node): New routine. (Set_Is_Dispatching_Call): New routine. (Set_Is_Elaboration_Checks_OK_Node): New routine. (Set_Is_Initialization_Block): New routine. (Set_Is_Known_Guaranteed_ABE): New routine. (Set_Is_Recorded_Scenario): New routine. (Set_Is_Source_Call): New routine. (Set_Is_SPARK_Mode_On_Node): New routine. (Set_No_Elaboration_Check): Removed. (Set_Target): New routine. (Set_Was_Attribute_Reference): New routine. * sinfo.ads: Remove attribute ABE_Is_Certain. Attribute Do_Discriminant_Check now utilizes Flag3. Attribute No_Side_Effect_Removal now utilizes Flag17. Add new node N_Call_Marker. Update the structure of various nodes. (ABE_Is_Certain): Removed along with pragma Inline. (Is_Declaration_Level_Node): New routine along with pragma Inline. (Is_Dispatching_Call): New routine along with pragma Inline. (Is_Elaboration_Checks_OK_Node): New routine along with pragma Inline. (Is_Initialization_Block): New routine along with pragma Inline. (Is_Known_Guaranteed_ABE): New routine along with pragma Inline. (Is_Recorded_Scenario): New routine along with pragma Inline. (Is_Source_Call): New routine along with pragma Inline. (Is_SPARK_Mode_On_Node): New routine along with pragma Inline. (No_Elaboration_Check): Removed along with pragma Inline. (Target): New routine along with pragma Inline. (Was_Attribute_Reference): New routine along with pragma Inline. (Set_ABE_Is_Certain): Removed along with pragma Inline. (Set_Is_Declaration_Level_Node): New routine along with pragma Inline. (Set_Is_Dispatching_Call): New routine along with pragma Inline. (Set_Is_Elaboration_Checks_OK_Node): New routine along with pragma Inline. (Set_Is_Initialization_Block): New routine along with pragma Inline. (Set_Is_Known_Guaranteed_ABE): New routine along with pragma Inline. (Set_Is_Recorded_Scenario): New routine along with pragma Inline. (Set_Is_Source_Call): New routine along with pragma Inline. (Set_Is_SPARK_Mode_On_Node): New routine along with pragma Inline. (Set_No_Elaboration_Check): Removed along with pragma Inline. (Set_Target): New routine along with pragma Inline. (Set_Was_Attribute_Reference): New routine along with pragma Inline. * sprint.adb (Sprint_Node_Actual): Add an entry for N_Call_Marker. From-SVN: r253559
2017-09-08[multiple changes]Arnaud Charlet1-14/+19
2017-09-08 Arnaud Charlet <charlet@adacore.com> * exp_intr.adb (Append_Entity_Name): Move to ... * sem_util.ads, sem_util.adb: ... here to share it. (Subprogram_Name): New subprogram, to compute the name of the enclosing subprogram/entity. * errutil.adb (Error_Msg): Fill new field Node. * erroutc.ads (Subprogram_Name_Ptr): New. (Error_Msg_Object): New field Node. * erroutc.adb (dmsg, Output_Msg_Text): Take new field Node into account. * errout.adb (Error_Msg): New variant with node id parameter. Fill new parameter Node when emitting messages. Revert previous changes for Include_Subprogram_In_Messages. * sem_ch5.adb (Check_Unreachable_Code): Supply Node parameter when generating warning message. 2017-09-08 Ed Schonberg <schonberg@adacore.com> * par-ch4.adb (P_Iterated_Component_Association): Place construct under -gnat2020 flag, given that it is a future feature of the language. * sem_aggr.adb (Resolve_Iterated_Component_Association): Mark defining identifier as referenced to prevent spurious warnings: corresponding loop is expanded into one or more loops whose variable has the same name, and the expression uses those names and not the original one. From-SVN: r251883
2017-09-08[multiple changes]Arnaud Charlet1-1/+1
2017-09-08 Yannick Moy <moy@adacore.com> * sem_prag.adb: Use System.Case_Util.To_Lower to simplify code. 2017-09-08 Arnaud Charlet <charlet@adacore.com> * opt.ads (Include_Subprogram_In_Messages): New variable. * errout.ads (Current_Subprogram_Ptr): New variable. * errout.adb (Error_Msg): Prepend current subprogram info in messages if Include_Subprogram_In_Messages is set. * sem_util.adb (elab code): Initialize Current_Subprogram_Ptr to Current_Subprogram. * gnat1drv.adb (Adjust_Global_Switches): Set Include_Subprogram_In_Messages when -gnatdJ is set. * debug.adb: Document and reserve -gnatdJ. 2017-09-08 Georges-Axel Jaloyan <jaloyan@adacore.com> * g-dynhta.adb, g-dynhta.ads (Get_First_Key, Get_Next_Key): New functions to iterate over simple hastables. (Load_Factor_HTable): Remove obsolete and inefficient implementation. 2017-09-08 Javier Miranda <miranda@adacore.com> * exp_ch6.adb (Unqual_BIP_Function_Call): Adding missing checks on the presence of Entity() before checking the entity attributes. 2017-09-08 Eric Botcazou <ebotcazou@adacore.com> * sem_ch6.adb (Analyze_Expression_Function): Reorder some statements, use local variable and remove unnecessary processing. From-SVN: r251880
2017-09-08[multiple changes]Arnaud Charlet1-0/+88
2017-09-08 Javier Miranda <miranda@adacore.com> * exp_ch6.ads (Make_Build_In_Place_Iface_Call_In_Allocator): New subprogram. (Make_Build_In_Place_Iface_Call_In_Anonymous_Context): New subprogram. (Make_Build_In_Place_Iface_Call_In_Object_Declaration): New subprogram. (Unqual_BIP_Iface_Function_Call): New subprogram. * exp_ch6.adb (Replace_Renaming_Declaration_Id): New subprogram containing code that was previously inside Make_Build_In_Place_Call_In_Object_Declaration since it is also required for one of the new subprograms. (Expand_Actuals): Invoke Make_Build_In_Place_Iface_Call_In_Anonymous_Context (Expand_N_Extended_Return_Statement): Extend the cases covered by an assertion on expected BIP object declarations. (Make_Build_In_Place_Call_In_Assignment): Removing unused code; found working on this ticket. (Make_Build_In_Place_Call_In_Object_Declaration): Move the code that replaces the internal name of the renaming declaration into the new subprogram Replace_Renaming_Declaration_Id. (Make_Build_In_Place_Iface_Call_In_Allocator): New subprogram. (Make_Build_In_Place_Iface_Call_In_Anonymous_Context): New subprogram. (Make_Build_In_Place_Iface_Call_In_Object_Declaration): New subprogram. (Unqual_BIP_Iface_Function_Call): New subprogram. * exp_ch3.adb (Expand_N_Object_Declaration): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Object_Declaration. * exp_attr.adb (Expand_N_Attribute_Reference): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Anonymous_Context. * exp_ch4.adb (Expand_Allocator_Expression): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Allocator. (Expand_N_Indexed_Component): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Anonymous_Context. (Expand_N_Selected_Component): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Anonymous_Context. (Expand_N_Slice): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Anonymous_Context. * exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Invoke the new subprogram Make_Build_In_Place_Iface_Call_In_Anonymous_Context. 2017-09-08 Javier Miranda <miranda@adacore.com> * exp_disp.adb (Expand_Interface_Conversion): Fix handling of access to interface types. Remove also the accessibility check. 2017-09-08 Eric Botcazou <ebotcazou@adacore.com> * sem_ch6.adb (Freeze_Expr_Types): Really freeze all the types that are referenced by the expression. (Analyze_Expression_Function): Call Freeze_Expr_Types for a completion instead of manually freezing the type of the expression. (Analyze_Subprogram_Body_Helper): Do not call Freeze_Expr_Types here. 2017-09-08 Ed Schonberg <schonberg@adacore.com> * exp_prag.adb (Replace_Discriminals_Of_Protected_Op): New procedure, auxiliary to Expand_Pragma_Check, to handle references to the discriminants of a protected type within a precondition of a protected operation. This is needed because the original precondition has been analyzed in the context of the protected declaration, but in the body of the operation references to the discriminants have been replaved by references to the discriminants of the target object, and these references are only created when expanding the protected body. From-SVN: r251879
2017-04-28[multiple changes]Arnaud Charlet1-1/+1
2017-04-28 Eric Botcazou <ebotcazou@adacore.com> * exp_ch9.adb (Build_Lock_Free_Unprotected_Subprogram_Body): Also initialize Block_Decls variable. (Expand_Entry_Barrier): Add pragma Warnings on Func_Body variable. (Build_Dispatching_Requeue): Add pragma Warnings on Op variable. * exp_disp.adb (Expand_Interface_Actuals): Initialize Formal_DDT and Actual_DDT variables. (Expand_Interface_Thunk): Initialize Iface_Formal. (Make_DT): Initialize Size_Comp. (Make_Select_Specific_Data_Table): Initialize Decls. * exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): Also initialize more RPC_Receiver_* variables. (Build_To_Any_Function): Initialize Cstr_Formal. * exp_prag.adb (Expand_Pragma_Contract_Cases): Initialize Msg_Str. 2017-04-28 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Freeze_Type_Refs): For an interface conversion node between access types, freeze the designated type as well, so that dispatch table pointers are created in the proper scope, and not in the constructed body of the expression function. 2017-04-28 Bob Duff <duff@adacore.com> * alloc.ads (Nodes_Initial): Go back to previous value. The large value makes large compilations faster, but small compilations slower. 2017-04-28 Arnaud Charlet <charlet@adacore.com> * sem_util.adb: minor typos in Is_Child_Or_Sibling. 2017-04-28 Hristian Kirtchev <kirtchev@adacore.com> * erroutc.adb (Compilation_Errors): Do not consider info messages as suitable warnings when warnings must be treated as errors. * sem_ch7.adb (Analyze_Package_Specification): Do not consider internally-generated packages when outputting completion information. * errout.adb (Output_Messages): Do not consider info messages as suitable warnings when warnings must be treated as errors. * errutil.adb (Finalize): Do not consider info messages as suitable warnings when warnings must be treated as errors. 2017-04-28 Eric Botcazou <ebotcazou@adacore.com> * warnsw.ads: Minor fix for incorrect wording in comment. 2017-04-28 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (In_Instance_Code): New predicate in Valid_Conversion, to determine whether a type conversion appears as (or within) an actual for a formal object. Type conversions in instances are not rechecked in Valid_Conversion because visibility changes between generic location andi instance may lead to spurious errors, but conversions within an actual must be fully checked, and they are not fully resolved when pre-analyzing the actuals. From-SVN: r247385
2017-04-27[multiple changes]Arnaud Charlet1-1/+1
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * exp_prag.adb, a-cofuse.adb, a-cofuse.ads, einfo.adb, sem_prag.adb, cstand.adb, par-prag.adb, a-cofuve.adb, a-cofuve.ads, a-cofuma.adb, a-cofuma.ads, a-cofuba.adb, a-cofuba.ads: Minor reformatting. 2017-04-27 Tristan Gingold <gingold@adacore.com> * s-excmac-gcc.ads, s-excmac-gcc.adb, s-excmac-arm.ads, s-excmac-arm.adb (New_Occurrence): Rewrite it in Ada95. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb (Establish_Transient_Scope): Rewrite the loop which detects potential enclosing transient scopes. The loop now terminates much earlier as transient scopes are bounded by packages and subprograms. 2017-04-27 Claire Dross <dross@adacore.com> * a-cfdlli.adb, a-cfdlli.ads (=): Generic parameter removed to allow the use of regular equality over elements in contracts. (Cursor): Type is now public so that it can be used in model functions. (Formal_Model): Ghost package containing model functions that are used in subprogram contracts. (Current_To_Last): Removed, model functions should be used instead. (First_To_Previous): Removed, model functions should be used instead. (Strict_Equal): Removed, model functions should be used instead. (Append): Default parameter value replaced by new wrapper to allow more precise contracts. (Insert): Default parameter value replaced by new wrapper to allow more precise contracts. (Delete): Default parameter value replaced by new wrapper to allow more precise contracts. (Prepend): Default parameter value replaced by new wrapper to allow more precise contracts. (Delete_First): Default parameter value replaced by new wrapper to allow more precise contracts. (Delete_Last): Default parameter value replaced by new wrapper to allow more precise contracts. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * exp_spark.adb (Expand_SPARK): Perform specialized expansion for object declarations. (Expand_SPARK_N_Object_Declaration): New routine. * sem_elab.adb (Check_A_Call): Include calls to the Default_Initial_Condition procedure of a type under the SPARK elaboration checks umbrella. From-SVN: r247299
2017-04-27[multiple changes]Arnaud Charlet1-6/+10
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * sem.adb (Analyze): Diagnose an illegal iterated component association. * sem_util.ads, sem_util.adb (Diagnose_Iterated_Component_Association): New routine. 2017-04-27 Bob Duff <duff@adacore.com> * adaint.c (__gnat_get_current_dir): Return 0 in length if getcwd fails. * a-direct.adb, g-dirope.adb, osint.adb, s-os_lib.adb: Raise exception if getcwd failed. 2017-04-27 Yannick Moy <moy@adacore.com> * exp_dbug.adb, exp_dbug.ads (Get_External_Name): Prefix ghost entities with special prefix. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * debug.adb Change the documentation of switch -gnatd.s. * exp_ch7.adb (Make_Transient_Block): Transient blocks do not need to manage the secondary stack when an enclosing scope already performs this functionality (aka relaxed management). Switch -gnatd.s may be used to force strict management in which case the block will manage the secondary stack unconditionally. Add a guard to stop the traversal when encountering a package or a subprogram scope. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Call): Refine further the handling of limited views of return types in function calls. If the function that returns a limited view appears in the current unit, we do not replace its type by the non-limited view because this transformation is performed int the back-end. However, the type of the call itself must be the non-limited view, to prevent spurious resolution errors. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * einfo,ads, einfo.adb (Class_Wide_Preconds, Class_Wide_Postconds): Removed, proposed implementation using generics for class-wide preconditions proved impractical. (Class_Wide_Clone): New attribute of subprogram. Designates subprogram created for primitive operations with class-wide pre/postconditions that contain calls to other primitives. The clone holds the body of the original primitive, but the pre/postonditions do not apply to it. The original body is rewritten as a wrapper for a call to the clone. (Is_Class_Wide_Clone): New flag to identify a Class_Wide_Clone. If the flag is set, no code for the corresponding pre/postconditions is inserted into its body. 2017-04-27 Bob Duff <duff@adacore.com> * exp_prag.adb, par-prag.adb, sem_ch13.adb: Ignore Scalar_Storage_Order if -gnatI is given. * sem_prag.adb (Analyze_Pragma): Ignore Default_Scalar_Storage_Order if -gnatI is given. From-SVN: r247298
2017-04-25[multiple changes]Arnaud Charlet1-2/+4
2017-04-25 Bob Duff <duff@adacore.com> * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Use Source_Index (Current_Sem_Unit) to find the correct casing. * exp_prag.adb (Expand_Pragma_Check): Use Source_Index (Current_Sem_Unit) to find the correct casing. * par.adb (Par): Null out Current_Source_File, to ensure that the above bugs won't rear their ugly heads again. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Find_Type): For an attribute reference 'Class, if prefix type is synchronized and previous errors have suppressed the creation of the corresponding record type, create a spurious class-wide for the synchonized type itself, to catch other misuses of the attribute 2017-04-25 Steve Baird <baird@adacore.com> * exp_ch6.adb (Expand_Simple_Function_Return): if CodePeer_Mode is True, then don't generate the accessibility check for the tag of a tagged result. * exp_intr.adb (Expand_Dispatching_Constructor_Call): if CodePeer_Mode is True, then don't generate the tag checks for the result of call to an instance of Ada.Tags.Generic_Dispatching_Constructor (i.e., both the "is a descendant of" check and the accessibility check). 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb: Code cleanups. * a-strbou.ads: minor whitespace fix in Trim for bounded strings. * sem_ch8.ads: Minor comment fix. From-SVN: r247168
2017-04-25[multiple changes]Arnaud Charlet1-1/+1
2017-04-25 Eric Botcazou <ebotcazou@adacore.com> * a-numaux.ads: Fix description of a-numaux-darwin and a-numaux-x86. (Double): Define to Long_Float. * a-numaux-vxworks.ads (Double): Likewise. * a-numaux-darwin.ads (Double): Likewise. * a-numaux-libc-x86.ads (Double): Define to Long_Long_Float. * a-numaux-x86.ads: Fix package description. * a-numaux-x86.adb (Is_Nan): Minor tweak. (Reduce): Adjust and complete description. Call Is_Nan instead of testing manually. Use an integer temporary to hold rounded value. * a-numaux-darwin.adb (Reduce): Likewise. (Is_Nan): New function. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Selected_Component): Additional refinement on analysis of prefix whose type is a current instance of a synchronized type, but where the prefix itself is an entity that is an object. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Replace_Target): When rewriting the RHS, preserve the identity of callable entities therein, because they have been properly resolved, and prefixed calls may have been rewritten as normal calls. 2017-04-25 Patrick Bernardi <bernardi@adacore.com> * exp_ch3.adb (Build_Init_Statements): Convert the expression of the pragma/aspect Secondary_Stack_Size to internal type System.Parameters.Size_Type before assigning it to the Secondary_Stack_Size component of the task type's corresponding record. 2017-04-25 Eric Botcazou <ebotcazou@adacore.com> * sem_eval.adb (Compile_Time_Compare): Reinstate the expr+literal (etc) optimizations when the type is modular and the offsets are equal. 2017-04-25 Eric Botcazou <ebotcazou@adacore.com> * s-osinte-freebsd.ads: Minor comment tweaks 2017-04-25 Javier Miranda <miranda@adacore.com> * urealp.adb (UR_Write): Reverse previous patch adding documentation on why we generate multiplications instead of divisions (needed to avoid expressions whose computation with large numbers may cause division by 0). 2017-04-25 Bob Duff <duff@adacore.com> * erroutc.adb (Set_Specific_Warning_Off, Set_Warnings_Mode_Off): Use the correct source file for Stop. Was using Current_Source_File, which is only valid during parsing. Current_Source_File will have a leftover value from whatever file happened to be parsed last, because of a with_clause or something. 2017-04-25 Bob Duff <duff@adacore.com> * lib.ads, lib.adb (In_Internal_Unit): New functions similar to In_Predefined_Unit, but including GNAT units. * sem_util.ads, sem_util.adb (Should_Ignore_Pragma): Replace with Should_Ignore_Pragma_Par and Should_Ignore_Pragma_Sem, because Should_Ignore_Pragma was not working reliably outside the parser, because Current_Source_File is not valid. * sem_prag.adb, exp_prag.adb: Call Should_Ignore_Pragma_Sem. * par-prag.adb: Call Should_Ignore_Pragma_Par. From-SVN: r247162
2017-04-25[multiple changes]Arnaud Charlet1-1/+1
2017-04-25 Bob Duff <duff@adacore.com> * sem_util.ads, sem_util.adb (Should_Ignore_Pragma): New function that returns True when appropriate. * par-prag.adb, exp_prag.adb, sem_prag.adb: Do not ignore pragmas when compiling predefined files. * fname.ads, fname.adb (Is_Predefined_File_Name): Fix bug: "gnat.adc" should not be considered a predefined file name. That required (or at least encouraged) a lot of cleanup of global variable usage. We shouldn't be communicating information via the global name buffer. * bindgen.adb, errout.adb, fname-uf.adb, lib-load.adb, make.adb, * restrict.adb, sem_ch10.adb, sem_ch6.adb, sem_ch8.adb: Changes required by the above-mentioned cleanup. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * osint.adb (Find_File): Handle properly a request for a configuration file whose name is a directory. From-SVN: r247151
2017-01-13sem_aggr.adb, [...]: Update all eligible case statements to reflect the new ↵Hristian Kirtchev1-1/+0
style for case alternatives. 2017-01-13 Hristian Kirtchev <kirtchev@adacore.com> * sem_aggr.adb, par_sco.adb, s-osprim-mingw.adb, exp_ch5.adb, exp_prag.adb, sem_ch3.adb, xr_tabls.adb, lib-xref-spark_specific.adb, layout.adb, sem_dist.adb, exp_spark.adb, exp_ch7.adb, gnatcmd.adb, exp_util.adb, prj-proc.adb, sem_aux.adb, comperr.adb, g-memdum.adb, exp_attr.adb, s-intman-solaris.adb, exp_ch9.adb, make.adb, live.adb, g-sercom-linux.adb, sem_dim.adb, mlib-prj.adb, s-intman-posix.adb, sem_ch9.adb, sem_ch10.adb, prep.adb, einfo.adb, scng.adb, checks.adb, prj-strt.adb, sem_prag.adb, eval_fat.adb, sem_ch12.adb, sem.adb, a-numaux-x86.adb, a-stwifi.adb, i-cobol.adb, prj.adb, get_spark_xrefs.adb, s-tasini.adb, rtsfind.adb, freeze.adb, g-arrspl.adb, par-ch4.adb, sem_util.adb, sem_res.adb, expander.adb, sem_attr.adb, exp_dbug.adb, prj-pp.adb, a-stzfix.adb, s-interr.adb, s-wchcnv.adb, switch-m.adb, gnat1drv.adb, sinput-l.adb, stylesw.adb, contracts.adb, s-intman-android.adb, g-expect.adb, exp_ch4.adb, g-comlin.adb, errout.adb, sinput.adb, s-exctra.adb, repinfo.adb, g-spipat.adb, g-debpoo.adb, exp_ch6.adb, sem_ch4.adb, exp_ch13.adb, a-wtedit.adb, validsw.adb, pprint.adb, widechar.adb, makeutl.adb, ali.adb, set_targ.adb, sem_mech.adb, sem_ch6.adb, gnatdll.adb, get_scos.adb, g-pehage.adb, s-tratas-default.adb, gnatbind.adb, prj-dect.adb, g-socthi-mingw.adb, par-prag.adb, prj-nmsc.adb, exp_disp.adb, par-ch12.adb, binde.adb, sem_ch8.adb, s-tfsetr-default.adb, s-regexp.adb, gprep.adb, s-tpobop.adb, a-teioed.adb, sem_warn.adb, sem_eval.adb, g-awk.adb, s-io.adb, a-ztedit.adb, xoscons.adb, exp_intr.adb, sem_cat.adb, sprint.adb, g-socket.adb, exp_dist.adb, sem_ch13.adb, s-tfsetr-vxworks.adb, par-ch3.adb, treepr.adb, g-forstr.adb, g-catiio.adb, par-ch5.adb, uname.adb, osint.adb, exp_ch3.adb, prj-env.adb, a-strfix.adb, a-stzsup.adb, prj-tree.adb, s-fileio.adb: Update all eligible case statements to reflect the new style for case alternatives. Various code clean up and reformatting. From-SVN: r244406
2017-01-13atree.adb (Allocate_Initialize_Node): A newly created node is no longer ↵Hristian Kirtchev1-49/+6
marked as Ghost at this level. 2017-01-13 Hristian Kirtchev <kirtchev@adacore.com> * atree.adb (Allocate_Initialize_Node): A newly created node is no longer marked as Ghost at this level. (Mark_New_Ghost_Node): New routine. (New_Copy): Mark the copy as Ghost. (New_Entity): Mark the entity as Ghost. (New_Node): Mark the node as Ghost. * einfo.adb (Is_Checked_Ghost_Entity): This attribute can now apply to unanalyzed entities. (Is_Ignored_Ghost_Entity): This attribute can now apply to unanalyzed entities. (Set_Is_Checked_Ghost_Entity): This attribute now applies to all entities as well as unanalyzed entities. (Set_Is_Ignored_Ghost_Entity): This attribute now applies to all entities as well as unanalyzed entities. * expander.adb Add with and use clauses for Ghost. (Expand): Install and revert the Ghost region associated with the node being expanded. * exp_ch3.adb (Expand_Freeze_Array_Type): Remove all Ghost-related code. (Expand_Freeze_Class_Wide_Type): Remoe all Ghost-related code. (Expand_Freeze_Enumeration_Type): Remove all Ghost-related code. (Expand_Freeze_Record_Type): Remove all Ghost-related code. (Freeze_Type): Install and revert the Ghost region associated with the type being frozen. * exp_ch5.adb Remove with and use clauses for Ghost. (Expand_N_Assignment_Statement): Remove all Ghost-related code. * exp_ch6.adb Remove with and use clauses for Ghost. (Expand_N_Procedure_Call_Statement): Remove all Ghost-relatd code. (Expand_N_Subprogram_Body): Remove all Ghost-related code. * exp_ch7.adb (Build_Invariant_Procedure_Body): Install and revert the Ghost region of the working type. (Build_Invariant_Procedure_Declaration): Install and revert the Ghost region of the working type. (Expand_N_Package_Body): Remove all Ghost-related code. * exp_ch8.adb Remove with and use clauses for Ghost. (Expand_N_Exception_Renaming_Declaration): Remove all Ghost-related code. (Expand_N_Object_Renaming_Declaration): Remove all Ghost-related code. (Expand_N_Package_Renaming_Declaration): Remove all Ghost-related code. (Expand_N_Subprogram_Renaming_Declaration): Remove all Ghost-related code. * exp_ch13.adb Remove with and use clauses for Ghost. (Expand_N_Freeze_Entity): Remove all Ghost-related code. * exp_disp.adb (Make_DT): Install and revert the Ghost region of the tagged type. Move the generation of various entities within the Ghost region of the type. * exp_prag.adb Remove with and use clauses for Ghost. (Expand_Pragma_Check): Remove all Ghost-related code. (Expand_Pragma_Contract_Cases): Remove all Ghost-related code. (Expand_Pragma_Initial_Condition): Remove all Ghost-related code. (Expand_Pragma_Loop_Variant): Remove all Ghost-related code. * exp_util.adb (Build_DIC_Procedure_Body): Install and revert the Ghost region of the working types. (Build_DIC_Procedure_Declaration): Install and revert the Ghost region of the working type. (Make_Invariant_Call): Install and revert the Ghost region of the associated type. (Make_Predicate_Call): Reimplemented. Install and revert the Ghost region of the associated type. * freeze.adb (Freeze_Entity): Install and revert the Ghost region of the entity being frozen. (New_Freeze_Node): Removed. * ghost.adb Remove with and use clauses for Opt. (Check_Ghost_Completion): Update the parameter profile and all references to formal parameters. (Ghost_Entity): Update the comment on usage. (Install_Ghost_Mode): New routines. (Is_Ghost_Assignment): New routine. (Is_Ghost_Declaration): New routine. (Is_Ghost_Pragma): New routine. (Is_Ghost_Procedure_Call): New routine. (Is_Ghost_Renaming): Removed. (Is_OK_Declaration): Reimplemented. (Is_OK_Pragma): Reimplemented. (Is_OK_Statement): Reimplemented. (Is_Subject_To_Ghost): Update the comment on usage. (Mark_And_Set_Ghost_Assignment): New routine. (Mark_And_Set_Ghost_Body): New routine. (Mark_And_Set_Ghost_Completion): New routine. (Mark_And_Set_Ghost_Declaration): New routine. (Mark_And_Set_Ghost_Instantiation): New routine. (Mark_And_Set_Ghost_Procedure_Call): New routine. (Mark_Full_View_As_Ghost): Removed. (Mark_Ghost_Declaration_Or_Body): New routine. (Mark_Ghost_Pragma): New routine. (Mark_Ghost_Renaming): New routine. (Mark_Pragma_As_Ghost): Removed. (Mark_Renaming_As_Ghost): Removed. (Propagate_Ignored_Ghost_Code): Update the comment on usage. (Prune_Node): Freeze nodes no longer need special pruning, they are processed by the general ignored Ghost code mechanism. (Restore_Ghost_Mode): New routine. (Set_Ghost_Mode): Reimplemented. (Set_Ghost_Mode_From_Entity): Removed. * ghost.ads Add with and use clauses for Ghost. (Check_Ghost_Completion): Update the parameter profile along with the comment on usage. (Install_Ghost_Mode): New routine. (Is_Ghost_Assignment): New routine. (Is_Ghost_Declaration): New routine. (Is_Ghost_Pragma): New routine. (Is_Ghost_Procedure_Call): New routine. (Mark_And_Set_Ghost_Assignment): New routine. (Mark_And_Set_Ghost_Body): New routine. (Mark_And_Set_Ghost_Completion): New routine. (Mark_And_Set_Ghost_Declaration): New routine. (Mark_And_Set_Ghost_Instantiation): New routine. (Mark_And_Set_Ghost_Procedure_Call): New routine. (Mark_Full_View_As_Ghost): Removed. (Mark_Ghost_Pragma): New routine. (Mark_Ghost_Renaming): New routine. (Mark_Pragma_As_Ghost): Removed. (Mark_Renaming_As_Ghost): Removed. (Restore_Ghost_Mode): New routine. (Set_Ghost_Mode): Redefined. (Set_Ghost_Mode_From_Entity): Removed. * sem.adb (Analyze): Install and revert the Ghost region of the node being analyzed. (Do_Analyze): Change the way a clean Ghost region is installed and reverted. * sem_ch3.adb (Analyze_Full_Type_Declaration): Remove all Ghost-related code. (Analyze_Incomplete_Type_Decl): Remove all Ghost-related code. (Analyze_Number_Declaration): Remove all Ghost-related code. (Analyze_Object_Declaration): Install and revert the Ghost region of a deferred object declaration's completion. (Array_Type_Declaration): Remove all Ghost-related code. (Build_Derived_Type): Update the comment on the propagation of Ghost attributes from a parent to a derived type. (Derive_Subprogram): Remove all Ghost-related code. (Make_Class_Wide_Type): Remove all Ghost-related code. (Make_Implicit_Base): Remove all Ghost-related code. (Process_Full_View): Install and revert the Ghost region of the partial view. There is no longer need to check the Ghost completion here. * sem_ch5.adb (Analyze_Assignment): Install and revert the Ghost region of the left hand side. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Remove all Ghost-related code. (Analyze_Expression_Function): Remove all Ghost-related code. (Analyze_Generic_Subprogram_Body): Remove all Ghost-related code. (Analyze_Procedure_Call): Install and revert the Ghost region of the procedure being called. (Analyze_Subprogram_Body_Helper): Install and revert the Ghost region of the spec or body. (Analyze_Subprogram_Declaration): Remove all Ghost-related code. (Build_Subprogram_Declaration): Remove all Ghost-related code. (Find_Corresponding_Spec): Remove all Ghost-related code. (Process_Formals): Remove all Ghost-related code. * sem_ch7.adb (Analyze_Package_Body_Helper): Install and revert the Ghost region of the spec. (Analyze_Package_Declaration): Remove all Ghost-related code. * sem_ch8.adb (Analyze_Exception_Renaming): Mark a renaming as Ghost when it aliases a Ghost entity. (Analyze_Generic_Renaming): Mark a renaming as Ghost when it aliases a Ghost entity. (Analyze_Object_Renaming): Mark a renaming as Ghost when it aliases a Ghost entity. (Analyze_Package_Renaming): Mark a renaming as Ghost when it aliases a Ghost entity. (Analyze_Subprogram_Renaming): Mark a renaming as Ghost when it aliases a Ghost entity. * sem_ch11.adb Remove with and use clauses for Ghost. (Analyze_Exception_Declaration): Remove all Ghost-related code. * sem_ch12.adb (Analyze_Generic_Package_Declaration): Remove all Ghost-related code. (Analyze_Generic_Subprogram_Declaration): Remove all Ghost-related code. (Analyze_Package_Instantiation): Install and revert the Ghost region of the package instantiation. (Analyze_Subprogram_Instantiation): Install and revert the Ghost region of the subprogram instantiation. (Instantiate_Package_Body): Code clean up. Install and revert the Ghost region of the package body. (Instantiate_Subprogram_Body): Code clean up. Install and revert the Ghost region of the subprogram body. * sem_ch13.adb (Build_Predicate_Functions): Install and revert the Ghost region of the related type. (Build_Predicate_Function_Declaration): Code clean up. Install and rever the Ghost region of the related type. * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Install and revert the Ghost region of the pragma. (Analyze_Initial_Condition_In_Decl_Part): Install and revert the Ghost region of the pragma. (Analyze_Pragma): Install and revert the Ghost region of various pragmas. Mark a pragma as Ghost when it is related to a Ghost entity or encloses a Ghost entity. (Analyze_Pre_Post_Condition): Install and revert the Ghost region of the pragma. (Analyze_Pre_Post_Condition_In_Decl_Part): Install and revert the Ghost region of the pragma. * sem_res.adb (Resolve): Remove all Ghost-related code. * sem_util.adb (Is_Declaration): Reimplemented. (Is_Declaration_Other_Than_Renaming): New routine. * sem_util.ads (Is_Declaration_Other_Than_Renaming): New routine. * sinfo.adb (Is_Checked_Ghost_Pragma): New routine. (Is_Ghost_Pragma): Removed. (Is_Ignored_Ghost_Pragma): New routine. (Set_Is_Checked_Ghost_Pragma): New routine. (Set_Is_Ghost_Pragma): Removed. (Set_Is_Ignored_Ghost_Pragma): New routine. * sinfo.ads: Update the documentation on Ghost mode and Ghost regions. New attributes Is_Checked_Ghost_Pragma and Is_Ignored_Ghost_Pragma along with usages in nodes. Remove attribute Is_Ghost_Pragma along with usages in nodes. (Is_Checked_Ghost_Pragma): New routine along with pragma Inline. (Is_Ghost_Pragma): Removed along with pragma Inline. (Is_Ignored_Ghost_Pragma): New routine along with pragma Inline. (Set_Is_Checked_Ghost_Pragma): New routine along with pragma Inline. (Set_Is_Ghost_Pragma): Removed along with pragma Inline. (Set_Is_Ignored_Ghost_Pragma): New routine along with pragma Inline. From-SVN: r244395
2017-01-12contracts.adb, [...] (Pragma_Name): Change name to Pragma_Name_Unmapped.Bob Duff1-2/+2
2017-01-12 Bob Duff <duff@adacore.com> * contracts.adb, einfo.adb, errout.adb, exp_attr.adb, exp_ch3.adb, exp_ch7.adb, exp_ch9.adb, exp_prag.adb, freeze.adb, frontend.adb, ghost.adb, inline.adb, lib-writ.adb, lib-xref.adb, par.adb, par-ch10.adb, par-ch2.adb, par-prag.adb, par_sco.adb, sem_attr.adb, sem_aux.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch6.adb, sem_ch8.adb, sem_ch9.adb, sem_elab.adb, sem_prag.adb, sem_res.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sinfo.adb, sinfo.ads, sprint.adb (Pragma_Name): Change name to Pragma_Name_Unmapped. (Pragma_Name_Mapped): Change name to Pragma_Name. This is because the "mapped" version should be the usual case. From-SVN: r244352
2017-01-06snames.ads-tmpl (Renamed): New name for the pragma argument.Bob Duff1-34/+30
2017-01-06 Bob Duff <duff@adacore.com> * snames.ads-tmpl (Renamed): New name for the pragma argument. * par-ch2.adb: Allow the new pragma (with analysis deferred to Sem_Prag). * sinfo.ads, sinfo.adb (Map_Pragma_Name, Pragma_Name_Mapped): Keep a mapping from new pragma names to old names. * sem_prag.adb: Check legality of pragma Rename_Pragma, and implement it by calling Map_Pragma_Name. * checks.adb, contracts.adb, einfo.adb, errout.adb, * exp_attr.adb, exp_ch3.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, * exp_prag.adb, exp_util.adb, freeze.adb, frontend.adb, ghost.adb, * inline.adb, lib-writ.adb, scans.adb, scans.ads, sem_attr.adb, * sem_aux.adb, sem_ch10.adb, sem_ch13.adb, sem_ch6.adb, sem_ch9.adb, * sem_elab.adb, sem_res.adb, sem_util.adb, sem_util.ads, * sem_warn.adb: Call Pragma_Name_Mapped instead of Pragma_Name as appropriate. From-SVN: r244144
2016-05-02[multiple changes]Arnaud Charlet1-2/+2
2016-05-02 Hristian Kirtchev <kirtchev@adacore.com> * exp_prag.adb, comperr.adb: Minor reformatting. 2016-05-02 Ed Schonberg <schonberg@adacore.com> * exp_pakd.adb (Rj_Unchecked_Convert_To): Do not perform an unchecked conversion if the source size is 0 (indicating that its RM size is unknown). This will happen with packed arrays of non-discrete types, in which case the component type is known to match. 2016-05-02 Arnaud Charlet <charlet@adacore.com> * debug.adb: Reserve -gnatd.V. 2016-05-02 Javier Miranda <miranda@adacore.com> * sem_ch3.adb (Process_Full_View): Remove from visibility wrappers of synchronized types to avoid spurious errors with their wrapped entity. * exp_ch9.adb (Build_Wrapper_Spec): Do not generate the wrapper if no interface primitive is covered by the subprogram and this is not a primitive declared between two views; see Process_Full_View. (Build_Protected_Sub_Specification): Link the dispatching subprogram with its original non-dispatching protected subprogram since their names differ. (Expand_N_Protected_Type_Declaration): If a protected subprogram overrides an interface primitive then do not build a wrapper if it was already built. * einfo.ads, einfo.adb (Original_Protected_Subprogram): New attribute. * sem_ch4.adb (Names_Match): New subprogram. * sem_ch6.adb (Check_Synchronized_Overriding): Moved to library level and defined in the public part of the package to invoke it from Exp_Ch9.Build_Wrapper_Spec (Has_Matching_Entry_Or_Subprogram): New subprogram. (Report_Conflict): New subprogram. From-SVN: r235739
2016-05-02[multiple changes]Arnaud Charlet1-11/+24
2016-05-02 Jerome Lambourg <lambourg@adacore.com> * s-unstyp.ads: Code cleanups. 2016-05-02 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch13.adb (Size_Too_Small_Error): Fix the error message format. 2016-05-02 Ed Schonberg <schonberg@adacore.com> * exp_prag.adb (Expand_attributes_In_Consequence, Expand_Attributes): If the prefix of'Old is an unconstrained type, for example an unconstrained formal of the enclosing subprogram, create an object declaration with an expression to obtain the actual subtype of the temporary. 2016-05-02 Arnaud Charlet <charlet@adacore.com> * comperr.adb (Delete_SCIL_Files): Add missing handling of N_Subprogram_Declaration. From-SVN: r235738
2016-04-20[multiple changes]Arnaud Charlet1-4/+4
2016-04-20 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch4.adb (Expand_Allocator_Expression): Ensure that the tag assignment and adjustment preceed the accessibility check. * exp_ch7.adb (Is_Subprogram_Call): Reimplemented. 2016-04-20 Hristian Kirtchev <kirtchev@adacore.com> * exp_prag.adb (Expand_Attributes): Ensure that the temporary used to capture the value of attribute 'Old's prefix is properly initialized. 2016-04-20 Javier Miranda <miranda@adacore.com> * exp_unst.ads, exp_unst.adb (Get_Level, Subp_Index): Moved to library level. From-SVN: r235258
2015-10-23[multiple changes]Arnaud Charlet1-1/+21
2015-10-23 Bob Duff <duff@adacore.com> * exp_strm.adb (Build_Record_Or_Elementary_Input_Function): Use Underlying_Type for B_Typ, in case the Typ is a subtype of a type with unknown discriminants. * g-awk.ads: Minor style fix in comment 2015-10-23 Hristian Kirtchev <kirtchev@adacore.com> * debug.adb: Document the use of debug switch -gnatd.5. * einfo.adb: Code reformatting. (Is_Ghost_Entity): Moved from ghost.adb. * einfo.ads New synthesized attribute Is_Ghost_Enity along with usage in nodes and pragma Inline. (Is_Ghost_Entity: Moved from ghost.ads. * exp_ch3.adb Code reformatting. (Expand_Freeze_Array_Type): Capture, set and restore the Ghost mode. (Expand_Freeze_Class_Wide_Type): Capture, set and restore the Ghost mode. (Expand_Freeze_Enumeration_Type): Capture, set and restore the Ghost mode. (Expand_Freeze_Record_Type): Capture, set and restore the Ghost mode. * exp_ch6.adb (Expand_Subprogram_Contract): Do not expand the contract of an ignored Ghost subprogram. * exp_ch13.adb Add with and use clauses for Ghost. (Expand_N_Freeze_Entity): Capture, set and restore the Ghost mode. * exp_dbug.adb (Get_External_Name): Code reformatting. Add a special prefix for ignored Ghost entities or when requested by -gnatd.5 for any Ghost entity. * exp_dbug.ads Document the use of prefix "_ghost_" for ignored Ghost entities. * exp_prag.adb (Expand_Pragma_Check): Capture, set and restore the Ghost mode. (Expand_Pragma_Loop_Variant): Use In_Assertion_Expr to signal the original context. * ghost.adb (Check_Ghost_Overriding): Code cleanup. (Is_Ghost_Entity): Moved to einfo.adb. (Is_OK_Declaration): Move the assertion expression check to the outer level. (Is_OK_Ghost_Context): An assertion expression is a valid Ghost context. * ghost.ads (Is_Ghost_Entity): Moved to einfo.ads. * sem_ch3.adb (Analyze_Object_Contract): A source Ghost object cannot be imported or exported. Mark internally generated objects as Ghost when applicable. (Make_Class_Wide_Type): Inherit the ghostness of the root tagged type. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Mark a stand alone subprogram body as Ghost when applicable. (Analyze_Subprogram_Declaration): Mark internally generated subprograms as Ghost when applicable. * sem_ch7.adb: Code cleanup. * sem_ch13.adb (Add_Invariants): Add various formal parameters to break dependency on global variables. (Build_Invariant_Procedure): Code cleanup. Capture, set and restore the Ghost mode. * sem_res.adb (Resolve_Actuals): The actual parameter of a source Ghost subprogram whose formal is of mode IN OUT or OUT must be a Ghost variable. 2015-10-23 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch8.adb Code cleanup. (Find_Expanded_Name): Replace the call to In_Pragmas_Depends_Or_Global with a call to In_Abstract_View_Pragma. (In_Abstract_View_Pragma): New routine. (In_Pragmas_Depends_Or_Global): Removed. * sem_prag.adb (Analyze_Part_Of): Catch a case where indicator Part_Of denotes the abstract view of a variable. From-SVN: r229224
2015-10-16exp_ch3.adb (Expand_N_Full_Type_Declaration): Do not capture, set and ↵Hristian Kirtchev1-56/+28
restore the Ghost mode. 2015-10-16 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch3.adb (Expand_N_Full_Type_Declaration): Do not capture, set and restore the Ghost mode. (Expand_N_Object_Declaration): Do not capture, set and restore the Ghost mode. (Freeze_Type): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * exp_ch5.adb (Expand_N_Assignment_Statement): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * exp_ch6.adb (Expand_N_Procedure_Call_Statement): Redo the capture and restore of the Ghost mode. (Expand_N_Subprogram_Body): Redo the capture, set and restore of the Ghost mode. (Expand_N_Subprogram_Declaration): Do not capture, set and restore the Ghost mode. (Restore_Globals): Removed. * exp_ch7.adb (Expand_N_Package_Body): Redo the capture, set and restore of the Ghost mode. (Expand_N_Package_Declaration): Do not capture, set and restore the Ghost mode. * exp_ch8.adb (Expand_N_Exception_Renaming_Declaration): Redo the capture and restore of the Ghost mode. (Expand_N_Object_Renaming_Declaration): Redo the capture and restore of the Ghost mode. (Expand_N_Package_Renaming_Declaration): Redo the capture and restore of the Ghost mode. (Expand_N_Subprogram_Renaming_Declaration): Redo the capture and restore of the Ghost mode. * exp_ch11.adb Remove with and use clauses for Ghost. (Expand_N_Exception_Declaration): Do not capture, set and restore the Ghost mode. * exp_disp.adb (Make_DT): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * exp_prag.adb (Expand_Pragma_Check): Do not capture, set and restore the Ghost mode. (Expand_Pragma_Contract_Cases): Redo the capture and restore of the Ghost mode. Preserve the original context of contract cases by setting / resetting the In_Assertion_Expr counter. (Expand_Pragma_Initial_Condition): Redo the capture and restore of the Ghost mode. (Expand_Pragma_Loop_Variant): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * exp_util.adb (Make_Predicate_Call): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * freeze.adb (Freeze_Entity): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * ghost.adb (Check_Ghost_Context): Remove the RM reference from the error message. (Is_OK_Statement): Account for statements that appear in assertion expressions. (Is_Subject_To_Ghost): Moved from spec. * ghost.ads (Is_Subject_To_Ghost): Moved to body. * rtsfind.ads (Load_RTU): Redo the capture and restore of the Ghost mode. * sem.adb Add with and use clauses for Ghost. (Analyze): Redo the capture and restore of the Ghost mode. Set the Ghost mode when analyzing a declaration. (Do_Analyze): Redo the capture and restore of the Ghost mode. * sem_ch3.adb (Analyze_Full_Type_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Incomplete_Type_Decl): Do not capture, set and restore the Ghost mode. (Analyze_Number_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Object_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Private_Extension_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Subtype_Declaration): Do not capture, set and restore the Ghost mode. (Restore_Globals): Removed. * sem_ch5.adb (Analyze_Assignment): Redo the capture and restore of the Ghost mode. (Restore_Globals): Removed. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Procedure_Call): Redo the capture and restore of the Ghost mode. (Analyze_Subprogram_Body_Helper): Redo the capture and restore of the Ghost mode. (Analyze_Subprogram_Declaration): Do not capture, set and restore the Ghost mode. (Restore_Globals): Removed. * sem_ch7.adb (Analyze_Package_Body_Helper): Redo the capture and restore of the Ghost mode. (Analyze_Package_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Private_Type_Declaration): Do not capture, set and restore the Ghost mode. (Restore_Globals): Removed. * sem_ch8.adb (Analyze_Exception_Renaming): Do not capture, set and restore the Ghost mode. (Analyze_Generic_Renaming): Do not capture, set and restore the Ghost mode. (Analyze_Object_Renaming): Do not capture, set and restore the Ghost mode. (Analyze_Package_Renaming): Do not capture, set and restore the Ghost mode. (Analyze_Subprogram_Renaming): Do not capture, set and restore the Ghost mode. (Restore_Globals): Removed. * sem_ch11.adb (Analyze_Exception_Declaration): Do not capture, set and restore the Ghost mode. * sem_ch12.adb (Analyze_Generic_Package_Declaration): Do not capture, set and restore the Ghost mode. (Analyze_Generic_Subprogram_Declaration): Do not capture, set and restore the Ghost mode. * sem_ch13.adb (Build_Invariant_Procedure_Declaration): Redo the capture and restore of the Ghost mode. * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Redo the capture and restore of the Ghost mode. (Analyze_External_Property_In_Decl_Part): Redo the capture and restore of the Ghost mode. (Analyze_Initial_Condition_In_Decl_Part): Redo the capture and restore of the Ghost mode. (Analyze_Pragma): Do not capture, set and restore the Ghost mode for Assert. Redo the capture and restore of the Ghost mode for Check. Do not capture and restore the Ghost mode for Invariant. (Analyze_Pre_Post_Condition_In_Decl_Part): Redo the capture and restore of the Ghost mode. * sem_res.adb (Resolve): Capture, set and restore the Ghost mode when resolving a declaration. * sem_util.adb (Build_Default_Init_Cond_Procedure_Body): Redo the capture and restore of the Ghost mode. (Build_Default_Init_Cond_Procedure_Declaration): Redo the capture and restore of the Ghost mode. From-SVN: r228871
2015-05-27[multiple changes]Arnaud Charlet1-29/+39
2015-05-27 Robert Dewar <dewar@adacore.com> * sem_aux.adb: Minor rewording. 2015-05-27 Bob Duff <duff@adacore.com> * exp_prag.adb (Expand_Pragma_Abort_Defer): Make pragma Abort_Defer do nothing if Abort_Allowed is False. 2015-05-27 Arnaud Charlet <charlet@adacore.com> * exp_ch9.adb, sem_util.adb, sem_util.ads, s-stposu.adb, s-spsufi.ads, sem_elab.ads, g-comlin.ads, errout.ads, exp_ch6.adb, sem_ch4.adb, opt.ads, s-bignum.adb, output.ads, sem_ch13.adb, erroutc.ads, sem_disp.ads, exp_ch3.adb: Minor fixes of duplicate words in comments. 2015-05-27 Doug Rupp <rupp@adacore.com> * adaint.c (__gnat_tmp_name) [vxworks]: Robustify and use for rtp as well as kernel. 2015-05-27 Pierre-Marie de Rodat <derodat@adacore.com> * par_sco.adb (Process_Decision): Store sloc to condition/pragmas SCOs associations into a temporary table before moving them to the SCO_Raw_Hash_Table so that we can back them out just like we do for SCO entries that are simple decisions in an expression context. From-SVN: r223754
2015-05-26[multiple changes]Arnaud Charlet1-3/+4
2015-05-26 Robert Dewar <dewar@adacore.com> * exp_prag.adb, sem_ch3.adb, sem_ch5.adb, exp_ch11.adb, ghost.adb, exp_ch6.adb, sem_ch6.adb, sem_ch8.adb, sem_ch11.adb, sem_ch13.adb, exp_ch3.adb: Minor reformatting. 2015-05-26 Bob Duff <duff@adacore.com> * treepr.adb: Minor improvement to debugging routines (pp, pn) robustness. Rearrange the code so passing a nonexistent Node_Id prints "No such node" rather than crashing, and causing gdb to generate confusing messages. 2015-05-26 Gary Dismukes <dismukes@adacore.com> * sem_util.adb: Minor typo fix. 2015-05-26 Yannick Moy <moy@adacore.com> * sem_aux.adb (Subprogram_Body_Entity): Deal with subprogram stubs. From-SVN: r223685
2015-05-26exp_ch3.adb (Expand_N_Full_Type_Declaration): Capture, set and restore the ↵Hristian Kirtchev1-6/+74
Ghost mode. 2015-05-26 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch3.adb (Expand_N_Full_Type_Declaration): Capture, set and restore the Ghost mode. (Expand_N_Object_Declaration): Capture, set and restore the Ghost mode. (Freeze_Type): Update the call to Set_Ghost_Mode. (Restore_Globals): New routine. * exp_ch5.adb Add with and use clauses for Ghost. (Expand_N_Assignment_Statement): Capture, set and restore the Ghost mode. (Restore_Globals): New routine. * exp_ch6.adb Add with and use clauses for Ghost. (Expand_N_Procedure_Call_Statement): Capture, set and restore the Ghost mode. (Expand_N_Subprogram_Body): Code cleanup. Capture, set and restore the Ghost mode. (Expand_N_Subprogram_Declaration): Capture, set and restore the Ghost mode. (Restore_Globals): New routine. * exp_ch7.adb Add with and use clauses for Ghost. (Expand_N_Package_Body): Capture, set and restore the Ghost mode. (Expand_N_Package_Declaration): Capture, set and restore the Ghost mode. (Wrap_HSS_In_Block): Create a proper identifier for the block. * exp_ch8.adb Add with and use clauses for Ghost. (Expand_N_Exception_Renaming_Declaration): Code cleanup. Capture, set and restore the Ghost mode. (Expand_N_Object_Renaming_Declaration): Capture, set and restore the Ghost mode. (Expand_N_Package_Renaming_Declaration): Capture, set and restore the Ghost mode. (Expand_N_Subprogram_Renaming_Declaration): Capture, set and restore the Ghost mode. * exp_ch11.adb (Expand_N_Exception_Declaration): Code cleanup. Capture, set and restore the Ghost mode. * exp_disp.adb (Make_DT): Update the call to Set_Ghost_Mode. Do not initialize the dispatch table slot of a Ghost subprogram. * exp_prag.adb Add with and use clauses for Ghost. (Expand_Pragma_Check): Capture, set and restore the Ghost mode. (Expand_Pragma_Contract_Cases): Capture, set and restore the Ghost mode. (Expand_Pragma_Initial_Condition): Capture, set and restore the Ghost mode. (Expand_Pragma_Loop_Variant): Capture, set and restore the Ghost mode. (Restore_Globals): New routine. * exp_util.adb Add with and use clauses for Ghost. (Make_Predicate_Call): Code cleanup. Capture, set and restore the Ghost mode. (Restore_Globals): New routine. * freeze.adb (Freeze_Entity): Code cleanup. Update the call to Set_Ghost_Mode. * ghost.adb Add with and use clause for Sem_Prag. (Check_Ghost_Completion): Code cleanup. (Check_Ghost_Overriding): New routine. (Check_Ghost_Policy): Code cleanup. (Ghost_Entity): New routine. (Is_Ghost_Declaration): Removed. (Is_Ghost_Statement_Or_Pragma): Removed. (Is_OK_Context): Reimplemented. (Is_OK_Declaration): New routine. (Is_OK_Pragma): New routine. (Is_OK_Statement): New routine. (Mark_Full_View_As_Ghost): New routine. (Mark_Pragma_As_Ghost): New routine. (Mark_Renaming_As_Ghost): New routine. (Propagate_Ignored_Ghost_Code): Update the comment on usage. (Set_From_Entity): New routine. (Set_From_Policy): New routine. (Set_Ghost_Mode): This routine now handles pragmas and freeze nodes. (Set_Ghost_Mode_For_Freeze): Removed. (Set_Ghost_Mode_From_Entity): New routine. (Set_Ghost_Mode_From_Policy): Removed. * ghost.ads (Check_Ghost_Overriding): New routine. (Mark_Full_View_As_Ghost): New routine. (Mark_Pragma_As_Ghost): New routine. (Mark_Renaming_As_Ghost): New routine. (Set_Ghost_Mode): Update the parameter profile. Update the comment on usage. (Set_Ghost_Mode_For_Freeze): Removed. (Set_Ghost_Mode_From_Entity): New routine. * sem_ch3.adb (Analyze_Full_Type_Declaration): Capture and restore the Ghost mode. Mark a type as Ghost regardless of whether it comes from source. (Analyze_Incomplete_Type_Decl): Capture, set and restore the Ghost mode. (Analyze_Number_Declaration): Capture and restore the Ghost mode. (Analyze_Object_Declaration): Capture and restore the Ghost mode. (Analyze_Private_Extension_Declaration): Capture and restore the Ghost mode. (Analyze_Subtype_Declaration): Capture and restore the Ghost mode. (Process_Full_View): The full view inherits all Ghost-related attributes from the private view. (Restore_Globals): New routine. * sem_ch5.adb (Analyze_Assignment): Capture and restore the Ghost mode. (Restore_Globals): New routine. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Code cleanup. Capture and restore the Ghost mode. Mark a subprogram as Ghost regarless of whether it comes from source. (Analyze_Procedure_Call): Capture and restore the Ghost mode. (Analyze_Subprogram_Body_Helper): Capture and restore the Ghost mode. (Analyze_Subprogram_Declaration): Capture and restore the Ghost mode. (New_Overloaded_Entity): Ensure that a parent subprogram and an overriding subprogram have compatible Ghost policies. * sem_ch7.adb (Analyze_Package_Body_Helper): Capture and restore the Ghost mode. (Analyze_Package_Declaration): Capture and restore the Ghost mode. Mark a package as Ghost when it is declared in a Ghost region. (Analyze_Private_Type_Declaration): Capture and restore the Ghost mode. (Restore_Globals): New routine. * sem_ch8.adb (Analyze_Exception_Renaming): Code reformatting. Capture and restore the Ghost mode. A renaming becomes Ghost when its name references a Ghost entity. (Analyze_Generic_Renaming): Capture and restore the Ghost mode. A renaming becomes Ghost when its name references a Ghost entity. (Analyze_Object_Renaming): Capture and restore the Ghost mode. A renaming becomes Ghost when its name references a Ghost entity. (Analyze_Package_Renaming): Capture and restore the Ghost mode. A renaming becomes Ghost when its name references a Ghost entity. (Analyze_Subprogram_Renaming): Capture and restore the Ghost mode. A renaming becomes Ghost when its name references a Ghost entity. * sem_ch11.adb (Analyze_Exception_Declaration): Capture, set and restore the Ghost mode. * sem_ch12.adb (Analyze_Generic_Package_Declaration): Capture and restore the Ghost mode. (Analyze_Generic_Subprogram_Declaration): Capture and restore the Ghost mode. * sem_ch13.adb Add with and use clauses for Ghost. (Add_Invariant): New routine. (Add_Invariants): Factor out code. (Add_Predicate): New routine. (Add_Predicates): Factor out code. (Build_Invariant_Procedure_Declaration): Code cleanup. Capture, set and restore the Ghost mode. (Build_Invariant_Procedure): Code cleanup. (Build_Predicate_Functions): Capture, set and restore the Ghost mode. Mark the generated functions as Ghost. * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Capture, set and restore the Ghost mode. (Analyze_External_Property_In_Decl_Part): Capture, set and restore the Ghost mode. (Analyze_Initial_Condition_In_Decl_Part): Capture, set and restore the Ghost mode. (Analyze_Pragma): Code cleanup. Capture, set and restore the Ghost mode. Flag pragmas Linker_Section, No_Return, Unmodified, Unreferenced and Unreferenced_Objects as illegal when it applies to both Ghost and living arguments. Pragma Ghost cannot apply to synchronized objects. (Check_Kind): Moved to the spec of Sem_Prag. (Process_Inline): Flag the pragma as illegal when it applies to both Ghost and living arguments. (Restore_Globals): New routine. * sem_prag.ads Add pragma Default_Initial_Condition to table Assertion_Expression_Pragma. Add new table Is_Aspect_Specifying_Pragma. (Check_Kind): Moved from body of Sem_Prag. * sem_util.adb Add with and use clauses for Ghost. (Build_Default_Init_Cond_Procedure_Body): Capture, set and restore the Ghost mode. (Build_Default_Init_Cond_Procedure_Declaration): Capture, set and restore the Ghost mode. Mark the default initial condition procedure as Ghost when it is declared in a Ghost region. (Is_Renaming_Declaration): New routine. (Policy_In_List): Account for the single argument version of Check_Pragma. * sem_util.ads (Is_Renaming_Declaration): New routine. * sinfo.adb (Is_Ghost_Pragma): New routine. (Set_Is_Ghost_Pragma): New routine. * sinfo.ads New attribute Is_Ghost_Pragma. (Is_Ghost_Pragma): New routine along with pragma Inline. (Set_Is_Ghost_Pragma): New routine along with pragma Inline. From-SVN: r223684
2015-05-26[multiple changes]Arnaud Charlet1-2/+2
2015-05-26 Ed Schonberg <schonberg@adacore.com> * sem_ch7.adb (Install_Private_Declarations, Swap_Private_Dependents): Ensure that both views of the dependent subtype are immediately visible if we are within their scope. This may be needed when a procedure body is both the parent of an instantiated child unit, and is itself used to inline a local function. 2015-05-26 Gary Dismukes <dismukes@adacore.com> * exp_prag.adb, gnat1drv.adb: Minor reformatting. 2015-05-26 Eric Botcazou <ebotcazou@adacore.com> * exp_ch4.adb (Expand_N_Indexed_Component): In the circuit detecting exceptions to the rewriting, deal with implicit dereferences in the selected component case. 2015-05-26 Bob Duff <duff@adacore.com> * sem_ch13.adb (Analyze_One_Aspect): Do not require the expression of the Disable_Controlled aspect to be static in a generic template, because 'Enabled is not known until the instance. 2015-05-26 Doug Rupp <rupp@adacore.com> * init-vxsim.c: New file for vxsim ZCX * sigtramp-vxworks-vxsim.c: Likewise. * sigtramp-vxworks.c: Factor out target dependent bits into ... * sigtramp-vxworks-target.inc: ... here. * sigtramp.h: Add vxsim zcx protos. * init.c [vxworks...] (sysLib.h): Include. (__gnat_map_signal): Make global. [...i386] (__gnat_error_handler): Call __gnat_vxsim_error_handler if on vxsim. [...i386] (__gnat_install_handler): Test if on vxsim. 2015-05-26 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Iterator_Specification): For an element iterator over an array, if the component is aliased, the loop variable is aliased as well. 2015-05-26 Ed Schonberg <schonberg@adacore.com> * exp_ch6.adb (Expand_Actuals): For a function call with in-out parameters that is rewritten as an expression_with_actions, we preserve the original function call node for further use by the caller (typically Expand_Call). In the presence of validity checks, that function call, though it is labelled Analyzed to prevent an infinite recursion, may be rewritten as a temporary by Remove_Side_Effects. Ensure that the caller has access to the original function call to continue expansion. * atree.ads: Minor typo in comment. 2015-05-26 Javier Miranda <miranda@adacore.com> * sem_util.adb (Check_Function_Writable_Actuals): Add missing support to check the violation of writable actuals in array aggregates that have a nonstatic range. From-SVN: r223672
2015-05-26exp_ch6.adb (Process_Contract_Cases_For): Update the call to ↵Hristian Kirtchev1-407/+405
Expand_Pragma_Contract_Cases. 2015-05-26 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch6.adb (Process_Contract_Cases_For): Update the call to Expand_Pragma_Contract_Cases. * exp_prag.ads, exp_prag.adb (Expand_Contract_Cases): Rename to Expand_Pragma_Contract_Cases. * sem_ch13.adb (Add_Invariants): Use the original aspect name when creating the arguments of pragma Check. This ensures that 'Class is properly recognized and handled. From-SVN: r223671
2015-05-12[multiple changes]Arnaud Charlet1-0/+9
2015-05-12 Robert Dewar <dewar@adacore.com> * exp_prag.adb (Expand_N_Pragma): Rewrite ignored pragma as Null statements. * namet.ads (Boolean3): Document this flag used for Ignore_Pragma. * par-prag.adb (Prag): Implement Ignore_Pragma. * sem_prag.adb: Implement Ignore_Pragma. * snames.ads-tmpl: Add entries for pragma Ignore_Pragma. 2015-05-12 Javier Miranda <miranda@adacore.com> * sem_ch10.adb (Build_Shadow_Entity): Link the class-wide shadow entity with its corresponding real entity. (Decorate_Type): Unconditionally build the class-wide shadow entity of tagged types. * einfo.ads, einfo.adb (Has_Non_Limited_View): New synthesized attribute. (Non_Limited_View): Moved from field 17 to field 19 be available in class-wide entities. * exp_attr.adb (Access_Cases): Code cleanup. * exp_disp.adb (Expand_Interface_Actuals): Ditto. * exp_util.adb (Non_Limited_Designated_Type): Ditto. * freeze.adb (Build_Renamed_Bdody): Ditto. * sem_aux.adb (Available_View): Ditto. * sem_ch4.adb (Analyze_Selected_Component): Ditto. (Try_One_Prefix_Interpretation): Ditto. * sem_ch5.adb (Analyze_Assignment): Ditto. * sem_ch6.adb (Detect_And_Exchange): Ditto. * sem_ch8.adb (Find_Expanded_Name): Ditto. * sem_disp.adb (Check_Controlling_Type): Ditto. * sem_res.adb (Resolve_Type_Conversion): Ditto. (Full_Designated_Type): Ditto. * sem_type.adb (Covers): Ditto. * sem_util.adb: Fix typo in comment. From-SVN: r223038
2015-03-02[multiple changes]Arnaud Charlet1-36/+72
2015-03-02 Thomas Quinot <quinot@adacore.com> * exp_attr.adb (Expand_N_Attribute_Reference, case Input): When expanding a 'Input attribute reference for a class-wide type, do not generate a separate object declaration for the controlling tag dummy object; instead, generate the expression inline in the dispatching call. Otherwise, the declaration (which involves a call to String'Input, returning a dynamically sized value on the secondary stack) will be expanded outside of proper secondary stack mark/release operations, and will thus cause a secondary stack leak. 2015-03-02 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Add_Validity_Check): Change the names of all formal parameters to better illustrate their purpose. Update the subprogram documentation. Update all occurrences of the formal parameters. Generate a pre/postcondition pragma by calling Build_Pre_Post_Condition. (Build_PPC_Pragma): Removed. (Build_Pre_Post_Condition): New routine. * einfo.adb Node8 is no longer used as Postcondition_Proc. Node14 is now used as Postconditions_Proc. Flag240 is now renamed to Has_Expanded_Contract. (First_Formal): The routine can now operate on generic subprograms. (First_Formal_With_Extras): The routine can now operate on generic subprograms. (Has_Expanded_Contract): New routine. (Has_Postconditions): Removed. (Postcondition_Proc): Removed. (Postconditions_Proc): New routine. (Set_Has_Expanded_Contract): New routine. (Set_Has_Postconditions): Removed. (Set_Postcondition_Proc): Removed. (Set_Postconditions_Proc): New routine. (Write_Entity_Flags): Remove the output of Has_Postconditions. Add the output of Has_Expanded_Contract. (Write_Field8_Name): Remove the output of Postcondition_Proc. (Write_Field14_Name): Add the output of Postconditions_Proc. * einfo.ads New attributes Has_Expanded_Contract and Postconditions_Proc along with occurrences in entities. Remove attributes Has_Postconditions and Postcondition_Proc along with occurrences in entities. (Has_Expanded_Contract): New routine along with pragma Inline. (Has_Postconditions): Removed along with pragma Inline. (Postcondition_Proc): Removed along with pragma Inline. (Postconditions_Proc): New routine along with pragma Inline. (Set_Has_Expanded_Contract): New routine along with pragma Inline. (Set_Has_Postconditions): Removed along with pragma Inline. (Set_Postcondition_Proc): Removed along with pragma Inline. (Set_Postconditions_Proc): New routine along with pragma Inline. * exp_ch6.adb (Add_Return): Code cleanup. Update the generation of the call to the _Postconditions routine of the procedure. (Expand_Non_Function_Return): Reformat the comment on usage. Code cleanup. Update the generation of the call to the _Postconditions routine of the procedure or entry [family]. (Expand_Simple_Function_Return): Update the generation of the _Postconditions routine of the function. (Expand_Subprogram_Contract): Reimplemented. * exp_ch6.ads (Expand_Subprogram_Contract): Update the parameter profile along the comment on usage. * exp_ch9.adb (Build_PPC_Wrapper): Code cleanup. (Expand_N_Task_Type_Declaration): Generate pre/postconditions wrapper when the entry [family] has a contract with pre/postconditions. * exp_prag.adb (Expand_Attributes_In_Consequence): New routine. (Expand_Contract_Cases): This routine and its subsidiaries now analyze all generated code. (Expand_Old_In_Consequence): Removed. * sem_attr.adb Add with and use clause for Sem_Prag. (Analyze_Attribute): Reimplment the analysis of attribute 'Result. (Check_Use_In_Test_Case): Use routine Test_Case_Arg to obtain "Ensures". * sem_ch3.adb (Analyze_Declarations): Analyze the contract of a generic subprogram. (Analyze_Object_Declaration): Do not create a contract node. (Derive_Subprogram): Do not create a contract node. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Do not create a contract node. (Analyze_Completion_Contract): New routine. (Analyze_Function_Return): Alphabetize. (Analyze_Generic_Subprogram_Body): Alphabetize. Do not create a contract node. Do not copy pre/postconditions to the original generic template. (Analyze_Null_Procedure): Do not create a contract node. (Analyze_Subprogram_Body_Contract): Reimplemented. (Analyze_Subprogram_Body_Helper): Do not mark the enclosing scope as having postconditions. Do not create a contract node. Analyze the subprogram body contract of a body that acts as a compilation unit. Expand the subprogram contract after the declarations have been analyzed. (Analyze_Subprogram_Contract): Reimplemented. (Analyze_Subprogram_Specification): Do not create a contract node. (List_Inherited_Pre_Post_Aspects): Code cleanup. * sem_ch6.adb (Analyze_Subprogram_Body_Contract): Update the comment on usage. (Analyze_Subprogram_Contract): Update the parameter profile and the comment on usage. * sem_ch7.adb (Analyze_Package_Body_Helper): Do not create a contract node. (Analyze_Package_Declaration): Do not create a contract node. (Is_Subp_Or_Const_Ref): Ensure that the prefix has an entity. * sem_ch8.adb (Analyze_Subprogram_Renaming): Do not create a contract node. * sem_ch9.adb (Analyze_Entry_Declaration): Do not create a contract node. * sem_ch10.adb (Analyze_Compilation_Unit): Move local variables to their proper section and alphabetize them. Analyze the contract of a [generic] subprogram after all Pragmas_After have been analyzed. (Analyze_Subprogram_Body_Stub_Contract): Alphabetize. * sem_ch12.adb (Analyze_Generic_Package_Declaration): Do not create a contract node. (Analyze_Generic_Subprogram_Declaration): Alphabetize local variables. Do not create a contract node. Do not generate aspects out of pragmas for ASIS. (Analyze_Subprogram_Instantiation): Instantiate the contract of the subprogram. Do not create a contract node. (Instantiate_Contract): New routine. (Instantiate_Subprogram_Body): Alphabetize local variables. (Save_Global_References_In_Aspects): New routine. (Save_References): Do not save the global references found within the aspects of a generic subprogram. * sem_ch12.ads (Save_Global_References_In_Aspects): New routine. * sem_ch13.adb (Analyze_Aspect_Specifications): Do not use Original_Node for establishing linkages. (Insert_Pragma): Insertion in a subprogram body takes precedence over the case where the subprogram body is also a compilation unit. * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Use Get_Argument to obtain the proper expression. Install the generic formals when the related context is a generic subprogram. (Analyze_Depends_In_Decl_Part): Use Get_Argument to obtain the proper expression. Use Corresponding_Spec_Of to obtain the spec. Install the generic formal when the related context is a generic subprogram. (Analyze_Global_In_Decl_Part): Use Get_Argument to obtain the proper expression. Use Corresponding_Spec_Of to obtain the spec. Install the generic formal when the related context is a generic subprogram. (Analyze_Initial_Condition_In_Decl_Part): Use Get_Argument to obtain the proper expression. Remove the call to Check_SPARK_Aspect_For_ASIS as the analysis is now done automatically. (Analyze_Pragma): Update all occurrences to Original_Aspect_Name. Pragmas Contract_Cases, Depends, Extensions_Visible, Global, Postcondition, Precondition and Test_Case now carry generic templates when the related context is a generic subprogram. The same pragmas are no longer forcefully fully analyzed when the context is a subprogram that acts as a compilation unit. Pragmas Abstract_State, Initial_Condition, Initializes and Refined_State have been clean up. Pragmas Post, Post_Class, Postcondition, Pre, Pre_Class and Precondition now use the same routine for analysis. Pragma Refined_Post does not need to check the use of 'Result or the lack of a post-state in its expression. Reimplement the analysis of pragma Test_Case. (Analyze_Pre_Post_Condition): New routine. (Analyze_Pre_Post_Condition_In_Decl_Part): Reimplemented. (Analyze_Refined_Depends_In_Decl_Part): Use Get_Argument to obtain the proper expression. (Analyze_Refined_Global_In_Decl_Part): Use Get_Argument to obtain the proper expression. (Analyze_Test_Case_In_Decl_Part): Reimplemented. (Check_Pre_Post): Removed. (Check_Precondition_Postcondition): Removed. (Check_SPARK_Aspect_For_ASIS): Removed. (Check_Test_Case): Removed. (Collect_Subprogram_Inputs_Outputs): Use Get_Argument to obtain the proper expression. Use Corresponding_Spec_Of to find the proper spec. (Create_Generic_Template): New routine. (Duplication_Error): New routine. (Expression_Function_Error): New routine. (Find_Related_Subprogram_Or_Body): Moved to the spec of Sem_Prag. Emit precise error messages. Account for cases of rewritten expression functions, generic instantiations, handled sequence of statements and pragmas from aspects. (Get_Argument): New routine. (Make_Aspect_For_PPC_In_Gen_Sub_Decl): Removed. (Preanalyze_CTC_Args): Removed. (Process_Class_Wide_Condition): New routine. * sem_prag.ads (Analyze_Test_Case_In_Decl_Part): Update the parameter profile along with the comment on usage. (Find_Related_Subprogram_Or_Body): Moved from the body of Sem_Prag. (Make_Aspect_For_PPC_In_Gen_Sub_Decl): Removed. (Test_Case_Arg): New routine. * sem_util.adb Add with and use clauses for Sem_Ch6. (Add_Contract_Item): This routine now creates a contract node the first time an item is added. Remove the duplicate aspect/pragma checks. (Check_Result_And_Post_State): Reimplemented. (Corresponding_Spec_Of): New routine. (Get_Ensures_From_CTC_Pragma): Removed. (Get_Requires_From_CTC_Pragma): Removed. (Has_Significant_Contract): New routine. (Inherit_Subprogram_Contract): Inherit only if the source has a contract. (Install_Generic_Formals): New routine. (Original_Aspect_Name): Removed. (Original_Aspect_Pragma_Name): New routine. * sem_util.ads (Check_Result_And_Post_State): Reimplemented. (Corresponding_Spec_Of): New routine. (Get_Ensures_From_CTC_Pragma): Removed. (Get_Requires_From_CTC_Pragma): Removed. (Has_Significant_Contract): New routine. (Install_Generic_Formals): New routine. (Original_Aspect_Name): Removed. (Original_Aspect_Pragma_Name): New routine. * sem_warn.adb Add with and use clauses for Sem_Prag. (Within_Postcondition): Use Test_Case_Arg to extract "Ensures". From-SVN: r221101
2015-02-20exp_ch3.adb (Default_Initialize_Object): Call Add_Inlined_Body on the ↵Eric Botcazou1-6/+11
Abort_Undefer_Direct function. 2015-02-20 Eric Botcazou <ebotcazou@adacore.com> * exp_ch3.adb (Default_Initialize_Object): Call Add_Inlined_Body on the Abort_Undefer_Direct function. * exp_ch5.adb (Expand_N_Assignment_Statement): Likewise. * exp_intr.adb (Expand_Unc_Deallocation): Likewise. * exp_prag.adb (Expand_Pragma_Abort_Defer): Likewise. * exp_ch4.adb (Expand_N_Selected_Component): Adjust call to Add_Inlined_Body. * exp_ch6.adb (Expand_Call): Adjust calls to Add_Inlined_Body. Remove call to Register_Backend_Call and move code resetting Needs_Debug_Info on inlined subprograms to... * inline.ads (Add_Inlined_Body): Add N parameter. (Register_Backend_Call): Delete. * inline.adb (Add_Inlined_Body): ...here and simplify. Register the call with Backend_Calls directly. (Register_Backend_Call): Delete. * s-stalib.ads (Abort_Undefer_Direct): Restore pragma Inline. From-SVN: r220841
2014-10-17[multiple changes]Arnaud Charlet1-0/+21
2014-10-17 Robert Dewar <dewar@adacore.com> * exp_ch9.adb (Expand_N_Task_Body): Add defense against previous errors. * freeze.adb (Freeze_Entity): Add defense against checking null scope for generic. * restrict.adb (Tasking_Allowed): Add test for No_Run_Time mode. * sem_ch13.adb (Freeze_Entity_Checks): Add defense against previous errors. * sem_ch9.adb (Analyze_Task_Type_Declaration): Give error if in No_Run_Time mode. 2014-10-17 Robert Dewar <dewar@adacore.com> * prj-makr.adb: Minor reformatting. 2014-10-17 Robert Dewar <dewar@adacore.com> * gnatcmd.adb, make.adb, prj-part.adb, gnatlink.adb, prj-nmsc.adb, prj-conf.adb, prj-env.adb: Use Is_Directory_Separator where possible. 2014-10-17 Ed Schonberg <schonberg@adacore.com> * exp_prag.adb (Undo_Initialization): If Initialize_Scalars is enabled, code will be generated for some composite types to initialize an object after its declaration. If there is a subsequent Import pragma for the object, that code must be removed as specified byw the semantics of the pragma, and to prevent out-of-order elaboration issues in the back-end. 2014-10-17 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch4.adb (Expand_N_Op_Concat): Keep concatenation operator wrapping mechanism under debug flag -gnatd.h. * debug.adb: Claim debug switch -gnatd.h. From-SVN: r216384
2014-10-17[multiple changes]Arnaud Charlet1-28/+62
2014-10-17 Robert Dewar <dewar@adacore.com> * sem_attr.adb (Eval_Attribute): Ensure that attribute reference is not marked as being a static expression if the prefix evaluation raises CE. 2014-10-17 Robert Dewar <dewar@adacore.com> * exp_pakd.adb: Move bit packed entity tables to spec. * exp_pakd.ads: Move bit packed entity tables here from body. * freeze.adb (Freeze_Array_Type): Check that packed array type is supported. * rtsfind.adb (PRE_Id_Table): New table (Entity_Not_Defined): Specialize messages using PRE_Id_Table. * uintp.ads, uintp.adb (UI_Image): New functional form. 2014-10-17 Robert Dewar <dewar@adacore.com> * aspects.ads, aspects.adb: Add Suppress_Initialization aspect. * einfo.ads, einfo.adb (Suppress_Initialization): Now applies to E_Variable. * exp_ch3.adb (Default_Initialize_Object): Handle Suppress_Initialization. * exp_prag.adb (Expand_Pragma_Suppress_Initialization): New procedure (Expand_N_Pragma): Handle Suppress_Initialization (Expand_Pragma_Import_Or_Interface): Use Undo_Initialization (Undo_Initialization): New procedure. * sem_prag.adb (Analyze_Pragma, case Suppress_Initialization): This is now allowed for E_Variable case. * gnat_rm.texi: Document new aspect Suppress_Initialization Suppress_Initialization aspect/pragma can apply to variable. * einfo.ads: Minor reformatting. 2014-10-17 Arnaud Charlet <charlet@adacore.com> * spark_xrefs.ads: Add documentation pointer to Flow_Computed_Globals. 2014-10-17 Robert Dewar <dewar@adacore.com> * cstand.adb (Create_Standard): Mark Short_Integer as implementation defined. * sem_util.adb (Set_Entity_With_Checks): Avoid blow up for compiler built with assertions for No_Implementation_Identifiers test. From-SVN: r216379
2014-08-04exp_prag.adb, [...]: Minor reformatting.Robert Dewar1-2/+1
2014-08-04 Robert Dewar <dewar@adacore.com> * exp_prag.adb, sem_ch7.adb, einfo.adb, sem_prag.adb, sem_util.adb, exp_ch3.adb: Minor reformatting. From-SVN: r213553
2014-08-04[multiple changes]Arnaud Charlet1-11/+93
2014-08-04 Robert Dewar <dewar@adacore.com> * prj-strt.adb, prj-strt.ads, sem_attr.adb: Minor reformatting. 2014-08-04 Hristian Kirtchev <kirtchev@adacore.com> * aspects.adb Add an entry in table Canonical_Aspect for Default_Initial_Condition. * aspects.ads Add an entry in tables Aspect_Id, Aspect_Argument, Aspect_Names and Aspect_Delay for Default_Initial_Condition. * einfo.adb Flag3 is now Has_Default_Init_Cond. Flag132 is now Is_Default_Init_Cond_ Procedure. Flag133 is now Has_Inherited_Default_Init_Cond. (Default_Init_Cond_Procedure): New routine. (Has_Default_Init_Cond): New routine. (Has_Inherited_Default_Init_Cond): New routine. (Is_Default_Init_Cond_Procedure): New routine. (Set_Default_Init_Cond_Procedure): New routine. (Set_Has_Default_Init_Cond): New routine. (Set_Has_Inherited_Default_Init_Cond): New routine. (Set_Is_Default_Init_Cond_Procedure): New routine. (Write_Entity_Flags): Output all the new flags. * einfo.ads New attributes Default_Init_Cond_Procedure, Has_Inherited_Default_Init_Cond and Is_Default_Init_Cond_Procedure along with usage in nodes. (Default_Init_Cond_Procedure): New routine. (Has_Default_Init_Cond): New routine and pragma Inline. (Has_Inherited_Default_Init_Cond): New routine and pragma Inline. (Is_Default_Init_Cond_Procedure): New routine and pragma Inline. (Set_Default_Init_Cond_Procedure): New routine. (Set_Has_Default_Init_Cond): New routine and pragma Inline. (Set_Has_Inherited_Default_Init_Cond): New routine and pragma Inline. (Set_Is_Default_Init_Cond_Procedure): New routine and pragma Inline. * exp_ch3.adb (Expand_N_Object_Declaration): New constant Next_N. Generate a call to the default initial condition procedure if the object's type is subject to the pragma. (Freeze_Type): Generate the body of the default initial condition procedure or inherit the spec from a parent type. * exp_ch7.adb Add with and use clause for Exp_Prag. (Expand_Pragma_Initial_Condition): Removed. * exp_prag.ads, exp_prag.adb (Expand_Pragma_Initial_Condition): New routine. * par-prag.adb (Prag): Pragma Default_Initial_Condition does not need special treatment by the parser. * sem_ch3.adb (Build_Derived_Record_Type): Propagate the attributes related to pragma Default_Initial_Condition to the derived type. (Process_Full_View): Propagate the attributes related to pragma Default_Initial_Condition to the full view. * sem_ch7.adb (Analyze_Package_Specification): Build the declaration of the default initial condition procedure for all types that qualify or inherit the one from the parent type. * sem_ch13.adb (Analyze_Aspect_Specifications): Add processing for aspect Default_Initial_Condition. (Check_Aspect_At_Freeze_Point): Aspect Default_Initial_Condition does not require delayed analysis. (Replace_Type_References_Generic): Moved to spec. * sem_ch13.ads (Replace_Type_References_Generic): Moved from body. * sem_prag.adb Add an entry in table Sif_Glags for Default_Initial_Condition. (Analyze_Pragma): Pragma Default_Initial_Condition is now part of assertion policy. Add processing for pragma Default_Initial_Condition. (Is_Valid_Assertion_Kind): Pragma Default_Initial_Condition is now recognized as a proper assertion policy. * sem_util.ads, sem_util.adb (Build_Default_Init_Cond_Call): New routine. (Build_Default_Init_Cond_Procedure_Body): New routine. (Build_Default_Init_Cond_Procedure_Declaration): New routine. (Inherit_Default_Init_Cond_Procedure): New routine. * snames.ads-tmpl Add new predefined name and pragma id for Default_Initial_Condition. From-SVN: r213552
2014-07-31cstand.adb, [...]: Remove obsolete VMS-specific code.Robert Dewar1-179/+0
2014-07-31 Robert Dewar <dewar@adacore.com> * cstand.adb, einfo.adb, einfo.ads, errout.adb, exp_attr.adb, exp_prag.adb, frontend.adb, interfac.ads, par-prag.adb, s-auxdec.ads, s-filofl.ads, s-fishfl.ads, s-fvadfl.ads, s-fvaffl.ads, s-fvagfl.ads, s-vaflop.ads, sem_attr.adb, sem_attr.ads, sem_ch13.adb, sem_ch3.adb, sem_ch8.adb, sem_prag.adb, snames.adb-tmpl, snames.ads-tmpl: Remove obsolete VMS-specific code. From-SVN: r213369
2014-07-30[multiple changes]Arnaud Charlet1-1/+1
2014-07-30 Gary Dismukes <dismukes@adacore.com> * exp_prag.adb, a-tags.ads: Minor typo fixes. 2014-07-30 Bob Duff <duff@adacore.com> * a-excach.adb, a-excach-cert.adb, a-except-2005.ads, a-except.ads, g-traceb.adb, memtrack.adb, s-traceb.adb, s-traceb.ads, s-traceb-hpux.adb, s-traceb-mastop.adb: Cleanup: Make the three versions of System.Traceback.Call_Chain have the same interface. Use an array for the Traceback parameter instead of an Address. This will enable reduction in code duplication. 2014-07-30 Pat Rogers <rogers@adacore.com> * gnat_ugn.texi: Corrected minor textual error in description of switch -gnatwl. 2014-07-30 Bob Duff <duff@adacore.com> * Makefile.rtl: Sort file names. 2014-07-30 Arnaud Charlet <charlet@adacore.com> * a-tasatt.adb: Complete previous change: kill spurious warning on e.g. sparc, and make sure we only use the fast path when the alignment is compatible. 2014-07-30 Yannick Moy <moy@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Mark new Spec_Id as coming from source. From-SVN: r213275
2014-07-30[multiple changes]Arnaud Charlet1-1/+4
2014-07-30 Pat Rogers <rogers@adacore.com> * gnat_rm.texi: Minor word error. 2014-07-30 Ed Schonberg <schonberg@adacore.com> * exp_prag.adb (Expand_Old): Insert declarationss of temporaries created to capture the value of the prefix of 'Old at the beginning of the current declarative part, to prevent data flow anomalies in the postcondition procedure that will follow. 2014-07-30 Yannick Moy <moy@adacore.com> * debug.adb: Retire debug flag -gnatdQ. * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Check SPARK_Mode on decl, not on body. Ignore predicate functions. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove use of debug flag -gnatdQ. Correctly analyze SPARK_Mode on decl and body when generating a decl for a body on which SPARK_Mode aspect is given. * sem_prag.adb (Analyze_Pragma|SPARK_Mode): Reorder tests for attaching pragma to entity, to account for declaration not coming from source. * sem_res.adb (Resolve_Call): Issue warning and flag subprogram as not always inlined in GNATprove mode, when called in an assertion context. From-SVN: r213271
2014-07-30[multiple changes]Arnaud Charlet1-19/+14
2014-07-30 Vincent Celier <celier@adacore.com> * debug.adb: Minor comment update. 2014-07-30 Robert Dewar <dewar@adacore.com> * s-tasuti.adb, s-tassta.adb: Minor reformatting. * sprint.adb (Sprint_Node): Handle N_Contract case. * exp_prag.adb: Minor reformatting. * freeze.adb (Freeze_Entity): Check useless postcondition for No_Return subprogram. * sem_prag.adb: Minor reformatting. 2014-07-30 Javier Miranda <miranda@adacore.com> * a-tags.ads: Complete comments about performance. 2014-07-30 Fedor Rybin <frybin@adacore.com> * gnat_ugn.texi: Adding description for --exit-status option to gnattest section. Fixing index entry of --passed-tests option in gnattest section. 2014-07-30 Javier Miranda <miranda@adacore.com> * Makefile.rtl, gnat_rm.texi, i-cpp.adb, i-cpp.ads, impunit.adb, rtsfind.ads: Remove references to package Interfaces.CPP since this package is no longer needed. From-SVN: r213270
2014-07-16[multiple changes]Arnaud Charlet1-27/+22
2014-07-16 Eric Botcazou <ebotcazou@adacore.com> * switch-b.adb (Scan_Binder_Switches): Add missing guard. 2014-07-16 Ben Brosgol <brosgol@adacore.com> * gnat_ugn.texi: Fix typo. 2014-07-16 Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb (Expand_N_Case_Expression): Do not expand case expression if it is the specification of a subtype predicate: it will be expanded when the return statement is analyzed, or when a static predicate is transformed into a static expression for evaluation by the front-end. * sem_ch13.adb (Get_RList): If the expression for a static predicate is a case expression, extract the alternatives of the branches with a True value to create the required statically evaluable expression. 2014-07-16 Thomas Quinot <quinot@adacore.com> * exp_prag.adb (Expand_Pragma_Check): Use the location of the expression, not the location of the aspect, for all generated code, so that in particular the call to raise_assert_failure gets the sloc of the associated condition. * exp_ch6.adb (Expand_Subprogram_Contract.Build_Postconditions_Procedure): Set an explicit End_Label on the handled sequence of statements for the _Postconditions procedure so that the implicit return statement does not erroneously get associated with code generated for the last condition in postconditions. 2014-07-16 Thomas Quinot <quinot@adacore.com> * ug_words: Fix name of VMS synonym for -gnatw.z (SIZE_ALIGNMENT, not SIZE_ALIGN) and -gnatw.Z (NOSIZE_ALIGNMENT, not NOSIZE_ALIGN). * vms_data.ads: Add missing spaces in VMS synonyms for -gnatw.z / -gnatw.Z. From-SVN: r212657
2014-02-242014-02-24 Sergey Rybin <rybin@adacore.com frybin>Arnaud Charlet1-0/+1
* gnat_ugn.texi: Misc updates. 2014-02-24 Hristian Kirtchev <kirtchev@adacore.com> * exp_prag.adb (Expand_Old): Set the type of the generated temporary. 2014-02-24 Gary Dismukes <dismukes@adacore.com> * layout.adb (Layout_Variant_Record): Instantiate Generic_Check_Choices and call Check_Choices before calling Build_Discr_Checking_Funcs, since we need Others_Discrete_Choices set to prevent generating incorrect discriminant-checking functions for 'others' variants (functions that unconditionally return True rather than accounting for the values covered by the 'others' choice). * sem_eval.ads (Subtypes_Statically_Compatible): Add formal Formal_Derived_Matching. (Subtypes_Statically_Match): Add formal Formal_Derived_Matching. * sem_eval.adb (Subtypes_Statically_Compatible): Pass new Formal_Derived_Matching formal to Subtypes_Statically_Match. (Subtypes_Statically_Match): Suppress the Object_Size matching test in the case where Formal_Derived_Matching is True. * sem_ch12.adb (Validate_Derived_Type_Instance): Pass True for Formal_Derived_Matching_Formal on the call to Subtypes_Statically_Compatible. From-SVN: r208068
2014-02-20einfo.ads: Minor comment addition: Etype of package is Standard_Void_Type.Robert Dewar1-51/+51
2014-02-20 Robert Dewar <dewar@adacore.com> * einfo.ads: Minor comment addition: Etype of package is Standard_Void_Type. * checks.adb, exp_aggr.adb, exp_atag.adb, exp_attr.adb, exp_ch13.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_dbug.adb, exp_disp.adb, exp_imgv.adb, exp_intr.adb, exp_prag.adb, exp_sel.adb, exp_strm.adb, exp_util.adb, freeze.adb, rtsfind.adb, sem_aggr.adb, sem_attr.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_dim.adb, sem_prag.adb, sem_res.adb, sem_util.adb, tbuild.adb, tbuild.ads: Remove New_Reference_To. Replace all calls with calls to New_Occurrence_Of. 2014-02-20 Robert Dewar <dewar@adacore.com> * par-util.adb (Ignore, case of right paren): Make this a serious error. From-SVN: r207942
2014-02-19[multiple changes]Arnaud Charlet1-0/+641
2014-02-19 Robert Dewar <dewar@adacore.com> * exp_util.adb: Update comments. 2014-02-19 Doug Rupp <rupp@adacore.com> * bindgen.adb (Gen_Adainit) [VMS] New global Float_Format. * init.c (__gl_float_format): [VMS] New global. (__gnat_set_features): Call FP_CONTROL to set FPSR for the float representation in effect. 2014-02-19 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch6.adb Add with and use clause for Exp_Prag. (Expand_Contract_Cases): Relocated to Exp_Prag. * exp_ch6.ads (Expand_Contract_Cases): Relocated to Exp_Prag. * exp_prag.adb Add with and use clauses for Checks and Validsw. (Expand_Contract_Cases): Relocated from Exp_Ch6. Update the structure of the expanded code to showcase the evaluation of attribute 'Old prefixes. Add local variable Old_Evals. Expand any attribute 'Old references found within a consequence. Add circuitry to evaluate the prefixes of attribute 'Old that belong to a selected consequence. (Expand_Old_In_Consequence): New routine. * exp_prag.ads (Expand_Contract_Cases): Relocated from Exp_Ch6. * sem_attr.adb (Check_Use_In_Contract_Cases): Warn that a potentially unevaluated prefix is always evaluated. From-SVN: r207891
2014-01-20sem_aggr.adb, [...]: Minor reformatting.Robert Dewar1-2/+1
2014-01-20 Robert Dewar <dewar@adacore.com> * sem_aggr.adb, exp_prag.adb, sem_aux.adb, sinfo.ads, sem_ch10.adb, checks.adb, sem_prag.adb, sem_ch12.adb, freeze.adb, g-arrspl.adb, expander.adb, gnat1drv.adb, exp_ch4.adb, sem_ch6.adb, sem_ch8.adb, exp_dist.adb: Minor reformatting. From-SVN: r206813
2014-01-20sem_prag.adb (Process_Import_Or_Interface): In Relaxed_RM_Semantics, support ↵Arnaud Charlet1-1/+12
old Ada 83 style of pragma Import. 2014-01-20 Arnaud Charlet <charlet@adacore.com> * sem_prag.adb (Process_Import_Or_Interface): In Relaxed_RM_Semantics, support old Ada 83 style of pragma Import. (Analyze_Pragma): Ditto for pragma Export. * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Handle old pragma Import style. From-SVN: r206810
2013-10-17[multiple changes]Arnaud Charlet1-1/+1
2013-10-17 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Check_Dependency_Clause): Recognize the scenario where successful clause matching has depleted the available refinement items and the clause to match technically refines to null => null. 2013-10-17 Tristan Gingold <gingold@adacore.com> * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Specify External_Name instead of Link_Name for the RTTI declaration. From-SVN: r203769
2013-10-14[multiple changes]Arnaud Charlet1-22/+33
2013-10-14 Robert Dewar <dewar@adacore.com> * exp_prag.adb: Minor reformatting. 2013-10-14 Ed Schonberg <schonberg@adacore.com> * sem_case.adb (Check_Against_Predicate): Handle properly an others clause in various cases. 2013-10-14 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Check_Matching_Constituent): Do not inspect the hidden states if there are no hidden states. This case arises when the constituents are states coming from a private child. 2013-10-14 Doug Rupp <rupp@adacore.com> * init.c [ARMEL and VxWorks] (__gnat_map_signal): Re-arm guard page by clearing VALID bit vice setting page protection. 2013-10-14 Arnaud Charlet <charlet@adacore.com> * gnat_rm.texi, adaint.c: Fix typo. 2013-10-14 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Is_Variable, In_Protected_Function): In the body of a protected function, the protected object itself is a constant (not just its components). From-SVN: r203550
2013-10-14[multiple changes]Arnaud Charlet1-0/+58
2013-10-14 Vincent Celier <celier@adacore.com> * snames.ads-tmpl: Add new standard name Library_Rpath_Options. 2013-10-14 Tristan Gingold <gingold@adacore.com> * sem_prag.adb (Process_Import_Or_Interface): Allow importing of exception using convention Cpp. * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Expand cpp imported exceptions. * raise-gcc.c (is_handled_by): Filter C++ exception occurrences. * gnat_rm.texi: Document how to import C++ exceptions. 2013-10-14 Jose Ruiz <ruiz@adacore.com> * sem_ch13.adb (Sem_Ch13.Analyze_Aspect_Specification): For Priority and CPU aspects, when checking, issue a warning only if it is obviously not a main program. 2013-10-14 Tristan Gingold <gingold@adacore.com> * adaint.c: Fix condition for AIX. Minor reformatting. From-SVN: r203549