aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
AgeCommit message (Collapse)AuthorFilesLines
2018-05-23[Ada] Fix various defects found by static analysisArnaud Charlet1-0/+6
2018-05-23 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * checks.adb (Minimize_Eliminate_Overflows): Default initialize Lo and Hi. * sem_elab.adb: Make "out" parameters instead of "in out" when relevant. From-SVN: r260594
2018-05-21[Ada] Fix inconstent subprogram body headersPiotr Trojanek1-3/+3
These are GNAT style violations detected with a trivial Libadalang checker. 2018-05-21 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * ada_get_targ.adb: Fix subprogram body headers. * adabkend.adb: Likewise. * checks.adb: Likewise. * exp_ch3.adb: Likewise. * exp_ch5.adb: Likewise. * exp_ch9.adb: Likewise. * exp_dist.adb: Likewise. * exp_tss.adb: Likewise. * inline.adb: Likewise. * lib-writ.adb: Likewise. * lib-xref-spark_specific.adb: Likewise. * libgnarl/s-osinte__darwin.adb: Likewise. * libgnarl/s-stusta.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Likewise. * libgnarl/s-tposen.adb: Likewise. * libgnarl/s-vxwext__kernel-smp.adb: Likewise. * libgnarl/s-vxwext__kernel.adb: Likewise. * libgnat/a-btgbso.adb: Likewise. * libgnat/a-cfdlli.adb: Likewise. * libgnat/a-cfhama.adb: Likewise. * libgnat/a-cfinve.adb: Likewise. * libgnat/a-cimutr.adb: Likewise. * libgnat/a-coboho.adb: Likewise. * libgnat/a-cofove.adb: Likewise. * libgnat/a-cofuve.adb: Likewise. * libgnat/a-comutr.adb: Likewise. * libgnat/a-exexda.adb: Likewise. * libgnat/a-tags.adb: Likewise. * libgnat/a-tideau.adb: Likewise. * libgnat/a-wtdeau.adb: Likewise. * libgnat/a-ztdeau.adb: Likewise. * libgnat/g-alleve.adb: Likewise. * libgnat/s-excdeb.adb: Likewise. * libgnat/s-parint.adb: Likewise. * libgnat/s-shasto.adb: Likewise. * libgnat/s-traceb__hpux.adb: Likewise. * prepcomp.adb: Likewise. * sem_ch4.adb: Likewise. * sem_ch6.adb: Likewise. * sem_dist.adb: Likewise. * sem_prag.adb: Likewise. * sem_util.adb: Likewise. * sinfo.adb: Likewise. * switch.adb: Likewise. From-SVN: r260442
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-12-15exp_unst.adb (Unnest_Subprograms): Nothing to do if the main unit is a ↵Pierre-Marie de Rodat1-1/+1
generic package body. gcc/ada/ 2017-12-15 Ed Schonberg <schonberg@adacore.com> * exp_unst.adb (Unnest_Subprograms): Nothing to do if the main unit is a generic package body. Unnesting is only an issue when generating code, and if the main unit is generic then nested instance bodies have not been created and analyzed, and unnesting will crash in the absence of those bodies, 2017-12-15 Hristian Kirtchev <kirtchev@adacore.com> * inline.adb (Add_Inlined_Body): Do not add a function which is completed by an expression function defined in the same context as the initial declaration because the completing body is not in a package body. (Is_Non_Loading_Expression_Function): New routine. 2017-12-15 Hristian Kirtchev <kirtchev@adacore.com> * debug.adb: Move the functionality of -gnatdL to -gnatd_i. Restore the behavior of -gnatdL from before revision 255412. * sem_elab.adb: Update the section of compiler switches. (Build_Call_Marker): Do not create a marker for a call which originates from an expanded spec or body of an instantiated gener, does not invoke a generic formal subprogram, the target is external to the instance, and -gnatdL is in effect. (In_External_Context): New routine. (Process_Conditional_ABE_Activation_Impl): Update the uses of -gnatdL and associated flag. (Process_Conditional_ABE_Call): Update the uses of -gnatdL and associated flag. * switch-c.adb (Scan_Front_End_Switches): Switch -gnatJ now sets switch -gnatd_i. * exp_unst.adb: Minor typo fixes and edits. 2017-12-15 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Possible_Freeze): Do not set Delayed_Freeze on an subprogram instantiation, now that the enclosing wrapper package carries an explicit freeze node. THis prevents freeze nodes for the subprogram for appearing in the wrong scope. This is relevant when the generic subprogram has a private or incomplete formal type and the instance appears within a package that declares the actual type for the instantiation, and that type has itself a delayed freeze. 2017-12-15 Patrick Bernardi <bernardi@adacore.com> * doc/gnat_ugn/gnat_and_program_execution.rst: Removed references to the environment variable GNAT_STACK_LIMIT from the Stack Overflow Checking section as it is no longer used by any of our supported targets. gcc/testsuite/ 2017-12-15 Hristian Kirtchev <kirtchev@adacore.com> * gnat.dg/expr_func_main.adb, gnat.dg/expr_func_pkg.ads, gnat.dg/expr_func_pkg.adb: New testcase. 2017-12-15 Hristian Kirtchev <kirtchev@adacore.com> * gnat.dg/abe_pkg.adb, gnat.dg/abe_pkg.ads: New testcase. 2017-12-15 Ed Schonberg <schonberg@adacore.com> * gnat.dg/subp_inst.adb, gnat.dg/subp_inst_pkg.adb, gnat.dg/subp_inst_pkg.ads: New testcase. From-SVN: r255683
2017-12-05[multiple changes]Pierre-Marie de Rodat1-2/+10
2017-12-05 Olivier Hainque <hainque@adacore.com> * s-dwalin.adb (Read_And_Execute_Isn): Adjust test checking for the end of section. Add comments explaining the rationale of the computation. 2017-12-05 Bob Duff <duff@adacore.com> * exp_ch11.adb: Minor refactoring. 2017-12-05 Hristian Kirtchev <kirtchev@adacore.com> * debug.adb: Add debug switches d_a, d_e, and d_p, along with documentation. (Set_Underscored_Debug_Flag): New routine. * debug.ads: Add the flags for all underscore switches. (Set_Underscored_Debug_Flag): New routine. * einfo.adb: Flag303 is now Suppress_Elaboration_Warnings. (Suppress_Elaboration_Warnings): New routine. (Set_Suppress_Elaboration_Warnings): New routine. (Write_Entity_Flags): Add output for Suppress_Elaboration_Warnings. * einfo.ads: Add new flag Suppress_Elaboration_Warnings. (Suppress_Elaboration_Warnings): New routine along with pragma Inline. (Set_Suppress_Elaboration_Warnings): New routine along with pragma Inline. * exp_ch3.adb (Build_Init_Procedure): Restore the behavior of the legacy elaboration model. (Default_Initialize_Object): Restore the behavior of the legacy elaboration model. * exp_ch9.adb: Add with and use clause for Sem_Elab. (Build_Task_Activation_Call): Restore the behavior of the legacy elaboration model. * frontend.adb (Frontend): Restore the behavior of the legacy elaboration model. * opt.ads: Add new flags Legacy_Elaboration_Checks and Relaxed_Elaboration_Checks, along with documentation. * sem_attr.adb (Analyze_Access_Attribute): Restore the behavior of the legacy elaboration model. * sem_ch5.adb (Analyze_Assignment): Restore the behavior of the legacy elaboration model. * sem_ch7.adb (Analyze_Package_Declaration): Restore the behavior of the legacy elaboration model. * sem_ch8.adb (Attribute_Renaming): Restore the behavior of the legacy elaboration model. * sem_ch12.adb (Analyze_Instance_And_Renamings): Restore the behavior of the legacy elaboration model. (Analyze_Package_Instantiation): Restore the behavior of the legacy elaboration model. (Analyze_Subprogram_Instantiation): Restore the behavior of the legacy elaboration model. * sem_elab.adb: Update the documentation of the Processing phase. Update the documentation on elaboration-related compilation switches. Update the documentation on adding a new target. Add Processing_Attributes which represent the state of the Processing phase. Resurrect the previous elaboration model as "legacy elaboration model". (Build_Call_Marker): This routine does not function when the legacy elaboration model is in effect. Do not consider entry calls and requeue statements when debug flag d_e is in effect. Do not consider calls to subprograms which verify the runtime semantics of certain assertion pragmas when debug flag d_p is in effect. (Build_Variable_Reference_Marker): This routine does not function when the legacy elaboration model is in effect. (Check_Elaboration_Scenarios): This routine does not function when the legacy elaboration model is in effect. (Ensure_Prior_Elaboration): The various flags have now been replaced with a state. Do not generate implicit Elaborate[_All] pragmas when their creation has been suppressed. (Ensure_Prior_Elaboration_Static): The with clause is marked based on the requested pragma, not on the nature of the scenario. (In_External_Context): Removed. (Is_Assertion_Pragma_Target): New routine. (Is_Potential_Scenario): Stop the traversal of a task body when reaching an accept or select statement, and debug switch d_a is in effect. (Kill_Elaboration_Scenario): This routine does not function when the legacy elaboration model is in effect. (Process_Activation_Generic): The various flags have now been replaced with a state. (Process_Conditional_ABE): The various flags have now been replaced with a state. (Process_Conditional_ABE_Access): The various flags have now been replaced with a state. (Process_Conditional_ABE_Activation_Impl): The various flags have now been replaced with a state. Do not process an activation call which activates a task whose type is defined in an external instance, and debug switch dL is in effect. Suppress the generation of implicit Elaborate[_All] pragmas once a conditional ABE check has been installed. (Process_Conditional_ABE_Call): The various flags have now been replaced with a state. Do not process a call which invokes a subprogram defined in an external instance, and debug switch dL is in effect. (Process_Conditional_ABE_Call_Ada): The various flags have now been replaced with a state. Suppress the generation of implicit Elaborate[_All] pragmas once a conditional ABE check has been installed. (Process_Conditional_ABE_Call_SPARK): The various flags have now been replaced with a state. (Process_Conditional_ABE_Instantiation): The various flags have now been replaced with a state. (Process_Conditional_ABE_Instantiation_Ada): The various flags have now been replaced with a state. Suppress the generation of implicit Elaborate[_All] pragmas once a conditional ABE check has been installed. (Process_Conditional_ABE_Instantiation_SPARK): The various flags have now been replaced with a state. (Process_Guaranteed_ABE_Activation_Impl): The various flags have now been replaced with a state. (Process_Single_Activation): The various flags have now been replaced with a state. (Record_Elaboration_Scenario): This routine does not function when the legacy elaboration model is in effect. (Traverse_Body): The various flags have now been replaced with a state. * sem_elab.ads: Resurrect the pre-18.x elaboration model as "legacy elaboration model". * sem_prag.adb (Analyze_Pragma): Restore the behavior of the legacy elaboration model. * sem_res.adb (Resolve_Call): Restore the behavior of the legacy elaboration model. (Resolve_Entity_Name): Restore the behavior of the legacy elaboration model. * sem_util.adb (Mark_Elaboration_Attributes): This routine does not function when the legacy elaboration model is in effect. * sinfo.adb (Is_Known_Guaranteed_ABE): Update the assertion check. (No_Elaboration_Check): New routine. (Set_Is_Known_Guaranteed_ABE): Update the assertion check. (Set_No_Elaboration_Check): New routine. * sinfo.ads: Update the documentation of flag Is_Known_Guaranteed_ABE along with occurrences in nodes. Add new flag No_Elaboration_Check along with occurrences in nodes. * switch-c.adb (Scan_Front_End_Switches): Add processing for debug switches with underscores. Add processing for switches -gnatH and -gnatJ. * usage.adb (Usage): Add output for switches -gnatH and -gnatJ. * doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Update the documentation to include the legacy and relaxed elaboration models. * gnat_ugn.texi: Regenerate. 2017-12-05 Arnaud Charlet <charlet@adacore.com> * doc/gnat_ugn/platform_specific_information.rst: Minor edit. Improve doc on required packages for linux 32bits. 2017-12-05 Doug Rupp <rupp@adacore.com> * tracebak.c (ppc64-vx7): USE_GCC_UNWINDER for 64bit. 2017-12-05 Javier Miranda <miranda@adacore.com> * checks.adb (Generate_Range_Check): Force evaluation of the node in more cases. This patch was written to improve the code generated by the CCG compiler but it is enabled for all targets since double evaluation is always a potential source of inefficiency. 2017-12-05 Gary Dismukes <dismukes@adacore.com> * doc/gnat_ugn/gnat_utility_programs.rst: Remove reference to obsolete -fdump-xref switch. From-SVN: r255412
2017-11-16[multiple changes]Pierre-Marie de Rodat1-8/+17
2017-11-16 Hristian Kirtchev <kirtchev@adacore.com> * atree.ads (Nkind_In): Add 10 and 11 parameter versions. * checks.adb (Install_Primitive_Elaboration_Check): Mark the setting of the elaboration flag as elaboration code. * einfo.adb (Contract): Update the comments. (Ignore_SPARK_Mode_Pragmas): Update the comments. (SPARK_Aux_Pragma): Update the comments. (SPARK_Aux_Pragma_Inherited): Update the comments. (SPARK_Pragma): Update the comments. The attribute now applies to all types and abstract states. (SPARK_Pragma_Inherited): Update the comments. The attribute now applies to all types and abstract states. (Set_Contract): Update the comments. (Set_Ignore_SPARK_Mode_Pragmas): Update the comments. (Set_SPARK_Aux_Pragma): Update the comments. (Set_SPARK_Aux_Pragma_Inherited): Update the comments. (Set_SPARK_Pragma): Update the comments. The attribute now applies to all types and abstract states. (Set_SPARK_Pragma_Inherited): Update the comments. The attribute now applies to all types and abstract states. (Write_Field40_Name): Add output for SPARK_Pragma when it appears on a type and abstract states. * einfo.ads: Update the documentation of attributes SPARK_Pragma and SPARK_Pragma_Inherited. Both of them now apply to all types and abstract states. * exp_util.adb (Set_Elaboration_Flag): Mark the setting of the elaboration flag as elaboration code. * sem_ch3.adb: Add with and use clauses for Sem_Elab. (Analyze_Full_Type_Declaration): Set the SPARK_Mode of the type. Record a derived type for later processing by the ABE mechanism. (Analyze_Incomplete_Type_Decl): Set the SPARK_Mode of the type. (Analyze_Private_Extension_Declaration): Set the SPARK_Mode of the type. * sem_ch7.adb (Analyze_Private_Type_Declaration): Set the SPARK_Mode of the type. * sem_elab.adb: Define the term "early call region". Update the terminology for "scenario" and "target". Update the architecture of the ABE mechanism. Update the steps which must be taken when adding a new scenario. Update the section on debugging ABE issues. Add new hash tables Early_Call_Regions and Recorded_SPARK_Scenarios. Add new table SPARK_Scenarios. Hash table Elaboration_Context is now Elaboration_Statuses. The majority of Process_xxx routines have been updated to better reflect their role. (Add_Unit): Reimplemented. (Check_Elaboration_Constituent): New routine. (Check_Elaboration_Scenarios): Verify previously recorded scenarios for conditional ABE issues. Verify previously recorded SPARK scenarios. (Check_SPARK_Derived_Type): New routine. (Check_SPARK_Instantiation): New routine. (Check_SPARK_Scenario): New routine. (Check_SPARK_Refined_State_Pragma): New routine. (Early_Call_Region): New routine. (Elaboration_Status): New routine. (Ensure_Prior_Elaboration): Add new formal parameter Prag_Nam. The implicit Elabotate[_All] pragma is now specified via Prag_Nam. (Find_Early_Call_Region): New routine. (Info_Scenario): Add output for refinement constituents. (Is_Recorded_SPARK_Scenario): New routine. (Is_Suitable_SPARK_Derived_Type): New routine. (Is_Suitable_SPARK_Instantiation): New routine. (Is_Suitable_SPARK_Refined_State_Pragma): New routine. (Is_Visited_Body): New routine. (Kill_Elaboration_Scenario): Reimplemented. (Output_Active_Scenarios): Add output for pragma Refined_State. (Output_SPARK_Refined_State_Pragma): New routine. (Process_Conditional_ABE_Call): Remove the use of -gnatd.v. The effect is now achieved by different means. (Process_Conditional_ABE_Call_SPARK): Verify that a call which precedes the subprogram body appears within the early call region of the body. Either ensure the prior elaboration of external subprograms or verify that the context meets the suitable elaboration requirement. (Process_Conditional_ABE_Instantiation_SPARK): New routine. (Record_Elaboration_Scenario): Reimplement the portion which enforces the level restrictions of the static model. Add support for SPARK scenarios. (Record_SPARK_Elaboration_Scenario): New routine. (Reset_Visited_Bodies): New routine. (Set_Early_Call_Region): New routine. (Set_Elaboration_Status): New routine. (Set_Is_Recorded_SPARK_Scenario): New routine. (Update_Elaboration_Scenario): Reimplemented. * sem_elab.ads: Add new subtype Library_Or_Instantiation_Level. * sem_prag.adb (Analyze_Refined_State_In_Decl_Part): Save the pragma for examination by the ABE Processing phase. (Create_Abstract_State): Save the SPARK_Mode from the context. * sem_util.adb (Is_Non_Preelaborable_Construct): New routine. * sem_util.ads (Is_Non_Preelaborable_Construct): New routine. * sinfo.adb (Is_Elaboration_Code): New routine. (Set_Is_Elaboration_Code): New routine. (Nkind_In): Add 10 and 11 parameter versions. * sinfo.ads: Add new attribute Is_Elaboration_Code along with occurrences in nodes. (Is_Elaboration_Code): New routine along with pragma Inline. (Set_Is_Elaboration_Code): New routine along with pragma Inline. (Nkind_In): Add 10 and 11 parameter versions. 2017-11-16 Justin Squirek <squirek@adacore.com> * sem.adb (Analyze): Remove requirement that the original node of N be an operator in the case that analysis on the node yields the relevant operator - so prefer it instead. From-SVN: r254802
2017-11-09[multiple changes]Pierre-Marie de Rodat1-8/+8
2017-11-09 Yannick Moy <moy@adacore.com> * binde.adb (Diagnose_Elaboration_Problem): Mark procedure No_Return. * checks.adb (Apply_Scalar_Range_Check): Rescope variable OK closer to use. Default initialize Hi, Lo. (Selected_Range_Checks): Retype Num_Checks more precisely. (Determine_Range, Determine_Range_R): Default initialize Hi_Right, Lo_Right. * contracts.adb (Process_Contract_Cases): Mark parameter Stmts as Unmodified. (Process_Postconditions): Mark parameter Stmts as Unmodified. * exp_attr.adb (Expand_Loop_Entry_Attribute): Default initialize Blk. * exp_ch4.adb (Expand_N_Allocator): Default initialize Typ. (Expand_Concatenate): Default initialize High_Bound. (Optimize_Length_Comparison): Default initialize Ent, Index. * exp_ch5.adb (Expand_Predicated_Loop): Default initialize L_Hi and L_Lo. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Default initialize Return_Stmt. * exp_ch9.adb (Expand_Entry_Barrier): Default initialize Func_Body and remove pragma Warnings(Off). * exp_imgv.adb (Expand_Image_Attribute): Default initialize Tent. * exp_util.adb (Find_Interface_Tag): Default initialize AI_Tag. * freeze.adb (Check_Component_Storage_Order): Default initialize Comp_Byte_Aligned rather than silencing messages with pragma Warnings(Off), which does not work for CodePeer initialization messages, and given that here the possible read of an unitialized value depends on a proper use of parameters by the caller. * inline.adb (Expand_Inlined_Call): Default initialize Lab_Decl, Targ. * sem_ch12.adb (Build_Operator_Wrapper): Default initialize Expr. * sem_ch3.adb (Build_Derived_Array_Type): Default initialize Implicit_Base. * sem_ch4.adb (List_Operand_Interps): Default initialize Nam and remove pragma Warnings(Off). (Analyze_Case_Expression): Rescope checking block within branch where Others_Present is set by the call to Check_Choices. * sem_ch5.adb (Analyze_Assignment): Default initialize Save_Full_Analysis. * sem_ch6.adb (Analyze_Function_Return): Default initialize Obj_Decl, and restructure code to defend against previous errors, so that, in that case, control does not flow to the elsif condition which read an uninitialized Obj_Decl. * sem_ch9.adb (Analyze_Requeue): Default initialize Synch_Type. (Check_Interfaces): Default initialize Full_T_Ifaces and Priv_T_Ifaces, which seem to be left uninitialized and possibly read in some cases. * sem_dim.adb (Analyze_Aspect_Dimension_System): Retype Position more precisely. This requires to exchange the test for exiting in case of too many positions and the increment to Position, inside the loop. * sem_eval.adb (Eval_Concatenation): Default initialize Folded_Val, which cannot be read uninitialized, but the reasons for that are quite subtle. * sem_intr.adb (Check_Intrinsic_Call): Default initialize Rtyp. * sem_prag.adb (Collect_Subprogram_Inputs_Outputs): Default initialize Spec_Id. * sem_res.adb (Make_Call_Into_Operator): Default initialize Opnd_Type, and test for presence of non-null Opnd_Type before testing its scope, in a test which would read its value uninitialized, and is very rarely exercized (it depends on the presence of an extension of System). * sem_spark.ads: Update comment to fix name of main analysis procedure. * sem_warn.adb (Warn_On_Known_Condition): Default initialize Test_Result. * set_targ.adb (FailN): Mark procedure with No_Return. * stylesw.adb (Save_Style_Check_Options): Delete useless code to initialize all array Options to white space, as there is already code doing the same for the remaining positions in Options at the end of the procedure. 2017-11-09 Eric Botcazou <ebotcazou@adacore.com> * exp_ch11.adb (Possible_Local_Raise): Do not issue the warning for generic instantiations either. From-SVN: r254570
2017-10-14[multiple changes]Pierre-Marie de Rodat1-0/+4
2017-10-14 Ed Schonberg <schonberg@adacore.com> * doc/gnat_rm/implementation_defined_aspects.rst: Add documentation for reverse iteration over formal containers. * gnat_rm.texi: Regenerate. 2017-10-14 Hristian Kirtchev <kirtchev@adacore.com> * sem_elab.adb (Ensure_Dynamic_Prior_Elaboration): Renamed to Ensure_Prior_Elaboration_Dynamic for consistency reasons. (Ensure_Static_Prior_Elaboration): Renamed to Ensure_Prior_Elaboration_Static for consistency reasons. (Info_Variable_Reference): Renamed to Info_Variable_Read in order to reflect its new purpose. (Is_Initialized): New routine. (Is_Suitable_Variable_Reference): Renamed to Is_Suitable_Variable_Read in order to reflect its new purpose. (Is_Variable_Read): New routine. (Output_Variable_Reference): Renamed to Output_Variable_Read in order to reflect its new purpose. (Process_Variable_Assignment): This routine now acts as a top level dispatcher for variable assignments. (Process_Variable_Assignment_Ada): New routine. (Process_Variable_Assignment_SPARK): New routine. (Process_Variable_Reference): Renamed to Process_Variable_Read in order to reflects its new purpose. A reference to a variable is now suitable for ABE processing only when it is a read. The logic in the routine now reflects the latest SPARK elaboration rules. 2017-10-14 Justin Squirek <squirek@adacore.com> * sem_ch8.adb (Analyze_Subprogram_Renaming): Modify condition that triggers marking on formal subprograms. 2017-10-14 Javier Miranda <miranda@adacore.com> * checks.adb (Ensure_Valid): Do not skip adding the validity check on renamings of objects that come from the sources. 2017-10-14 Eric Botcazou <ebotcazou@adacore.com> * cstand.adb (Build_Float_Type): Move down Siz parameter, add Align parameter and set the alignment of the type to Align. (Copy_Float_Type): Adjust call to Build_Float_Type. (Register_Float_Type): Add pragma Unreferenced for Precision. Adjust call to Build_Float_Type and do not set RM_Size and Alignment. From-SVN: r253756
2017-10-09[multiple changes]Pierre-Marie de Rodat1-4/+10
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-0/+7
2017-09-08 Hristian Kirtchev <kirtchev@adacore.com> * exp_aggr.adb (Expand_Array_Aggregate): Use New_Copy_Tree instead of New_Copy because the latter leaves the syntactic structure of the tree inconsistent (a child is accessible through two parents) and prevents proper replication of itypes by subsequent calls to New_Copy_Tree. * exp_ch4.adb (Expand_Concatenate): Use New_Copy_Tree instead of New_Copy because the latter leaves the syntactic structure of the tree inconsistent (a child is accessible through two parents) and prevents proper replication of itypes by subsequent calls to New_Copy_Tree. * sem_util.adb (In_Subtree): New routine. (New_Copy_Tree): Reimplemented. * sem_util.ads (In_Subtree): New routine. (New_Copy_Tree): Reimplemented. 2017-09-08 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb (Resolve_Aspect_Expressions): The expression for aspect Default_Value is a static scalar value, but it does not freeze the type. Yhis allows for subsequent representation clauses for the type. 2017-09-08 Javier Miranda <miranda@adacore.com> * sem_ch8.adb (Find_Direct_Name.Undefined): Do not add entries into the undefined reference table when we are compiling with errors ignored. 2017-09-08 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Check_Formal_Packages): Do not apply conformance check if the instance is within an enclosing instance body. The formal package was legal in the enclosing generic, and is legal in the enclosing instantiation. This optimisation may be applicable elsewhere, and it also removes spurious errors that may arise with on-the-fly processing of instantiations that contain Inline_Always subprograms. 2017-09-08 Vincent Celier <celier@adacore.com> * gnatcmd.adb: Disregard empty argument of GNAT driver. 2017-09-08 Justin Squirek <squirek@adacore.com> * checks.adb (Insert_Valid_Check): Manually decorate the generated temporary for range valdity checks. 2017-09-08 Eric Botcazou <ebotcazou@adacore.com> * usage.adb (Usage): Document new -gnatw.q/-gnatw.Q switches. 2017-09-08 Justin Squirek <squirek@adacore.com> * switch-c.adb (Scan_Front_End_Switches): Add new warning switch case to handle underscore flags. * warnsw.adb, warnsw.ads (Set_Underscore_Warning_Switch): Create new procedure to handle underscores. From-SVN: r251893
2017-09-08[multiple changes]Arnaud Charlet1-1/+7
2017-09-08 Bob Duff <duff@adacore.com> * s-trasym.ads (Hexa_Traceback): If Suppress_Hex is True, print "..." instead of a hexadecimal address. * s-trasym.adb: Ignore No_Hex in this version. Misc cleanup. 2017-09-08 Bob Duff <duff@adacore.com> * debug.adb: Minor reformatting. 2017-09-08 Bob Duff <duff@adacore.com> * a-cbdlli.adb, a-cohama.adb, a-cohase.adb (Copy): Rewrite the code so it doesn't trigger an "uninit var" warning. 2017-09-08 Nicolas Roche <roche@adacore.com> * s-hibaen.ads: Remove obsolete file. 2017-09-08 Arnaud Charlet <charlet@adacore.com> * a-locale.ads: Add comment explaining the state of this package. 2017-09-08 Arnaud Charlet <charlet@adacore.com> * sem_util.adb (Is_CCT_Instance): Allow calls in the context of packages. * sem_prag.ads, sem_prag.adb (Find_Related_Declaration_Or_Body): allow calls in the context of package spec (for pragma Initializes) and bodies (for pragma Refined_State). 2017-09-08 Bob Duff <duff@adacore.com> * checks.adb (Insert_Valid_Check): Copy the Do_Range_Check flag to the new Exp. From-SVN: r251875
2017-09-06[multiple changes]Arnaud Charlet1-0/+14
2017-09-06 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Predicate_Check): If the expression is an aggregate that is the RHS of an assignment, apply the check to the LHS after the assignment, rather than to the aggregate. This is more efficient than creating a temporary for the aggregate, and prevents back-end crashes when the aggregate includes a dynamic "others' association. 2017-09-06 Yannick Moy <moy@adacore.com> * sem_ch12.adb (Analyze_Instance_And_Renamings): Set variable to ignore SPARK_Mode in instance before the analysis of the generated package declaration. 2017-09-06 Yannick Moy <moy@adacore.com> * sem_res.adb (Resolve_Call): Do not issue a message for calls inside expression function, unless body was seen and is candidate for inlining. 2017-09-06 Ed Schonberg <schonberg@adacore.com> * sem_aux.adb (Is_Generic_Formal): Handle properly formal packages. * sem_ch3.adb (Analyze_Declarations): In a generic subprogram body. do not freeze the formals of the generic unit. 2017-09-06 Gary Dismukes <dismukes@adacore.com> * errout.adb (Error_Msg): Separate the treatment for warning vs. style messages in inlinings and instantiations. Prevents blowups on calls to Warn_Insertion for style messages, which should not be called in that case because Warning_Msg_Char is not set. 2017-09-06 Justin Squirek <squirek@adacore.com> * sem_prag.adb (Check_VFA_Conflicts): Created to group all Volatile_Full_Access checks relating to other representation pragmas (Mark_Component_Or_Object): Created to centeralize the flagging of attributes for the record type component case, a pragma applied individually to a component, and the object case. (Process_Atomic_Independent_Shared_Volatile): Add propagation of certain pragmas to record components and move evaluation of VFA checks From-SVN: r251793
2017-09-06[multiple changes]Arnaud Charlet1-26/+4
2017-09-06 Ed Schonberg <schonberg@adacore.com> * einfo.adb (Designated_Type): Use Is_Incomplete_Type to handle properly incomplete subtypes that may be created by explicit or implicit declarations. (Is_Base_Type): Take E_Incomplete_Subtype into account. (Subtype_Kind): Ditto. * sem_ch3.adb (Build_Discriminated_Subtype): Set properly the Ekind of a subtype of a discriminated incomplete type. (Fixup_Bad_Constraint): Use Subtype_Kind in all cases, including incomplete types, to preserve error reporting. (Process_Incomplete_Dependents): Do not create a subtype declaration for an incomplete subtype that is created internally. * sem_ch7.adb (Analyze_Package_Specification): Handle properly incomplete subtypes that do not require a completion, either because they are limited views, of they are generic actuals. 2017-09-06 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Remove the suspicious manipulation of the Do_Range_Check flag as ths is no linger needed. Suppress validity check when analysing the validation variable. 2017-09-06 Philippe Gil <gil@adacore.com> * g-debpoo.adb: adapt GNAT.Debug_Pools to allow safe thread GNATCOLL.Memory 2017-09-06 Bob Duff <duff@adacore.com> * sem_elim.adb: Minor comment fix. 2017-09-06 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Is_Object_Reference): A function call is an object reference, and thus attribute references for attributes that are functions (such as Pred and Succ) as well as predefined operators are legal in contexts that require an object, such as the prefix of attribute Img and the Ada2020 version of 'Image. From-SVN: r251759
2017-07-25gimple.c (gimple_assign_set_rhs_with_ops): Do not ask gsi_replace to update ↵Eric Botcazou1-0/+7
EH info here. * gimple.c (gimple_assign_set_rhs_with_ops): Do not ask gsi_replace to update EH info here. ada/ * checks.adb (Apply_Divide_Checks): Ensure that operands are not evaluated twice. From-SVN: r250525
2017-05-02Minor reformatting.Arnaud Charlet1-26/+24
From-SVN: r247476
2017-05-02[multiple changes]Arnaud Charlet1-15/+31
2017-05-02 Eric Botcazou <ebotcazou@adacore.com> * atree.h (Flag290): Add missing terminating parenthesis. * einfo.adb (Is_Class_Wide_Clone): Use Flag290. (Set_Is_Class_Wide_Clone): Likewise. * einfo.ads (Is_Class_Wide_Clone): Likewise. 2017-05-02 Gary Dismukes <dismukes@adacore.com> * checks.ads (Null_Exclusion_Static_Checks): Add Boolean parameter Array_Comp to indicate the case of an array object with null-excluding components. * checks.adb (Null_Exclusion_Static_Checks): Call Compile_Time_Constraint_Error instead of Apply_Compile_Time_Constraint_Error in the component case. Also call that when Array_Comp is True, with an appropriate warning for the array component case. Only create an explicit initialization by null in the case of an object of a null-excluding access type (and no longer do that in the component case). * sem_ch3.adb (Check_Component): Add a Boolean parameter Array_Comp defaulted to False. Pass Empty for the Comp actual when calling Null_Exclusion_Static_Checks in the case where Comp_Decl matches Object_Decl, because we don't have a component in that case. In the case of an object or component of an array type, pass True for Array_Comp on the recursive call to Check_Component. From-SVN: r247474
2017-05-02[multiple changes]Arnaud Charlet1-1/+6
2017-05-02 Eric Botcazou <ebotcazou@adacore.com> * opt.ads: Add missing GNAT markers in comments. * opt.adb (Set_Opt_Config_Switches): Do not override earlier settings of Optimize_Alignment at the end. 2017-05-02 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Apply_Constraint_Check): Do not apply a discriminant check when the associated type is a constrained subtype created for an unconstrained nominal type. * exp_attr.adb: Minor reformatting. 2017-05-02 Bob Duff <duff@adacore.com> * sem_ch3.adb (OK_For_Limited_Init_In_05): Handle correctly the N_Raise_Expression case. * sem_ch6.adb (Check_Limited_Return): Minor: clarify comment, and add assertions. 2017-05-02 Yannick Moy <moy@adacore.com> * exp_ch4.adb (Expand_N_Op_Ne): Do not bump parenthese level and optimize length comparison in GNATprove mode. * exp_spark.adb (Expand_SPARK_Op_Ne): New function to rewrite operator /= into negation of operator = when needed. (Expand_SPARK): Call new function to expand operator /=. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_fixd.adb (Expand_Divide_Fixed_By_Fixed_Giving_Fixed): Simplify the expression for a fixed-fixed division to remove divisions by constants whenever possible, as an optimization for restricted targets. From-SVN: r247468
2017-05-02[multiple changes]Arnaud Charlet1-3/+5
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb, sem_ch3.adb, sem_ch6.adb: Minor reformatting. 2017-05-02 Bob Duff <duff@adacore.com> * exp_attr.adb (Callable, Identity, Terminated): Use Find_Prim_Op to find primitive ops, instead of using an Identifier that will later be looked up. This is necessary because these ops are not necessarily visible at all places where we need to call them. * exp_util.ads: Minor comment fix. From-SVN: r247466
2017-05-02[multiple changes]Arnaud Charlet1-6/+25
2017-05-02 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Fully_Conformant_Expressions): Two entity references are fully conformant if they are both expansions of the discriminant of a protected type, within one of the protected operations. One occurrence may be expanded into a constant declaration while the other is an input parameter to the corresponding generated subprogram. 2017-05-02 Justin Squirek <squirek@adacore.com> * sem_ch3.adb (Check_For_Null_Excluding_Components): Created for recursivly searching composite-types for null-excluding access types and verifying them. (Analyze_Object_Declaration): Add a call to Check_Null_Excluding_Components for static verification of non-initialized objects. * checks.adb, checks.ads (Null_Exclusion_Static_Checks): Added a parameter for a composite-type's component and an extra case for printing component information. 2017-05-02 Yannick Moy <moy@adacore.com> * sem_ch10.adb (Analyze_Subunit): Take configuration pragma into account when restoring appropriate pragma for analysis of subunit. 2017-05-02 Justin Squirek <squirek@adacore.com> * s-tasren.adb, s-tasini.adb, s-taprop-linux.adb, s-mudido-affinity.adb,, a-exetim-posix.adb, a-direio.adb, g-socket.adb, s-taenca.adb, s-fileio.adb: Remove unused use-type clauses from the runtime. From-SVN: r247465
2017-04-28[multiple changes]Arnaud Charlet1-2/+8
2017-04-28 Bob Duff <duff@adacore.com> * sem_util.ads, sem_util.adb (Might_Raise): New function that replaces Is_Exception_Safe, but has the opposite sense. Is_Exception_Safe was missing various cases -- calls inside a pragma Debug, calls inside an 'if' or assignment statement, etc. Might_Raise now walks the entire subtree looking for things that can raise. * exp_ch9.adb (Is_Exception_Safe): Remove. (Build_Protected_Subprogram_Body): Replace call to Is_Exception_Safe with "not Might_Raise". Misc cleanup (use constants where possible). * exp_ch7.adb: Rename Is_Protected_Body --> Is_Protected_Subp_Body. A protected_body is something different in the grammar. 2017-04-28 Eric Botcazou <ebotcazou@adacore.com> * inline.adb (Expand_Inlined_Call): Initialize Targ1 variable. * par-ch3.adb (P_Component_Items): Initialize Decl_Node variable. (P_Discrete_Choice_List): Initialize Expr_Node variable. * par-ch9.adb (P_Task): Initialize Aspect_Sloc variable. (P_Protected): Likewise. * sem_case.adb (Check_Duplicates): Add pragma Warnings on variable. * sem_ch12.adb (Preanalyze_Actuals): Initialize Vis variable. * sem_ch4.adb (List_Operand_Interps): Add pragma Warnings on variable. * sem_ch5.adb (Analyze_Assignment): Initialize Save_Full_Analysis. (Analyze_Exit_Statement): Initialize Scope_Id variable. (Analyze_Iterator_Specification): Initialize Bas variable. * sem_ch9.adb (Allows_Lock_Free_Implementation): Initialize Error_Count (Satisfies_Lock_Free_Requirements): Likewise. (Analyze_Accept_Statement): Initialize Task_Nam. 2017-04-28 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Install_Primitive_Elaboration_Check): Do not generate an elaboration check if all checks have been suppressed. 2017-04-28 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb (Analyze_Aspect_Specifications, case Interrupt_Handler and Attach_Handler): Generate reference to protected operation to prevent spurious warnings about unreferenced entities. Previous scheme failed with style checks enabled. 2017-04-28 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Relocate_Pragmas_To_Body): A pragma Warnings that follows an expression function must not be relocated to the generated body, because it applies to the code that follows. From-SVN: r247387
2017-04-27[multiple changes]Arnaud Charlet1-1/+5
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * sem_eval.adb (Subtypes_Statically_Compatible): Remove duplicated check. (Subtypes_Statically_Match): Remove duplicate check. * sem_prag.adb (Check_Arg_Is_External_Name): Remove duplicate check. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * exp_aggr.adb (Replace_Type): Remove the special processing for selected components. * exp_attr.adb (Expand_N_Attribute_Reference): Merge the processing for attributes Fixed_Value and Integer_Value. * exp_util.adb (Side_Effect_Free): Merge the processing for qualified expressions, type conversions, and unchecked type conversions. * g-comlin.adb (Is_In_Config): Merge the processing for No_Space and Optional. * par-ch3.adb (P_Declarative_Items): Merge the processing for tokens function, not, overriding, and procedure. * sem_ch6.adb (Fully_Conformant_Expressions): Merge the processing for qualified expressions, type conversions, and unchecked type conversions. * sem_util.adb (Compile_Time_Constraint_Error): Merge the processing for Ada 83 and instances. (Object_Access_Level): Merge the processing for indexed components and selected components. * uname.adb (Add_Node_Name): Merge the processing for stubs. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Install_Primitive_Elaboration_Check): Do not generate the check when restriction No_Elaboration_Code is in effect. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * exp_disp.adb (Build_Class_Wide_Check): New subsidiary of Expand_Dispatching_Call. If the denoted subprogram has a class-wide precondition, this is the only precondition that applies to the call, rather that the class-wide preconditions that may apply to the body that is executed. (This is specified in AI12-0195). From-SVN: r247333
2017-04-27[multiple changes]Arnaud Charlet1-0/+198
2017-04-27 Yannick Moy <moy@adacore.com> * sem_res.adb: Remove duplicate code. * sem_attr.adb: Delete duplicate code. 2017-04-27 Bob Duff <duff@adacore.com> * g-dyntab.adb: Reduce the amount of copying in Release. No need to copy items past Last. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb Add with and use clauses for Sem_Disp. (Install_Primitive_Elaboration_Check): New routine. * checks.ads (Install_Primitive_Elaboration_Check): New routine. * exp_attr.adb (Expand_N_Attribute_Reference): Clean up the processing of 'Elaborated. * exp_ch6.adb (Expand_N_Subprogram_Body): Install a primitive elaboration check. From-SVN: r247330
2017-04-27[multiple changes]Arnaud Charlet1-2/+4
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * sem_elab.adb Add new type Visited_Element and update the contents of table Elab_Visited. Various code clean up. (Check_Elab_Call): Determine whether a prior call to the same subprogram was already examined within the same context. (Check_Internal_Call_Continue): Register the subprogram being called as examined within a particular context. Do not suppress elaboration warnings. 2017-04-27 Gary Dismukes <dismukes@adacore.com> * xoscons.adb, osint.ads: Minor reformatting. 2017-04-27 Bob Duff <duff@adacore.com> * g-dyntab.ads, g-dyntab.adb: Misc cleanup. Rename Table_Count_Type --> Table_Last_Type, because the name was confusing (a "count" usually starts at zero). Add functionality supported or needed by other tables packages (Move, Release_Threshold). * g-table.ads, g-table.adb: This is now just a thin wrapper around g-dyntab.ads/g-dyntab.adb. Add functionality supported or needed by other tables packages (Save, Restore). * table.ads, table.adb: This is now just a thin wrapper around * g-table.ads/g-table.adb. * namet.h, scos.h, uintp.h: These files are reaching into the private data of some instances of g-table, whose names changed, so the above change requires some adjustment here. It now uses public interfaces. 2017-04-27 Bob Duff <duff@adacore.com> * namet.adb, namet.ads: Minor: remove unused procedures. 2017-04-27 Eric Botcazou <ebotcazou@adacore.com> * checks.adb (Apply_Scalar_Range_Check): Initialize Ok variable too. (Minimize_Eliminate_Overflows): Initialize Llo and Lhi. Add pragma Warnings on Rtype variable in nested block. * * exp_ch3.adb (Build_Init_Statements): Initialize VAR_LOC. * exp_ch4.adb (Expand_Concatenate): Initialize 3 variables. (Size_In_Storage_Elements): Add pragma Warnings on Res variable. * exp_ch7.adb (Build_Adjust_Statements): Initialize Bod_Stmts. (Process_Component_List_For_Finalize): Initialize Counter_Id. (Build_Finalize_Statements): Initialize Bod_Stmts. * exp_disp.adb (Expand_Dispatching_Call): Initialize SCIL_Node. 2017-04-27 Claire Dross <dross@adacore.com> * a-cfhama.adb, a-cfhamai.ads (=): Generic parameter removed to allow the use of regular equality over elements in contracts. (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. (No_Overlap): Removed, model functions should be used instead. (Equivalent_Keys): Functions over cursors are removed. They were awkward with explicit container parameters. * a-cofuma.adb, a-cofuma.ads (Lift_Equivalent_Keys): New lemma (proof only) procedure to help GNATprove when equivalence over keys is not equality. From-SVN: r247320
2017-04-27[multiple changes]Arnaud Charlet1-11/+0
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Generate_Range_Check): Revert previous change. 2017-04-27 Gary Dismukes <dismukes@adacore.com> * sem_util.adb: Minor reformatting/rewording. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * lib-xref.adb (Generate_Reference): The use of attribute 'Result is not considered a violation of pragma Unreferenced. 2017-04-27 Justin Squirek <squirek@adacore.com> * cstand.adb (Create_Standard): Correctly set Directly_Designated_Type for Any_Access. * sem_type.adb (Covers): Minor grammar fixes. 2017-04-27 Bob Duff <duff@adacore.com> * sem_attr.adb: Minor cleanup. 2017-04-27 Claire Dross <dross@adacore.com> * a-cofuba.ads, a-cofuba.adb (Ada.Containers.Functional_Base): New private child of Ada.Containers used to implement all functional containers. * a-cofuma.ads, a-cofuma.adb (Ada.Containers.Functional_Maps): New child of Ada.Containers. It provides functional indefinite unbounded maps which can be used as high level models for specification of data structures. * a-cofuse.ads, a-cofuse.adb (Ada.Containers.Functional_Sets): New child of Ada.Containers. It provides functional indefinite unbounded sets which can be used as high level models for specification of data structures. * a-cofuve.ads, a-cofuve.adb (Ada.Containers.Functional_Vectors): New child of Ada.Containers. It provides functional indefinite unbounded vectors which can be used as high level models for specification of data structures. * Makefile.rtl: Add new packages. * impunit.adb: Add new packages. From-SVN: r247296
2017-04-27[multiple changes]Arnaud Charlet1-0/+11
2017-04-27 Gary Dismukes <dismukes@adacore.com> * sem_ch4.adb: Minor reformatting. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Analyze_Associations): minor reformatting. (Check_Fixed_Point_Actual): Do not emit a warning on a fixed point type actual that has user-defined arithmetic primitives, when there is a previous actual for a formal package that defines a fixed-point type with the parent user-defined operator. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Generate_Range_Check): Reinstate part of previous change. * sem_attr.adb (Resolve_Attribute): Generate a range check when the component type allows range checks. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * sem_aux.adb (Is_Generic_Formal): Use original node to locate corresponding declaration, because formal derived types are rewritten as private extensions. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * sem_dim.adb (Analyze_Dimension_Binary_Op): Do not check dimensions of operands if node has been analyzed already, because previous analysis and dimension checking will have removed the dimension information from the operands. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * debug.adb: Document the use of switch -gnatd.s. * einfo.ads Update the documentation on attribute Sec_Stack_Needed_For_Return and attribute Uses_Sec_Stack. Remove the uses of these attributes from certain entities. * exp_ch7.adb (Make_Transient_Block): Reimplement the circuitry which determines whether the block should continue to manage the secondary stack. (Manages_Sec_Stack): New routine. 2017-04-27 Bob Duff <duff@adacore.com> * atree.ads: Minor edit. 2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * sinfo.ads: Update the section on Ghost mode. Add a section on SPARK mode. Update the placement of section on expression functions. 2017-04-27 Bob Duff <duff@adacore.com> * sinput.adb (Get_Source_File_Index): Don't assert that S is in the right range in the case where this is a .dg file under construction. 2017-04-27 Yannick Moy <moy@adacore.com> * sem_util.adb (Check_Result_And_Post_State): Handle more precisely each conjunct in expressions formed by and'ing sub-expressions. From-SVN: r247295
2017-04-25[multiple changes]Arnaud Charlet1-11/+0
2017-04-25 Arnaud Charlet <charlet@adacore.com> * exp_ch4.adb (Expand_N_Case_Expression): Emit error message when generating C code on complex case expressions. 2017-04-25 Arnaud Charlet <charlet@adacore.com> * sem_prag.adb (Analyze_Pragma): Generate a warning instead of silently ignoring pragma Ada_xxx in Latest_Ada_Only mode. * directio.ads, ioexcept.ads, sequenio.ads, text_io.ads: Use Ada_2012 instead of Ada_2005 to be compatible with the above change. * bindgen.adb: Silence new warning on pragma Ada_95. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Generate_Range_Check): Revert part of previous change. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Try_Container_Indexing): Handle properly a container indexing operation that appears as a an actual in a parameter association in a procedure call. 2017-04-25 Olivier Ramonat <ramonat@adacore.com> * prj-proc.adb, sem_util.adb, s-stposu.adb, sem_attr.adb, prj-conf.ads: Fix spelling mistakes. 2017-04-25 Bob Duff <duff@adacore.com> * types.ads, osint.adb, sinput-c.adb, sinput-d.adb, sinput-l.adb, * sinput-p.adb: Use regular fat pointers, with bounds checking, for source buffers. Fix misc obscure bugs. * sinput.ads, sinput.adb: Use regular fat pointers, with bounds checking, for source buffers. Modify representation clause for Source_File_Record as appropriate. Move Source_File_Index_Table from spec to body, because it is not used outside the body. Move Set_Source_File_Index_Table into the private part, because it is used only in the body and in children. Use trickery to modify the dope in the generic instantiation case. It's ugly, but not as ugly as the previous method. Fix documentation. Remove obsolete code. * fname-sf.adb, targparm.adb: Fix misc out-of-bounds indexing in source buffers. * fmap.adb: Avoid conversions from one string type to another. Remove a use of global name buffer. * osint.ads, sfn_scan.ads, sfn_scan.adb, sinput-c.ads: Comment fixes. From-SVN: r247252
2017-04-25[multiple changes]Arnaud Charlet1-20/+36
2017-04-25 Gary Dismukes <dismukes@adacore.com> * exp_util.adb, exp_ch4.adb: Minor reformatting. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb: Code clean up in various routines. (Generate_Range_Check): Do not generate a range check when the expander is not active or when index/range checks are suppressed on the target type. (Insert_List_After_And_Analyze, Insert_List_Before_And_Analyze): Remove variants that include a Supress parameter. These routines are never used, and were introduced before the current scope-based check suppression method. 2017-04-25 Vasiliy Fofanov <fofanov@adacore.com> * prj-part.adb, cstreams.c, osint.adb, osint.ads: Remove VMS specific code and some subprogram calls that are now noop. From-SVN: r247242
2017-04-25checks.adb (Insert_Valid_Check): Code cleanup.Hristian Kirtchev1-17/+18
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Code cleanup. * exp_ch6.adb (Add_Validation_Call_By_Copy_Code): New routine. (Expand_Actuals): Generate proper copy-back for a validation variable when it acts as the argument of a type conversion. * sem_util.adb (Is_Validation_Variable_Reference): Augment the predicate to operate on type qualifications. From-SVN: r247180
2017-04-25[multiple changes]Arnaud Charlet1-14/+18
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb, checks.adb, sem_prag.adb, eval_fat.adb: Minor reformatting. 2017-04-25 Bob Duff <duff@adacore.com> * binde.adb (Validate): Do not pass dynamic strings to pragma Assert, because older compilers do not support that. 2017-04-25 Bob Duff <duff@adacore.com> * s-fileio.adb (Close): When a temp file is closed, delete it and clean up its Temp_File_Record immediately, rather than waiting until later. (Temp_File_Record): Add File component, so Close can know which Temp_File_Record corresponds to the file being closed. (Delete): Don't delete temp files, because they are deleted by Close. (Open): Set the File component of Temp_File_Record. This requires moving the creation of the Temp_File_Record to the end, after the AFCB has been created. From-SVN: r247175
2017-04-25[multiple changes]Arnaud Charlet1-4/+8
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Do not generate a validity check when inside a generic. 2017-04-25 Yannick Moy <moy@adacore.com> * sem_res.adb (Resolve_Type_Conversion): Fix bad logic. 2017-04-25 Arnaud Charlet <charlet@adacore.com> * snames.ads-tmpl (Snames): More names for detecting predefined potentially blocking subprograms. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Analyze_Pre_Post_Condition): The rules concerning inheritance of class-wide preconditions do not apply to postconditions. 2017-04-25 Bob Duff <duff@adacore.com> * s-ficobl.ads: Minor comment fix. From-SVN: r247174
2017-04-25checks.adb (Apply_Scalar_Range_Check): Analyze precisely conversions from ↵Yannick Moy1-9/+72
float to integer in GNATprove mode. 2017-04-25 Yannick Moy <moy@adacore.com> * checks.adb (Apply_Scalar_Range_Check): Analyze precisely conversions from float to integer in GNATprove mode. (Apply_Type_Conversion_Checks): Make sure in GNATprove mode to call Apply_Type_Conversion_Checks, so that range checks are properly positioned when needed on conversions, including when converting from float to integer. (Determine_Range): In GNATprove mode, take into account the possibility of conversion from float to integer. * sem_res.adb (Resolve_Type_Conversion): Only enforce range check on conversions from fixed-point to integer, not anymore on conversions from floating-point to integer, when in GNATprove mode. From-SVN: r247173
2017-04-25checks.adb (Determine_Range_R): Special case type conversions from integer ↵Yannick Moy1-4/+26
to float in order to get bounds in... 2017-04-25 Yannick Moy <moy@adacore.com> * checks.adb (Determine_Range_R): Special case type conversions from integer to float in order to get bounds in that case too. * eval_fat.adb (Machine): Avoid issuing warnings in GNATprove mode, for computations involved in interval checking. From-SVN: r247172
2017-04-25[multiple changes]Arnaud Charlet1-30/+71
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Partially reimplement validity checks. * einfo.adb Node36 is now used as Validated_Object. (Validated_Object): New routine. (Set_Validated_Object): New routine. (Write_Field36_Name): Add an entry for Validated_Object. * einfo.ads Add new attribute Validated_Object along with usage in entities. (Validated_Object): New routine along with pragma Inline. (Set_Validated_Object): New routine along with pragma Inline. * exp_attr.adb (Make_Range_Test): Add processing for validation variables to avoid extra reads and copies of the prefix. * exp_ch6.adb (Expand_Actuals): Add copy-back for validation variables in order to reflect any changes done in the variable back into the original object. * sem_util.adb (Is_Validation_Variable_Reference): New routine. * sem_util.ads (Is_Validation_Variable_Reference): New routine. 2017-04-25 Steve Baird <baird@adacore.com> * exp_ch7.adb (Build_Array_Deep_Procs, Build_Record_Deep_Procs, Make_Finalize_Address_Body): Don't generate Finalize_Address routines for CodePeer. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Inherits_Class_Wide_Pre): subsidiary of Analyze_Pre_Post_Condition, to implement the legality checks mandated by AI12-0131: Pre'Class shall not be specified for an overriding primitive subprogram of a tagged type T unless the Pre'Class aspect is specified for the corresponding primitive subprogram of some ancestor of T. From-SVN: r247170
2017-04-25[multiple changes]Arnaud Charlet1-4/+5
2017-04-25 Tristan Gingold <gingold@adacore.com> * s-mmap.ads (Data): Add pragma Inline. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Do not use a renaming to alias a volatile name because this will lead to multiple evaluations of the volatile name. Use a constant to capture the value instead. 2017-04-25 Doug Rupp <rupp@adacore.com> * init.c [VxWorks Section]: Disable sigtramp for ppc64-vx7. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * exp_util.adb, exp_util.ads (Build_Class_Wide_Expression): Add out parameter to indicate to caller that a wrapper must be constructed for an inherited primitive whose inherited pre/postcondition has called to overridden primitives. * freeze.adb (Check_Inherited_Conditions): Build wrapper body for inherited primitive that requires it. * sem_disp.adb (Check_Dispatching_Operation): Such wrappers are legal primitive operations and belong to the list of bodies generated after the freeze point of a type. * sem_prag.adb (Build_Pragma_Check_Equivalent): Use new signature of Build_Class_Wide_Expression. * sem_util.adb, sem_util.ads (Build_Overriding_Spec): New procedure to construct the specification of the wrapper subprogram created for an inherited operation. From-SVN: r247140
2017-01-23[multiple changes]Arnaud Charlet1-0/+3
2017-01-23 Gary Dismukes <dismukes@adacore.com> * exp_strm.ads: Minor reformatting and typo fixes. 2017-01-23 Hristian Kirtchev <kirtchev@adacore.com> * sem_aggr.adb, par_sco.adb, exp_util.adb, sem.adb, sem_ch4.adb, exp_aggr.adb: Minor reformatting. * g-diopit.adb: minor grammar/punctuation fix in comment. * g-byorma.ads: minor fix of unbalanced parens in comment. 2017-01-23 Hristian Kirtchev <kirtchev@adacore.com> * par.adb: Update the documentation of component Labl. * par-ch6.adb (P_Return_Statement): Set the expected label of an extended return statement to Error. 2017-01-23 Tristan Gingold <gingold@adacore.com> * s-boustr.ads, s-boustr.adb (Is_Full): New function. 2017-01-23 Ed Schonberg <schonberg@adacore.com> * expander.adb: Handle N_Delta_Aggregate. 2017-01-23 Javier Miranda <miranda@adacore.com> * exp_ch6.adb (Expand_Call): Improve the code that checks if some formal of the called subprogram is a class-wide interface, to handle subtypes of class-wide interfaces. 2017-01-23 Javier Miranda <miranda@adacore.com> * checks.adb (Apply_Parameter_Aliasing_Checks): Remove side effects of the actuals before generating the overlap check. From-SVN: r244806
2017-01-23[multiple changes]Arnaud Charlet1-1/+7
2017-01-23 Pascal Obry <obry@adacore.com> * s-taprop-mingw.adb (Enter_Task): Initialize the Thread handle which is needed when a foreign thread call a Win32 API using a thread handle like GetThreadTimes() for example. 2017-01-23 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not allow an 'Address clause to be specified on a prefix of a class-wide type. 2017-01-23 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Ensure that the prefix of attribute 'Valid is a renaming of the original expression when the expression denotes a name. For all other kinds of expression, use a constant to capture the value. * exp_util.adb (Is_Name_Reference): Moved to Sem_Util. * sem_util.ads, sem_util.adb (Is_Name_Reference): Moved from Exp_Util. 2017-01-23 Justin Squirek <squirek@adacore.com> * sem_eval.adb (Eval_Integer_Literal): Add special case to avoid optimizing out check if the literal appears in an if-expression. From-SVN: r244792
2017-01-23[multiple changes]Arnaud Charlet1-4/+4
2017-01-23 Eric Botcazou <ebotcazou@adacore.com> * checks.adb: Minor fix in comment. 2017-01-23 Philippe Gil <gil@adacore.com> * g-debpoo.adb (Do_Report) remove freed chunks from chunks count in Sort = Memory_Usage or Allocations_Count 2017-01-23 Justin Squirek <squirek@adacore.com> * sem_ch3.adb: Code cleanup. 2017-01-23 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Analyze_Refined_Depends_In_Decl_Part): Move all global variables to the local variable section. Update the profile of various nested routine that previously had visibility of those globals. One the matching phase has completed, remove certain classes of clauses which are considered noise. (Check_Dependency_Clause): Properly detect a match between two 'Result attributes. Update the various post-match cases to use Is_Already_Matched as this routine now automatically recognizes a previously matched 'Result attribute. (Is_Already_Matched): New routine. (Remove_Extra_Clauses): New routine. (Report_Extra_Clauses): Remove the detection of ... => null clauses as this is now done in Remove_Extra_Clauses. From-SVN: r244782
2017-01-19[multiple changes]Arnaud Charlet1-4/+7
2017-01-19 Ed Schonberg <schonberg@adacore.com> * sem_ch4.ads, sem_ch4.adb (Try_Object_Operation): Make subprogram public, for use elsewhere. * sem_ch6.adb (Analyze_Procedure_Call): In SPARK_Mode and within an Inlined_body, recognize a call that uses object notation and has not been rewritten as a regular call because regular expansion has not taken place. 2017-01-19 Bob Duff <duff@adacore.com> * checks.adb (Apply_Type_Conversion_Checks): Disable small optimization in case of generic formal discrete types, because it causes crashes in the compiler when built with assertions on. From-SVN: r244620
2017-01-13[multiple changes]Arnaud Charlet1-11/+12
2017-01-13 Gary Dismukes <dismukes@adacore.com> * checks.adb: Minor typo fix and reformatting. 2017-01-13 Javier Miranda <miranda@adacore.com> * contracts.adb (Contract_Only_Subprograms): Remove formal. (Copy_Original_Specification): Removed. (Skip_Contract_Only_Subprogram): Move here checks previously located in the caller of this routine (to leave the code more clean). (Build_Contract_Only_Subprogram): Code cleanup. * scil_ll.ads, scil_ll.adb (Get_Contract_Only_Body_Name): Removed. (Get_Contract_Only_Missing_Body_Name): Removed. From-SVN: r244424
2017-01-13[multiple changes]Arnaud Charlet1-1/+47
2017-01-13 Javier Miranda <miranda@adacore.com> * sem_ch6.adb (Cloned_Expression): New subprogram. (Freeze_Expr_Types): Complete previous patch since the expression of an expression-function may have iterators and loops with defining identifiers which, as part of the preanalysis of the expression, may be left decorated with itypes that will not be available in the tree passed to the backend. 2017-01-13 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Type_Conversion_Checks): Optimize a type conversion to Integer of an expression that is an attribute reference 'Pos on an enumeration type. 2017-01-13 Bob Duff <duff@adacore.com> * atree.ads: Minor comment fix. From-SVN: r244423
2017-01-13sem_aggr.adb, [...]: Update all eligible case statements to reflect the new ↵Hristian Kirtchev1-23/+37
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-13[multiple changes]Arnaud Charlet1-14/+8
2017-01-13 Tristan Gingold <gingold@adacore.com> * s-mmap.adb, s-mmap.ads (Open_Read_No_Exception): New function. (Open_Read): Re-implement using Open_Read_No_Exception. (Open_Write): Raise exception in case of error. * s-mmosin-mingw.adb (Open_Common): Do not raise exception. * s-mmosin-unix.adb (Open_Read, Open_Write): Do not reaise exception. * s-mmosin-mingw.ads, s-mmosin-unix.ads (Open_Read): Adjust comment. 2017-01-13 Yannick Moy <moy@adacore.com> * checks.adb: Code cleanup. 2017-01-13 Yannick Moy <moy@adacore.com> * freeze.adb (Check_Inherited_Conditions): Use analyzed pragma expression instead of unanalyzed aspect expression for checking the validity of inheriting an operation. Also copy the expression being passing it to Build_Class_Wide_Expression, as this call modifies its argument. * sem_util.ads Fix comment to reference correct function name New_Copy_Tree. 2017-01-13 Javier Miranda <miranda@adacore.com> * sem_res.adb (Resolve_Generalized_Indexing): Compiling in ASIS mode, when we propagate information about the indexes back to the original indexing mode and the prefix of the index is a function call, do not remove any parameter from such call. 2017-01-13 Gary Dismukes <dismukes@adacore.com> * exp_ch6.ads (Needs_BIP_Finalization_Master): Update comment. * exp_ch6.adb (Needs_BIP_Finalization_Master): Return True for a build-in-place function whose result type is tagged. 2017-01-13 Yannick Moy <moy@adacore.com> * sem_ch8.adb (Analyze_Subprogram_Renaming.Build_Class_Wide_Wrapper): Do not generate a wrapper when the only candidate is a class-wide subprogram. (Analyze_Subprogram_Renaming): Do not freeze the renaming or renamed inside a generic context. From-SVN: r244399
2017-01-13[multiple changes]Arnaud Charlet1-13/+53
2017-01-13 Hristian Kirtchev <kirtchev@adacore.com> * exp_util.adb (Add_Inherited_Tagged_DIC): Pass the object parameters of both the parent and the derived type DIC procedure to the reference replacement circuitry. (Find_DIC_Type): Modify the circuitry to present the partial view of a private type in case the private type defines its own DIC pragma. (Replace_Object_And_Primitive_References): Add two optional formal parameters. Update the comment on usage. Update the replacement of references to object parameters. 2017-01-13 Gary Dismukes <dismukes@adacore.com> * einfo.adb, sem_ch6.adb, atree.adb: Minor reformatting and typo fix. 2017-01-13 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Actuals): Apply Scalar_Range_Check to an out parameter that is a type conversion, independently of th range check that may apply to the expression of the conversion, for use in GNATProve. 2017-01-13 Yannick Moy <moy@adacore.com> * gnat1drv.adb (Gnat1drv): Move the implicit with for System in GNATprove_Mode here to Frontend. * frontend.adb (Frontend): Move the implicit with for System in GNATprove_Mode here as it ismore correct this way; the old place only worked by chance, since there were no overloaded names. * rtsfind.ads (RE_Id, RE_Unit_Table): Add RE_Tasking_State. * sem_attr.adb (Analyze_Attribute): In GNATprove_Mode, for the four attributes identified in SRM 9(18), add an implicit with to Ada.Task_Identification. * sem_ch8.adb (Analyze_Subprogram_Renaming.Build_Class_Wide_Wrapper): Deal specially with the wrapper introduced for AI05-0071 in GNATprove mode. * checks.adb (Apply_Discriminant_Check, Apply_Selected_Length_Checks, Apply_Selected_Range_Checks): In GNATprove mode, we do not apply the checks, but we still analyze the expression to possibly issue errors on SPARK code when a run-time error can be detected at compile time. (Selected_Length_Checks, Selected_Range_Checks): Perform analysis in GNATprove mode. From-SVN: r244398
2017-01-06Minor reformatting.Arnaud Charlet1-1/+1
From-SVN: r244149
2017-01-06snames.ads-tmpl (Renamed): New name for the pragma argument.Bob Duff1-2/+1
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
2017-01-06[multiple changes]Arnaud Charlet1-0/+8
2017-01-06 Ed Schonberg <schonberg@adacore.com> * checks.adb (Ensure_Valid): Do not generate a validity check within a generated predicate function, validity checks will have been applied earlier when required. 2017-01-06 Tristan Gingold <gingold@adacore.com> * s-tpoben.ads (Protection_Entries): Add comment and reorder components for performances. * s-tpobop.adb (PO_Do_Or_Queue): Implement Max_Queue_Length runtime semantic. From-SVN: r244136
2017-01-06[multiple changes]Arnaud Charlet1-3/+3
2017-01-06 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Loop_Statement): If the loop includes an iterator specification with a serious syntactic error, transform construct into an infinite loop in order to continue analysis and prevent a compiler abort. 2017-01-06 Tristan Gingold <gingold@adacore.com> * exp_ch9.adb (Expand_N_Protected_Type_Declaration): Do not generate max_queue_lengths_array if unused. 2017-01-06 Bob Duff <duff@adacore.com> * errout.adb (Set_Msg_Text): Protect against out-of-bounds array access, in case "\" is at the end of Text. * stylesw.adb (Set_Style_Check_Options): Don't include input characters in the error message template, because they could be control characters such as "\", which Errout will try to interpret. 2017-01-06 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Find_Indexing_Operations, Inspect_Declarations): For a private type examine the visible declarations that follow the partial view, not just the private declarations that follow the full view. 2017-01-06 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch5.adb, sem_ch3.adb, checks.adb: Minor reformatting and code cleanup. From-SVN: r244133
2017-01-06exp_ch5.adb (Get_Default_Iterator): For a derived type...Ed Schonberg1-4/+15
2017-01-06 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Get_Default_Iterator): For a derived type, the alias of the inherited op is the parent iterator, no need to examine dispatch table positions which might not be established yet if type is not frozen. * sem_disp.adb (Check_Controlling_Formals): The formal of a predicate function may be a subtype of a tagged type. * sem_ch3.adb (Complete_Private_Subtype): Adjust inheritance of representation items for the completion of a type extension where a predicate applies to the partial view. * checks.ads, checks.adb (Apply_Predicate_Check): Add optional parameter that designates function whose actual receives a predicate check, to improve warning message when the check will lead to infinite recursion. * sem_res.adb (Resolve_Actuals): Pass additional parameter to Apply_Predicate_Check. From-SVN: r244132
2016-07-04sem_eval.adb (Decompose_Expr): Set 'out' parameters Kind and Cons to valid ↵Bob Duff1-10/+3
values, to avoid use of uninit vars. 2016-07-04 Bob Duff <duff@adacore.com> * sem_eval.adb (Decompose_Expr): Set 'out' parameters Kind and Cons to valid values, to avoid use of uninit vars. (Extract_Length): Reorder the check to make it clearer that we're depending on BOTH Ent1 and Ent2 to be Present. * sem_aggr.adb (Resolve_Aggregate): Remove dead code. (Check_Misspelled_Component): Remove exit statement, because it's covered by the 'while' condition. * checks.adb (Apply_Selected_Range_Checks): Remove useless condition "or else not Checks_On". (Selected_Range_Checks): Initialize Known_LB and Known_HB to False, because they are tested unconditionally; avoid use of uninit vars. * frontend.adb (Frontend): Removed useless condition "Operating_Mode = Check_Semantics and then", and added an Assert to clarify why it was useless. * prep.adb (Preprocess): Remove redundant condition. Add an assertion. * sem_ch10.adb (Analyze_Proper_Body): Moved redundant condition "Original_Operating_Mode = Generate_Code" to an Assert. (Process_Spec_Clauses, Process_Body_Clauses): Change parameters from 'in out' to 'out', and don't initialize actuals. * sem_ch12.adb (Is_In_Main_Unit): Removed useless condition "Unum = Main_Unit or else". (Save_Global_Descendant): Moved redundant condition "D = Union_Id (No_List)" to an Assert. * sem_ch4.adb (Check_Misspelled_Selector): Remove exit statement, because it's covered by the 'while' condition. (Analyze_Case_Expression): Initialize Wrong_Alt to Empty, because it looks like it is used uninitialized otherwise. * sem_ch6.adb (Check_Return_Subtype_Indication): Moved redundant condition "not R_Type_Is_Anon_Access" to an Assert. * sem_elim.adb (Line_Num_Match): Moved redundant condition "Sloc_Trace (Idx) = '['" to an Assert. * sem_util.adb (Compile_Time_Constraint_Error): Change "J" to "J - 1". This code is trying to replace "?" with "<", but not if the "?" is quoted, as in "'?", so we want to check the PREVIOUS character for '''. * snames.adb-tmpl (Is_Pragma_Name): Remove useless condition "or else N = Name_Relative_Deadline". It's useless because Name_Relative_Deadline is in the range First_Pragma_Name .. Last_Pragma_Name. * treepr.adb (Visit_Node): Moved redundant condition "D = Union_Id (No_List)" to an Assert. * sem_ch3.adb (Derive_Subprogram, Derive_Subprograms): Change parameters from 'in out' to 'out'. * errout.adb (Error_Msg_Internal): Replace redundant test with Assert. * inline.adb (Add_Inlined_Body): Code cleanup. From-SVN: r237972
2016-06-22[multiple changes]Arnaud Charlet1-1/+11
2016-06-22 Ed Schonberg <schonberg@adacore.com> * einfo.ads, einfo.adb (Is_Actual_Subtype): New flag, defined on subtypes that are created within subprogram bodies to handle unconstrained composite formals. * checks.adb (Apply_Predicate_Check): Do not generate a check on an object whose type is an actual subtype. * sem_ch6.adb (Set_Actual_Subtypes): Do not generate an actual subtype for a formal whose base type is private. Set Is_Actual_Subtype on corresponding entity after analyzing its declaration. 2016-06-22 Justin Squirek <squirek@adacore.com> * sem_prag.adb (Check_Expr_Is_OK_Static_Expression): Fix ordering of if-block and add in a condition to test for errors during resolution. * sem_res.adb (Resolution_Failed): Add comment to explain why the type of a node which failed to resolve is set to the desired type instead of Any_Type. * sem_ch8.adb (Analyze_Object_Renaming): Add a check for Any_Type to prevent crashes on Is_Access_Constant. From-SVN: r237692