aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2025-07-01ada: Remove unused variables from the binder generation routinePiotr Trojanek2-22/+2
Remove leftovers from zero cost exception handling; semantics is unaffected. gcc/ada/ChangeLog: * ali.ads (Unit_Record): Fix grammar in comment. * bindgen.adb (Num_Elab_Calls, Num_Primary_Stacks): Remove counters that were only incremented and never actually used.
2025-07-01ada: Disallow underscore before exponentTonu Naks1-2/+6
Underscore is allowed only between digits. The current implementattion was considering 'E' as a digit even if it was not in the range of Base and could denote exponent only. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits): fix condition for rejecting underscore.
2025-07-01ada: Fix couple of issues in System.Value_D.Integer_To_Decimal functionEric Botcazou2-21/+33
The first issue is that the function would wrongly raise Constraint_Error on the edge case where Val = 2**(Int'Size - 1) and Minus is not set. The second issue is that the function takes a long time to deal with huge negative exponents. The change also contains minor consistency fixes for its counterpart that is present in System.Value_F, namely Integer_To_Fixed. gcc/ada/ChangeLog: * libgnat/s-valued.adb (Integer_To_Decimal): Deal specifically with Val = 2**(Int'Size - 1) if Minus is not set. Exit the loops when V saturates to 0 in the case of (huge) negative exponents. Use Base instead of B consistently in unsigned computations. * libgnat/s-valuef.adb (Integer_To_Fixed): Use Base instead of B consistently in unsigned computations.
2025-07-01ada: Do minimal expansion of fixedpoint operations for GNATprovePiotr Trojanek3-6/+14
A minimal expansion of fixedpoint operations is needed for GNATprove, because the subsequent resolution of type conversion relies on this expansion being done. gcc/ada/ChangeLog: * exp_ch4.adb (Fixup_Universal_Fixed_Operation): Move to spec. * exp_ch4.ads (Fixup_Universal_Fixed_Operation): Move from body. * exp_spark.adb (Expand_SPARK): Call a fixup expansion routine.
2025-07-01ada: Fix for compiler crash on function return with Relaxed_Finalization partsGary Dismukes1-1/+3
The compiler crashes on compiling a return statement of a function whose result type has a component whose type is specified with Relaxed_Finalization. The compiler was attempting to retrieve a nonexistent BIP_Collection extra formal from the enclosing function, which may not exist in the case of result types with Relaxed_Finalization. gcc/ada/ChangeLog: * exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Test not Has_Relaxed_Finalization as a guard against retrieving BIP_Collection formal (and related code).
2025-07-01ada: Warn on untagged record type equalityJavier Miranda4-8/+62
The frontend reports a warning when no component of an untagged record type U is a record type, and the type C of some of its components has defined its user-defined equality operator "=". The warning is reported because it may be surprising that, following RM 4.5.2 (24/3), the predefined "=" of the component type C takes precedence over its user-defined "=" when objects of the record type R are compared. gcc/ada/ChangeLog: * exp_ch3.adb (Build_Untagged_Record_Equality): Report the warning when no component of an untagged record type U is a record type, and the type C of some of its components has defined its user-defined equality operator "=". * exp_ch4.adb (Expand_Composite_Equality): Report the warning calling Warn_On_Ignored_Equality_Operator. * sem_warn.ads (Warn_On_Ignored_Equality_Operator): New subprogram. * sem_warn.adb (Warn_On_Ignored_Equality_Operator): Factorize code reporting the warning.
2025-07-01ada: Reduce the likelihood of overflow in TanhTonu Naks1-5/+8
gcc/ada/ChangeLog: * libgnat/a-ngelfu.adb: conditional computation of X^2
2025-07-01ada: Split the unit System.Case_Utilities into two parts.Steve Baird8-95/+251
The package System.Case_Utilities provides some subprograms that do not make use of the secondary stack and some that do. When compiling in a context where no secondary stack support is provided, this makes the entire package unusable (and similarly for any other package that withs this package). Split the package into two packages named Case_Utilities_NSS and Case_Utilities (NSS is for "no secondary stack"). The first package declares the subprograms that do not need secondary stack support. The second package declares the remaining subprograms, as well as renamings of everything declared in the first part. A client that continues to reference Case_Utilities is largely unaffected by this change. But if we change a client to reference Case_Utilities_NSS instead, that removes an obstacle that would otherwise prevent using that client unit in a no-secondary-stack-support environment. We then make that change to the body of package System.Val_Util. gcc/ada/ChangeLog: * Makefile.rtl: Add entry for new unit's object file. * libgnat/s-casuti.adb: Remove bodies of subprograms that were moved to the new unit. * libgnat/s-casuti.ads: Replace (with renamings) declarations for subprograms that moved to the new unit. * libgnat/s-cautns.adb: Body for new unit (a new source file). * libgnat/s-cautns.ads: Spec for new unit (a new source file). * libgnat/s-valuti.adb: Use the new unit instead of the old one. * gcc-interface/Make-lang.in: Add entries for new unit's object file. * gcc-interface/Makefile.in: Likewise.
2025-07-01ada: Compiler fails on unchecked deallocation for constrained protected subtypeGary Dismukes1-0/+1
The compiler fails with an error or Assert_Failure when calling an instantiation of Unchecked_Deallocation that has been instantiated with a constrained subtype of a discriminated protected type. gcc/ada/ChangeLog: * sem_ch3.adb (Constrain_Corresponding_Record): Inherit Class_Wide_Type on the created constrained subtype.
2025-07-01ada: Add GNAT LLVM selection in GPR project file.Artur Pietrek2-0/+6
gcc/ada/ChangeLog: * doc/gnat_ugn/building_executable_programs_with_gnat.rst: add GNAT LLVM explicit selection in GPR file * gnat_ugn.texi: Regenerate.
2025-07-01ada: Small tweak to latest changeEric Botcazou1-1/+3
Unlike RTE, RTU_Entity alone does not cause the unit to be loaded. gcc/ada/ChangeLog: * exp_ch7.adb (Shift_Address_For_Descriptor): Add dummy variable to make sure that System_Storage_Elements is loaded.
2025-07-01ada: Add "continue" GNAT extensionRonan Desplanques19-176/+548
This extension adds "continue" as a nonreserved keyword, and this is the first occurrence of a nonreserved keyword in GNAT, which causes this patch to add unusual overload resolution code. New node kinds are introduced, but since they are entirely transformed into existing constructs during expansion, back ends that don't turn off expansion do not need to be updated. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * gen_il-fields.ads (Opt_Field_Enum): Add new fields. * gen_il-types.ads (N_Loop_Flow_Statement, N_Continue_Statement): New node kinds. * gen_il-gen-gen_nodes.adb (N_Loop_Flow_Statement): New abstract node kind. (N_Continue_Statement): New node kind. (N_Exit_Statement): Reparent below N_Loop_Flow_Statement. * sinfo.ads (N_Continue_Statement): Add description. * sinfo-utils.ads (Loop_Flow_Keyword): New function. * sinfo-utils.adb (Loop_Flow_Keyword): New function. * gen_il-gen-gen_entities.adb (E_Loop): Add new field. * einfo.ads (Continue_Mark): Document new field. * sprint.adb (Sprint_Node_Actual): Update for new node kind. * snames.ads-tmpl: Add new keyword. * par-ch5.adb (P_Continue_Statement, Parse_Loop_Flow_Statement): New functions. (P_Sequence_Of_Statements): Handle continue statements. (P_Exit_Statement): Use Parse_Loop_Flow_Statement. * sem.adb (Analyze): Handle new node kind. * sem_ch5.adb (Analyze_Loop_Flow_Statement): New function. (Analyze_Continue_Statement): New procedure. (Analyze_Exit_Statement): Use new Analyze_Loop_Flow_Statement function. * sem_ch5.ads (Analyze_Continue_Statement): New procedure. * expander.adb (Expand): Handle new node kind. * exp_ch5.ads (Expand_N_Continue_Statement): New procedure. * exp_ch5.adb (Expand_Loop_Flow_Statement): New procedure. (Expand_N_Continue_Statement): New procedure. (Expand_N_Exit_Statement): Use new Expand_Loop_Flow_Statement procedure. (Build_Formal_Container_Iteration): Always reuse original loop entity. * gnat_rm.texi: Regenerate.
2025-07-01ada: Disable -gnatR2 output in case of object renamingsBob Duff1-1/+3
Such output was unnecessary, and in some cases harmful. In particular, we generate renamings in the expanded code for protected types, with internally-generated names, which could be confusing to the user. In addition, in the JSON output (-gnatR2j), these generated renamings could have duplicate source locatations, which confused SPARK. gcc/ada/ChangeLog: * repinfo.adb (List_Entities): Disable output in case of object renamings.
2025-07-01ada: Correct comment in s-valuen.adsAleksandra Pasek1-2/+2
gcc/ada/ChangeLog: * libgnat/s-valuen.ads: Correct comment.
2025-07-01ada: include string.hAlexandre Oliva1-0/+1
__gnat_install_handler calls strncmp when __HANDLE_VXSIM_SC is defined, so string.h needs to be included, and gcc-14 enforces this requirement. gcc/ada/ChangeLog: * init.c: Include string.h.
2025-07-01ada: Drop the chapter listing implemented Ada 2012 AI'sTonu Naks6-4433/+930
We support Ada 2012 fully. The chapter is out of date and would serve no purpose if it was up to date. gcc/ada/ChangeLog: * doc/gnat_rm.rst: remove ref to 2012 chapter * doc/gnat_rm/about_this_guide.rst: remove ref to 2012 chapter * doc/gnat_rm/compatibility_and_porting_guide.rst: update list of supported versions * doc/gnat_rm/implementation_of_ada_2012_features.rst: delete * doc/gnat_rm/specialized_needs_annexes.rst: update list of supported versions * gnat_rm.texi: Regenerate.
2025-07-01ada: Replace references for GLADE with PolyORBTonu Naks5-43/+24
gcc/ada/ChangeLog: * doc/gnat_rm/implementation_advice.rst: remove GLADE * doc/gnat_rm/implementation_defined_characteristics.rst: remove GLADE * doc/gnat_rm/specialized_needs_annexes.rst: remove GLADE * doc/gnat_rm/the_gnat_library.rst: remove GLADE * gnat_rm.texi: Regenerate.
2025-07-01ada: use __builtin_alloca for alloca on vxworksAlexandre Oliva1-0/+4
Several adaint.c functions call alloca, but vxworks doesn't declare it. Use the GCC builtin. gcc/ada/ChangeLog: * adaint.c [__vxworks] (alloca): Redirect to builtin.
2025-07-01ada: freeze.adb: do not emit error on non-aligned component in CodePeer_ModeGhjuvan Lacambre1-2/+5
These errors hinder analysis of non-GNAT code and are not useful to the user as CodePeer does not care about alignment. gcc/ada/ChangeLog: * freeze.adb (Freeze_Record_Type): Check for CodePeer_Mode.
2025-07-01ada: Move aspects when instantiating subprograms as compilation unitsPiotr Trojanek1-0/+2
When rewriting N_Subprogram_Instantiation into wrapper packages we must move the original aspect specifications to the wrapper packages, as otherwise they will be only accessible via Original_Node. This is similar to how we move aspect specifications for expression functions and many other constructs. gcc/ada/ChangeLog: * sem_ch12.adb (Analyze_Subprogram_Instantiation): Move aspects when instantiating subprogram as a library unit.
2025-07-01ada: Remove useless subexpressionsRonan Desplanques1-5/+2
The subexpressions this patch removes were clearly useless given the test for "No (Scheme)" in a preceding condition. gcc/ada/ChangeLog: * exp_ch5.adb (Expand_N_Loop_Statement): Remove useless subexpressions.
2025-07-01ada: Document sanitizers in mixed-language applicationsJose Ruiz2-114/+239
gcc/ada/ChangeLog: * doc/gnat_ugn/gnat_and_program_execution.rst: Add the documentation about benefits of using sanitizers in mixed-language applications. * gnat_ugn.texi: Regenerate.
2025-07-01ada: Handle Warnings_As_Errors the same way.Viljar Indus6-135/+87
There are multiple scenarios where warnings can be turned into errors. However internally they should always be handled the same way and we should not rely on additional counters and variables to handle the different behaviours. These different types of converted warnings have however been emitted differently historically. This information is stored in the Warn_Err attribute which now stores the reason for the conversion so that the printers know how to handle those scenarios. Based on the reason these warnings are printed in different ways: * If converted by pragma Warning_As_Error then it should print the message with an error prefix and a [warning-as-error] tag. * If it is a run time warning converted by -gnatwE then the message should be printed with just an error prefix. * if the warning was converted by -gnatwe then the message should be printed with a warning prefix. gcc/ada/ChangeLog: * atree.ads (Compile_Time_Pragma_Warnings): Removed. * errout.adb (Initialize): Remove initialization for Compile_Time_Pragma_Warnings. (Error_Msg_Internal): Use Warning_As_Error_Kind in the Error_Msg_Object. Set its value based on the reason the warning was changed to an error. (Write_JSON_Span): Adjust the code for Warn_Err. (Output_Messages): Update the calculation for actual warnings and errors by just using Warnings_Treated_As_Errors. (Set_Msg_Text): Simply mark that we are dealing with a run time message here. Move the code for the Warning_Mode to Error_Msg_Internal. * erroutc-pretty_emitter.adb (Write_Error_Msg_Line): Adjust the code for Warn_Err. Use the Warn_As_Err_Tag token. * erroutc.adb (Compilation_Errors): Simplify the implementation so that it only checks for errors and warnings treated as errors. (Decrease_Error_Msg_Count): Remove the count for Compile_Time_Pragma_Warnings. (dmsg): Adjust the code for changes to Warn_Err. (Increase_Error_Msg_Count): Likewise and remove the count for Compile_Time_Pragma_Warnings. (Output_Msg_Text): Warnings converted to error by the Warning_As_Error pragma and -gnatwE now use the error prefix in their messages but only warnings changed by the pragma get the [warning-as-error] tag. (Output_Text_Within): Adjust the variable name for Is_Runtime_Raise_Msg. (Write_Error_Summary): Adjust printing of warnings so that it just uses the counts for Warnings_Detected and Warnings_Treated_As_Errors. * erroutc.ads (Is_Runtime_Raise): renamed to Is_Runtime_Raise_Msg. (Warning_As_Error_Kind): New type for marking the warning message is treated as an error which also captures the reason for the change. Historically each of the reasons will have a different way of displaying the warning message. (Error_Msg_Object.Warn_Err): Change type to Warning_As_Error_Kind. (Kind_To_String): Warnings treated as errors originating from the pragma or -gnatwE will return error where as warnings originating from -gnatwe will return warning. (Compilation_Errors): Update the documentation. (Warn_As_Err_Tag): Constant string to be used when printing warnings as errors. * errutil.adb (Error_Msg): Adjust the code for Warn_Err.
2025-07-01ada: Fix wrong finalization of constrained subtype of unconstrained array typeEric Botcazou5-93/+96
Dynamically allocated objects of a constrained subtype of an unconstrained array type with a controlled component type have not been properly finalized since the first rewrite of the finalization machinery more than a decade ago. The reason is that the Finalize_Address routine is that of the base type, which is unconstrained, and thus requires the bounds, which are not present for the subtype in the allocation. This is fixed by setting Is_Constr_Array_Subt_With_Bounds for allocators the same way it is set for object declarations. The rest is just refactoring. gcc/ada/ChangeLog: * exp_ch7.adb (Shift_Address_For_Descriptor): New function. (Make_Address_For_Finalize): Call above function. (Make_Finalize_Address_Stmts): Likewise. * exp_util.ads (Is_Constr_Array_Subt_Of_Unc_With_Controlled): New predicate. * exp_util.adb (Is_Constr_Array_Subt_Of_Unc_With_Controlled): Ditto. (Remove_Side_Effects): Call above predicate. * sem_ch3.adb (Analyze_Object_Declaration): Likewise. * sem_ch4.adb (Analyze_Allocator): Allocate the bounds by setting Is_Constr_Array_Subt_With_Bounds when appropriate.
2025-07-01ada: Dispatching call with mutably tagged objectsJavier Miranda1-0/+4
The compiler rejects performing a dispatching call using the prefix notation when the prefix of the call is a mutably tagged class-wide type object. gcc/ada/ChangeLog: * sem_ch4.adb (Try_Object_Operation): Handle mutably tagged class-wide type prefix.
2025-07-01ada: Improve Warning_Treated_As_ErrorViljar Indus3-9/+32
gcc/ada/ChangeLog: * errout.adb (Error_Msg_Internal): Use the new Warning_Treated_As_Error function. * erroutc.adb (Get_Warning_Option): Add new version of this function that operates on the Error_Msg_Object directly instead of the Error_Id. Update the existing function to call the new version interanlly. (Get_Warning_Tag): Likewise. (Warning_Treated_As_Error): Add a new method that combines the checks for the error message itself and its tag. * erroutc.ads (Get_Warning_Option): Add new spec. (Get_Warning_Option): Likewise. (Get_Warning_Option): Likewise.
2025-07-01ada: Remove Count_Compile_Time_Pragma_WarningsViljar Indus4-46/+23
Use a live counter Compile_Time_Pragma_Warnings to keep track of those messages instead of using a method to count them in the end. gcc/ada/ChangeLog: * atree.ads: Add Compile_Time_Pragma_Warnings for counting compile time warnings. * errout.adb (Initialize): Initialize Compile_Time_Pragma_Warnings. (Output_Messages): Use Compile_Time_Pragma_Warnings instead of Count_Compile_Time_Pragma_Warnings. * erroutc.adb (Compilation_Errors): Likewise. (Count_Compile_Time_Pragma_Warnings): Removed. (Decrease_Error_Msg_Count): Update Compile_Time_Pragma_Warnings. (Increase_Error_Msg_Count): Likewise. (Write_Error_Summary): Use Compile_Time_Pragma_Warnings instead of Count_Compile_Time_Pragma_Warnings. * erroutc.ads (Count_Compile_Time_Pragma_Warnings): Removed.
2025-07-01ada: Use common routine to handle warning countingViljar Indus1-15/+3
gcc/ada/ChangeLog: * errout.adb (Delete_Warning_And_Continuations): Use Decrease_Error_Msg_Count to update the message counts. (Delete_Warning): Likewise. (To_Be_Removed): Likewise.
2025-07-01ada: Mark errors that are removed as deletedViljar Indus2-0/+4
gcc/ada/ChangeLog: * errout.adb (Remove_Warning_Messages): Mark removed messages as deleted. * erroutc.adb (Purge_Messages): Likewise.
2025-07-01ada: Remove spurious warnings about No_Exception_Propagation in GNATprove modeMartin Clochard1-1/+2
gcc/ada/ChangeLog: * frontend.adb (Frontend): do not override GNATprove's setting for Warn_On_Non_Local_Exception
2025-07-01ada: Remove dead assignmentEric Botcazou1-2/+0
The assignment sets the Etype of a node to itsef. gcc/ada/ChangeLog: * sem_ch4.adb (Analyze_Allocator): Do not set Etype to itself.
2025-07-01ada: Fix wrong finalization of constrained array derived from unconstrainedEric Botcazou1-2/+3
The bug had been present for dynamically allocated objects since the first rewrite of the finalization machinery more than a decade ago, and was then propagated to statically declared objects by the recent rewrite. gcc/ada/ChangeLog: * exp_util.adb (Finalize_Address): Do not go to the root type for array types.
2025-07-01ada: Get rid of multiple roundings for 'Value of ordinary fixed-point typesEric Botcazou5-220/+149
They are used to minimize the error after every operation, but they can be eliminated by increasing the precision of the input value, which avoids the unwanted effects of multiple roundings. gcc/ada/ChangeLog: * libgnat/s-valuer.ads (System.Value_R): Remove Round parameter. (Scan_Raw_Real): Replace Extra with Extra2 and adjust the comment. (Value_Raw_Real): Likewise. * libgnat/s-valuer.adb (Round_Extra): Delete. (Scan_Decimal_Digits): Replace Extra with Extra2 and adjust the implementation. (Scan_Integral_Digits): Replace Extra with Extra2 and Extra_Rounded with Extra2_Filled and adjust the implementation. (Scan_Raw_Real): Replace Extra with Extra2 and adjust the implementation. (Value_Raw_Real): Likewise. * libgnat/s-valrea.adb (Impl): Remove actual for Round formal. * libgnat/s-valued.adb (Impl): Likewise. (Integer_to_Decimal): Replace Extra with Extra2 and adjust the implementation. Rename Unsigned_To_Signed to To_Signed. (Scan_Decimal): Replace Extra with Extra2 and adjust the implementation. (Value_Decimal): Likewise. * libgnat/s-valuef.adb (Impl): Remove actual for Round formal. (Integer_to_Fixed): Replace Extra with Extra2 and adjust the implementation. Rename Unsigned_To_Signed to To_Signed. Only round the last scaled divide operation. (Scan_Fixed): Replace Extra with Extra2 and adjust the implementation. (Value_Fixed): Likewise.
2025-07-01ada: Clarify numeric parsing codeRonan Desplanques1-20/+18
This patch rephrases some code in System.Value_R to make it easier to read. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits): Minor rephrasing.
2025-07-01ada: Set ekind of loop parameters earlierRonan Desplanques1-2/+1
gcc/ada/ChangeLog: * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Set ekind earlier.
2025-07-01ada: Small cleanup in the finalization machineryEric Botcazou3-253/+127
The generic finalization machinery and the finalization machinery for transient objects disagree on which controlled objects should be finalized indirectly, i.e. through an access value: the former only considers return objects of (selected) function calls, whereas the latter considers all objects designated by a reference, which means that it must be careful about not finalizing them twice. The discrepancy does not seem to cause problems in practice, but is awkward and creates additional work for the finalization machinery for transient objects, as well as code duplication. gcc/ada/ChangeLog: * exp_util.ads (Is_Finalizable_Access): New predicate. (Is_Non_BIP_Func_Call): Delete. (Is_Secondary_Stack_BIP_Func_Call): Likewise. * exp_util.adb (Is_Finalizable_Access): New predicate. (Initialized_By_Aliased_BIP_Func_Call): Delete. (Initialized_By_Reference): Likewise. (Is_Aliased): Only consider the nontransient object serviced by the transient scope. (Is_Part_Of_BIP_Return_Statement): Minor tweak. (Is_Finalizable_Transient): Remove calls to Initialized_By_Reference and Initialized_By_Aliased_BIP_Func_Call. Call Is_Finalizable_Access for access objects. (Is_Non_BIP_Func_Call): Delete. (Is_Secondary_Stack_BIP_Func_Call): Likewise. (Requires_Cleanup_Actions): Call Is_Finalizable_Access for access objects. (Side_Effect_Free): Return True for N_Reference. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Call Is_Finalizable_Access for access objects.
2025-07-01ada: Fix wrong finalization of temporary constrained array of controlled typeEric Botcazou1-20/+39
This regression has been introduced by the rewrite of the finalization machinery, which now requires a specific handling of constrained array types with controlled component and an unconstrained first subtype. gcc/ada/ChangeLog: * exp_util.adb (Is_Expression_Of_Func_Return): New predicate. (Is_Related_To_Func_Return): Call Is_Expression_Of_Func_Return. (Remove_Side_Effects): Generate a temporary for a function call that returns a constrained array type with controlled component and an unconstrained first subtype.
2025-07-01ada: Remove wrong optimization in frontend inlining of procedure callsPiotr Trojanek2-35/+2
When using obsolete frontend inlining (switch -gnatN), we must always rewrite the procedure call into a single block node. Otherwise, the copy-back of parameters passed by-copy is inserted before the inlined procedure body, which causes wrong code to be generated. gcc/ada/ChangeLog: * inline.adb (Rewrite_Procedure_Call): Replace with a simple rewriting of procedure call into a single block node, i.e. remove broken optimization. * sem_util.adb (Next_Actual): Adapt GNATprove-specific code that peeks into inlined calls.
2025-07-01ada: Minor fix in handling of inherited Pre/Post'Class aspectMartin Clochard1-2/+4
Mapping of calls to primitive functions in Pre/Post'Class aspects inherited by derived types was only testing against controlling formals of the parent subprogram. This lead to missing some calls, because formals could be rewritten to that of the derived subprogram before the test happens. gcc/ada/ChangeLog: * exp_util.adb (Is_Controlling_Formal_Ref): test scope against derived subprogram as well.
2025-07-01ada: Fix detecting Compilation_ErrorsViljar Indus2-15/+31
Subprogram Compilation_Errors is used to check whether any errors have been detected during the compilation process. It relies on Total_Errors_Detected and Warnings_Treated_As_Errors counts. Total_Erros_Detected are updated immidiatelly after the error objects have been created. Warnings_Treated_As_Errors were updated only when the messages are being printed. This leads to a situation where we do not have the correct count of Warnings_Treated_As_Errors unless the errors have been printed. gcc/ada/ChangeLog: * errout.adb (Error_Msg_Internal): Relocate Warn_As_Err propagation to Increase_Error_Msg_Counti. (Delete_Warning_And_Continuations): Update Warnings_Treated_As_Errors count. (Delete_Warning): Likewise. (To_Be_Removed): Likewise. * erroutc.adb (Increase_Error_Msg_Count): Count warnings treated as errors here and perform the propagation of this property to the parent message. (Output_Msg_Text): Remove counting of warnings as errors from here. (Decrease_Error_Msg_Count): Update Warnings_Treated_As_Errors count.
2025-07-01Daily bump.GCC Administrator1-0/+321
2025-06-30Ada: Provide fallback for GNATMAKE_FOR_BUILD Makefile variableEric Botcazou1-0/+2
The variable is set only at the top level. gcc/ada/ PR ada/120106 * Make-generated.in (GNATMAKE_FOR_BUILD): Define.
2025-06-30ada: Fix Execution_Successful value with exceptionsViljar Indus7-20/+29
Store the Exit_Code value and use that to generate the Exceution_Successful value in the SARIF report. gcc/ada/ChangeLog: * comperr.adb (Compiler_Abort): Pass the exit code in calls to Output_Messages. * errout.adb (Output_Messages): Add new parameter for the Exit_Code and store its value. * errout.ads (Output_Messages): Likewise. * erroutc-sarif_emitter.adb (Print_Invocations): Set Execution_Successful based on the exit code. * erroutc.ads (Exit_Code): Store the exit code value. * gnat1drv.adb (Gnat1drv): Pass the exit code in calls to Output_Messages. * prepcomp.adb (Parse_Preprocessing_Data_File, Prpare_To_Preprocess): Likewise.
2025-06-30ada: Refine use of Has_ExitRonan Desplanques1-1/+1
The description of the Has_Exit field in Einfo makes it pretty clear that it can only be meaningful for loop entities. It was however defined in all entities until this patch, which restricts this field to E_Loop. gcc/ada/ChangeLog: * gen_il-gen-gen_entities.adb (Gen_Entities): Tweak Has_Exit.
2025-06-30ada: Make class-wide Max_Size_In_Storage_Elements return a large valueBob Duff1-7/+27
Max_Size_In_Storage_Elements is supposed to return a value greater or equal to what is passed for any heap allocation for an object of the type. For a tagged type T, we don't know the allocation size for descendants; therefore T'Class'Max_Size_In_Storage_Elements should return a huge number. In particular, it now returns Storage_Count'Last, which is greater than any possible heap allocation. Previously, T'Class'Max_Size_In_Storage_Elements was returning the same value as T'Max_Size_In_Storage_Elements, which was wrong. gcc/ada/ChangeLog: * exp_attr.adb (Attribute_Max_Size_In_Storage_Elements): Return Storage_Count'Last converted to universal_integer.
2025-06-30ada: Add documentation of implemented Ada 2022 featuresTonu Naks6-928/+6599
gcc/ada/ChangeLog: * doc/gnat_rm.rst: add entry point for the new chapter * doc/gnat_rm/about_this_guide.rst: add reference to the new chapter * doc/gnat_rm/implementation_of_ada_2022_features.rst: new file * doc/gnat_rm/implementation_of_ada_2012_features.rst: update explanation about RM references * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-30ada: Reuse Snames classification of reserved wordsRonan Desplanques1-6/+9
Before this patch, Check_Future_Keyword had hardcoded lists of what reserved words were introduced in what versions of the Ada language specification. This patch makes it use the classification in Snames instead. gcc/ada/ChangeLog: * par-util.adb (Check_Future_Keyword): Use Snames subtypes. Extend comment.
2025-06-30ada: Remove obsolete commentRonan Desplanques1-4/+0
This patch removes a comment that was left over when an exception declaration was removed. gcc/ada/ChangeLog: * sem_ch5.adb (Analyze_Loop_Statement): Remove obsolete comment.
2025-06-30ada: Fix bug in -gnatw.o switch (unreferenced out parameters)Bob Duff1-1/+1
Fixes this bug: If -gnatw.o is specified, it is ignored unless -gnatwm is also specified (either directly, or as part of a catch-all switch like -gnatwa). gcc/ada/ChangeLog: * sem_warn.adb (Warn_On_Useless_Assignments): Enable Warn_On_Useless_Assignment in the case of Warn_On_All_Unread_Out_Parameters.
2025-06-30ada: Remove uses of E_Void for subtype declarationsRonan Desplanques1-9/+34
This patch slightly reorganizes Analyze_Subtype_Declaration so that the proper Ekind of the new subtype's entity is set before anything else is done with it. A new local subprogram is introduced in the process. gcc/ada/ChangeLog: * sem_ch3.adb (Analyze_Subtype_Declaration): Remove uses of E_Void. (Copy_Parent_Attributes): New procedure.