aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2025-01-08Daily bump.GCC Administrator1-0/+273
2025-01-07Update copyright years.Marc Poulhiès2271-2272/+2272
2025-01-07ada: Adjust pragma obsolescent messageMarc Poulhiès2-8/+22
Do not mention an explicit version. gcc/ada/ChangeLog: * libgnat/a-calcon.ads: Adjust. * libgnat/a-calend.ads: Adjust.
2025-01-07ada: Drop g-cpp* units not needed by the compilerAlexandre Oliva1-6/+0
Having moved __gnat_convert_caught_object to g-cstyin.o, we can drop other g-cpp* units that are now needed by programs that actually use their APIs to get more information about C++ exceptions and type_info objects. gcc/ada/ChangeLog: * gcc-interface/Make-lang.in (GNAT_ADA_OBJS, GNATBIND_OBJS): Drop g-cpp, g-cppexc and g-cppstd.
2025-01-07ada: Do not create temporaries for initialization statementsEric Botcazou1-1/+14
Assignment statements marked with the No_Ctrl_Actions or No_Finalize_Actions flag are initialization statements and, therefore, no temporaries are needed to hold the value of the right-hand side for them. gcc/ada/ChangeLog: * gcc-interface/trans.cc (Call_to_gnu): Always use the return slot optimization if the parent node is an initialization statement. (gnat_to_gnu) <N_Assignment_Statement>: Build an INIT_EXPR instead of a MODIFY_EXPR if this is an initialization statement.
2025-01-07ada: Remove unused AST flag Address_Warning_PostedPiotr Trojanek4-12/+2
Flag Address_Warning_Posted was only read and never written, so it can be safely removed. gcc/ada/ChangeLog: * gen_il-fields.ads (Opt_Field_Enum): Remove flag. * gen_il-gen-gen_nodes.adb (N_Attribute_Definition_Clause): Remove field. * sem_ch13.adb (Validate_Address_Clauses): Remove read of the flag. * sinfo.ads (Address_Warning_Posted): Remove flag description.
2025-01-07ada: Do not raise exceptions from Exp_Aggr.Packed_Array_Aggregate_HandledEric Botcazou1-13/+16
An exception is now raised during bootstrap and this causes compatibility issues with older compilers. gcc/ada/ChangeLog: * exp_aggr.adb (Packed_Array_Aggregate_Handled): Remove declaration and handler for Not_Handled local exception. Check the return value of Get_Component_Val instead. (Get_Component_Val): Return No_Uint instead of raising Not_Handled.
2025-01-07ada: Cleanup preanalysis of static expressions (part 2)Javier Miranda13-62/+87
According to RM 13.14(8/4), a static expression in an aspect specification does not cause freezing; however, the frontend performs many calls to Preanalyze_Spec_Expression made during the analysis of aspects. This patch, suggested by Eric Botcazou, takes care of this additional code cleanup which requires also replacing many occurrences of the global variable In_Spec_Expression by calls to Preanalysis_Active. gcc/ada/ChangeLog: * exp_util.adb (Insert_Actions): Document behavior under strict preanalysis. * sem.ads (In_Strict_Preanalysis): New subprogram. (Preanalysis_Active): Replace 'and' operator by 'and then'. * sem.adb (In_Strict_Preanalysis): Ditto. * sem_attr.adb (Check_Dereference): Replace In_Spec_Expression occurrence by call to Preanalysis_Active, and document it. (Resolve_Attribute [Atribute_Access]): Ditto. (Eval_Attribute): No evaluation under strict preanalysis. (Validate_Static_Object_Name): No action under strict preanalysis. * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Replace calls to Preanalyze_Spec_Expression by calls to Preanalyze_And_Resolve. (Check_Aspect_At_Freeze_Point): Ditto. (Resolve_Aspect_Expressions [Dynamic/Static/Predicate aspects]): Code cleanup adjusting the code to emulate Preanalyze_And_Resolve, instead of Preanalyze_Spec_Expression. (Resolve_Aspect_Expressions [CPU/Interrupt_Priority/Priority/ Storage_Size aspects]): Replace calls to Preanalyze_Spec_Expression by call to Preanalyze_And _Resolve. * sem_ch3.adb (Analyze_Object_Declaration): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. (Find_Type_Of_Object): Add documentation. * sem_ch4.adb (Analyze_Case_Expression): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. * sem_ch6.adb (Analyze_Expression_Function): Minor code reorganization moving the code preanalyzing the expression after the new body has been inserted in the tree to ensure that its Parent attribute is available for preanalysis. * sem_cat.adb (Validate_Static_Object_Name): No action under strict preanalysis. * sem_elab.adb (Check_For_Eliminated_Subprogram): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. * sem_eval.adb (Eval_Intrinsic_Call [Name_Enclosing_Entity]): Ditto. * sem_elim.adb (Check_For_Eliminated_Subprogram): Ditto. * sem_res.adb (Resolve_Entity_Name): Ditto.
2025-01-07ada: Fix constants overlayed by variablesPiotr Trojanek1-2/+4
Code cleanup suggested by GNATcheck rule Constant_Overlays. gcc/ada/ChangeLog: * repinfo-input.adb (Decode_Name, Read_Name_With_Prefix): Use constant overlay with pragma Import.
2025-01-07ada: Improve protection against wrong use from GDBPiotr Trojanek1-2/+3
A code cleanup in routine intended to be used from DGB, suggested by running GNATcheck rule Boolean_Negations. However, this code can be tuned to protect against more illegal uses. gcc/ada/ChangeLog: * exp_disp.adb (Write_DT): Add guards that prevent crashes on illegal node numbers.
2025-01-07ada: Fix violations of GNAT-specific GNATcheck rulesPiotr Trojanek2-3/+2
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * diagnostics-pretty_emitter.adb (Get_Last_Line_Char): Fix whitespace. * sem_aggr.adb (Resolve_Array_Aggregate): Fix style.
2025-01-07ada: Remove dead code in detection of null record definitionsPiotr Trojanek1-6/+3
Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_util.adb (Is_Null_Record_Definition): Remove check for Component_List being present after using it; replace check for component item being a component declaration with an assertion; fix style in comment.
2025-01-07ada: Fix abort deferral for finally partsRonan Desplanques1-8/+19
This patch fixes two problems with how abort was deferred in finally parts. First, calls to runtime subprograms are now omitted when aborting is disallowed by active restrictions. Second, Abort_Undefer is now correctly called when the finally part propagates an exception. gcc/ada/ChangeLog: * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Fix abort deferral.
2025-01-07ada: Improved checking of uses of package renamingsSteve Baird4-3/+15
In some cases, the RM 8.5.1(3.1) legality rule about uses of renamings of limited views of packages was implemented incorrectly, resulting in rejecting legal uses. gcc/ada/ChangeLog: * gen_il-fields.ads: add new Renames_Limited_View field. * gen_il-gen-gen_entities.adb: add Renames_Limited_View flag for packages. * einfo.ads: add comment documenting Renames_Limited_View flag. * sem_ch8.adb (Analyze_Package_Renaming): Set new Renames_Limited_View flag. Test new Renames_Limited_View flag instead of calling Has_Limited_With. If Has_Limited_With is True, that just means that somebody, sometime during this compilation needed to reference the limited view of the package; so that function returns True too often to be used here. (Find_Expanded_Name): Test new Renames_Limited_View flag instead of calling Has_Limited_With.
2025-01-07ada: Remove flag Is_Inherited_Pragma which is only set and never usedPiotr Trojanek4-13/+2
Code cleanup; behavior is unaffected. Flag Is_Inherited_Pragma is only set in GNAT, but is not actually used, neither by the compiler nor by any backend. gcc/ada/ChangeLog: * contracts.adb (Inherit_Pragma): Don't set flag Is_Inherited_Pragma. * gen_il-fields.ads (Opt_Field_Enum): Remove field identifier. * gen_il-gen-gen_nodes.adb (N_Pragma): Remove field from node. * sinfo.ads (Is_Inherited_Pragma): Remove field description. (N_Pragma): Remove field reference.
2025-01-07ada: Avoid conversion from String to Name_Id at runtimePiotr Trojanek1-1/+1
Code cleanup. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Attribute): Replace runtime conversion with existing constant.
2025-01-07ada: Untangle check for restriction No_Implementation_AttributesPiotr Trojanek1-9/+6
Code cleanup; given that no attribute is both defined by Ada 83 and specific to GNAT, the semantics is unaffected. gcc/ada/ChangeLog: * sem_attr.adb (Analyze_Attribute): Simplify logic.
2025-01-07ada: Handle attributes related to Ada 2012 iterators as internalPiotr Trojanek4-63/+46
Use existing machinery for internal attributes to handle attributes related to Ada 2012 iterators. All these attributes exist exclusively as a mean to delay processing. Code cleanup. The only change in behavior is the wording of error emitted when one of the internal attributes appears in source code: from "illegal attribute" (which used to be emitted in the analysis) to "unrecognized attribute (which is emitted by the parser). gcc/ada/ChangeLog: * exp_attr.adb (Expand_N_Attribute_Reference): Remove explicit handling of attributes related to Ada 2012 iterators. * sem_attr.adb (Analyze_Attribute, Eval_Attribute): Likewise; move attribute Reduce according to alphabetic order. * snames.adb-tmpl (Get_Attribute_Id): Add support for new internal attributes. * snames.ads-tmpl: Recognize names of new internal attributes. (Attribute_Id): Recognize new internal attributes. (Internal_Attribute_Id): Likewise. (Is_Internal_Attribute_Name): Avoid duplication in comment.
2025-01-07ada: Remove unnecessary qualifiers for First/Next list operationsPiotr Trojanek2-5/+4
Code cleanup related to work on expression functions for GNATprove (which require accessibility checks even when they are not expanded and thus have no explicit return statements). gcc/ada/ChangeLog: * accessibility.adb (First_Selector): Remove redundant and locally inconsistent parenthesis. (Check_Return_Construct_Accessibility): Remove qualifier from list operation. * sem_util.adb (Is_Prim_Of_Abst_Type_With_Nonstatic_CW_Pre_Post): Likewise.
2025-01-07ada: Fix internal error on container aggregate for bounded vectorsEric Botcazou3-15/+57
The problem is that we analyze references to an object before the actual subtype of the object is established, thus creating a type mismatch that is flagged by the code generator. gcc/ada/ChangeLog: * exp_ch7.ads (Store_After_Actions_In_Scope_Without_Analysis): New procedure declaration. * exp_ch7.adb (Store_New_Actions_In_Scope): New procedure. (Store_Actions_In_Scope): Call Store_New_Actions_In_Scope when the target list is empty. (Store_After_Actions_In_Scope_Without_Analysis): New procedure body. * exp_aggr.adb (Expand_Container_Aggregate): For a declaration that is wrapped in a transient scope, also defer the analysis of the new code until after the declaration is analyzed.
2025-01-07ada: Add guard to System.Val_Real.Large_Powfive against pathological inputEric Botcazou4-4/+20
There is no need to keep multiplying the result once it saturates to +Inf. gcc/ada/ChangeLog: * libgnat/s-powflt.ads (Maxpow_Exact): Minor comment fix. * libgnat/s-powlfl.ads (Maxpow_Exact): Likewise. * libgnat/s-powllf.ads (Maxpow_Exact): Likewise. * libgnat/s-valrea.adb (Large_Powfive) [1 parameter]: Exit the loop as soon as the result saturates to +Inf. (Large_Powfive) [2 parameters]: Likewise.
2025-01-07ada: Drop vxworks-smp-ppc-link.specAlexandre Oliva2-5/+0
Adding -msmp to linker options in system-vxworks-ppc-rtp-smp.ads obviated vxworks-smp-ppc-link.spec. Drop it. gcc/ada/ChangeLog: * libgnat/system-vxworks-ppc-rtp-smp.ads: Drop --specs=vxworks-ppc-link.spec from Linker_Options. * vxworks-smp-ppc-link.spec: Delete.
2025-01-07ada: Add "finally" GNAT extensionRonan Desplanques26-48/+421
This patch adds a new reserved word, "finally", and accompanying new syntax that's similar to the Java equivalent. gcc/ada/ChangeLog: * atree.adb (Parent_Or_List_Containing): New function. * atree.ads (Parent_Or_List_Containing): Likewise. * gen_il-fields.ads: Add new field. * gen_il-gen-gen_nodes.adb (Gen_Nodes): Extend handled sequence of statements node. * par-ch11.adb (P_Handled_Sequence_Of_Statements, P_Exception_Handler): Add new syntactic construct. * par-ch5.adb (P_Sequence_Of_Statements): Likewise. * par.adb: Likewise. * par-util.adb (Check_Future_Keyword): Warn that "finally" becomes a reserved word with extensions. * scans.adb (Initialize_Ada_Keywords): Add new reserved word. * snames.adb-tmpl: Likewise. * snames.ads-tmpl: Likewise. * scans.ads: Likewise. * sem_ch11.adb (Analyze_Handled_Statements): Adapt to new node field. * sem_ch5.adb (Analyze_Exit_Statement): Add legality check. (Analyze_Goto_Statement): Likewise. * sem_ch6.adb (Analyze_Return_Statement): Likewise. * sinfo-utils.adb (Lowest_Common_Ancestor, Destroy_Element): New subprograms. * sinfo-utils.ads (Lowest_Common_Ancestor): New function. * sinfo.ads: Add documentation for new field. * xsnamest.adb: Fix typo in comment. * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * warnsw.adb: Add new option. * warnsw.ads: Likewise. * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Add abort deferral to finally part. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. * gcc-interface/trans.cc (Handled_Sequence_Of_Statements_to_gnu): Handle finally statements.
2025-01-07ada: Elide the copy for bit-packed aggregates in (safe) assignmentsEric Botcazou1-1/+0
The in-place expansion has been historically disabled for them, but there does not seem to be any good reason left for this. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Array_Aggregate): Do not exclude aggregates of bit-packed array types in assignments from in-place expansion.
2025-01-07ada: Reject references to attribute Result in Exceptional_CasesPiotr Trojanek1-1/+6
Functions with aspect Side_Effects should not reference attribute Result in consequences of their aspect Exceptional_Cases. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Reject references to attribute Result.
2025-01-07ada: Move checks for consequences of Exceptional_Cases to GNATPiotr Trojanek1-0/+68
Previously checks for consequence expressions of Exceptional_Cases aspects were done in GNATprove backend. However, we can do them in the frontend, where they will apply to all subprograms, regardless of the SPARK_Mode aspect. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Move check from GNATprove backend to GNAT frontend.
2025-01-07ada: Fix comments about Subprogram_Variant and Exceptional_CasesPiotr Trojanek1-3/+2
The comment about Subprogram_Variant was outdated after more types have been allowed by the corresponding SPARK RM rule; the comment about Exceptional_Cases was incorrect, after being copy-pasted. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Contract, Analyze_Variant): Fix comments.
2025-01-07ada: Put_Image spec incorrectly ignored for Fixed_Point_Type'Base'Image call.Steve Baird1-2/+19
If a Put_Image aspect specification (introduced in Ada 2022) is given for a fixed point type Fx, then in some cases a call to Fx'Base'Image would incorrectly ignore the aspect specification and would instead return the pre-Ada2022 version of the image. However, a call to Fx'Image would do the right thing. gcc/ada/ChangeLog: * exp_put_image.adb (Image_Should_Call_Put_Image): Cope with the case where the attribute prefix for an Image attribute reference denotes an Itype constructed for a fixed point type. Calling Has_Aspect with such an Itype misses applicable aspect specifications; we need to look on the right list. This comes up if the prefix of the attribute reference is Some_Fixed_Point_Type'Base.
2025-01-07ada: Error on instantiation with defaulted formal type referencing other ↵Gary Dismukes1-14/+64
formal type The compiler wasn't accounting for default subtypes on generic formal types that reference other formal types of the same generic, leading to errors about invalid subtypes. Several other problems that could lead to blowups or incorrect errors were noticed through testing related cases and fixed along the way. gcc/ada/ChangeLog: * sem_ch12.adb (Analyze_One_Association): In the case of a formal type that has a Default_Subtype_Mark that does not have its Entity field set, this means the default refers to another formal type of the same generic formal part, so locate the matching subtype in the Result_Renamings and set Match's Entity to that subtype prior to the call to Instantiate_Type. (Validate_Formal_TypeDefault.Reference_Formal): Add test of Entity being Present, to prevent blowups on End_Label ids (which don't have Entity set). (Validate_Formal_Type_Default.Validate_Derived_Type_Default): Apply Base_Type to Formal. (Validate_Formal_Type_Default): Guard interface-related semantic checks with a test of Is_Tagged_Type.
2025-01-07ada: Use the syntax of Ada 2012 if-expression in -gnatR3 outputEric Botcazou1-1/+1
This uses the syntax of Ada 2012 if-expression in the output produced by the -gnatR3 switch for dynamic expressions. gcc/ada/ChangeLog: * repinfo.adb (List_GCC_Expression.Print_Expr) <Cond_Expr>: Do not output the final "end".
2025-01-07ada: Preserve Warning_Doc_Switch in gnatprove invocationJohannes Kanig1-0/+2
When invoked by gnat2why, the Warning_Doc_Switch was unintenionally reset. gcc/ada/ChangeLog: * gnat1drv.adb: (SPARK_Library_Warning): preserve Warning_Doc_Switch
2025-01-07ada: Restrict previous change made to expansion of allocatorsEric Botcazou2-0/+2
There is no need to build a cleanup if exceptions cannot be propagated. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_Allocator_Expression): Do not build a cleanup if restriction No_Exception_Propagation is active. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise.
2025-01-07Daily bump.GCC Administrator1-0/+283
2025-01-06Ada: fix spurious relinking of gnatbind for cross compilersEric Botcazou1-3/+7
The problem has been introduced by r15-1881. gcc/ada PR ada/118247 * gcc-interface/Make-lang.in (GNATTOOLS_CROSS_MV): Copy gnatbind instead of moving it.
2025-01-06ada: Fix small thinko in previous change to two-pass aggregate expansionEric Botcazou1-1/+2
We need a type tailored to the base index type to compute the length. gcc/ada/ChangeLog: * exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use the base type of the index type to find the type used to compute the length.
2025-01-06ada: Streamline runtime support of finalization collectionsEric Botcazou2-19/+12
Finalization collections are declared as (limited) controlled types so that they can be naturally attached to a finalization master, but the same result can be achieved by means of (limited) finalizable types, which need not be tagged and thus avoid dragging the runtime support of tagged types. gcc/ada/ChangeLog: * libgnat/s-finpri.ads: Remove clause for Ada.Finalization. (Finalization_Collection): Change to limited private type with the Finalizable aspect. (Initialize): Remove "overriding" keyword. (Finalize): Likewise. * libgnat/s-finpri.adb (Initialize): Likewise. (Finalize): Likewise.
2025-01-06ada: Fix predicate involving array indexing rejected in generic packageEric Botcazou2-6/+13
The indexing is rejected with the message: error: reference to current instance of type does not denote a type when it is applied to a prefix which is the current instance of the type to which the predicate is applied. There is already a specific handling of component selection for this case present in Find_Selected_Component, so this adds an equivalent specific handling of indexing for this case to Analyze_Indexed_Component_Form. gcc/ada/ChangeLog: PR ada/117569 * sem_ch4.adb (Analyze_Indexed_Component_Form): Do not rewrite the node as a type conversion if it is the current instance of a type in a generic unit. * sem_ch8.adb (Find_Selected_Component): Restrict the special case of the current instance of a type to a generic unit.
2025-01-06ada: Fix incorrect RM reference in s-imagef.adbBob Duff1-1/+1
gcc/ada/ChangeLog: * libgnat/s-imagef.adb (Set_Image_Integer): Change "RM A.3.10" to be "RM A.10.9".
2025-01-06ada: Reduce footprint of C++ exception interoperation supportAlexandre Oliva5-64/+65
The initial C++ base-type exception interoperation support change brought all of GNAT.CPP* along with raise-gcc, because of [__gnat_]Convert_Caught_Object. Move that private but pragma-exported function to GNAT.CPP.Std.Type_Info, so that it can rely on the C++ virtual/dispatch calls that justified the introduction of the Ada wrapper type, to avoid emulating virtual calls in C or bringing in a dependency on the C++ compiler and runtime. Drop the CharPtr package instantiation, that brought a huge amount of unnecessary code, and use string and storage primitives instead, using the strcmp builtin directly for the C string compares. Move the conversion to Ada String in Name to the wrapper interface in GNAT.CPP.Std, adjusting the private internal type to shave off a few more bytes from the only unit that raise-gcc will still need. Finally, disable heap finalization for Type_Info_Ptr, to avoid dragging in all of the finalization code. Thank to Eric Botcazou for the suggestion. gcc/ada/ChangeLog: * libgnat/g-cppexc.adb (Convert_Caught_Object): Move... * libgnat/g-cstyin.adb (Convert_Caught_Object): ... here. Use object call notation. (strcmp): New. (Char_Arr, CharPtr, Char_Pointer, To_chars_ptr): Drop. Do not import Interfaces.C.Pointers. (To_Pointer): Convert from System.Address. (Name_Starts_With_Asterisk): Rename local variable. (Name_Past_Asterisk): Rewrite with System.Address and strcmp. Import System.Storage_Elements. (Equals): Use strcmp. (Before): Fix logic error. Use strcmp. (Name): Move conversion to String... * libgnat/g-cppstd.adb (Name): ... here. Import Interfaces.C.Strings. * libgnat/g-cppstd.ads (Type_Info_Ptr): Disable heap finalization. * libgnat/g-cstyin.ads (Name): Change return type.
2025-01-06ada: Support new SPARK aspect Exit_CasesClaire Dross19-840/+1524
The aspect Exit_Cases allows annotating a subprogram with a list of cases specifying, for all input which satisfy a guard, how the subprogram is allowed to terminate. For now, it can only be either returning normally or propagating an exception. This contract is not checked at runtime, it is only meant for static verification in SPARK. gcc/ada/ChangeLog: * aspects.ads: Add aspect Aspect_Exit_Cases. * contracts.adb (Analyze_Entry_Or_Subprogram_Contract): Handle Exit_Cases. (Expand_Subprogram_Contract): Idem. * einfo-utils.adb (Get_Pragma): Allow Pragma_Exit_Cases. * einfo-utils.ads (Get_Pragma): Idem. * exp_prag.adb (Expand_Pragma_Exit_Cases): Ignore the pragma, currently we don't expand it. * exp_prag.ads (Expand_Pragma_Exit_Cases): Idem. * inline.adb (Remove_Aspects_And_Pragmas): Add Exit_Cases to the list. (Remove_Items): Idem. * par-prag.adb (Last_Arg_Is_Reason): Idem. * sem_ch12.adb: Idem. * sem_ch13.adb: Idem. * sem_util.adb: Idem. * sem_util.ads: Idem. * sinfo.ads: Idem. * snames.ads-tmpl: Add names Name_Exit_Cases, Name_Exception_Raised, and Name_Normal_Return as well as pragma Pragma_Exit_Cases. * sem_prag.adb (Analyze_Exit_Cases_In_Decl_Part): Make sure that a pragma or aspect Exit_Cases is well formed. (Analyze_Pragma): Make sure that a pragma or aspect Exit_Cases is at the right place. * sem_prag.ads (Analyze_Exit_Cases_In_Decl_Part): Declaration. * doc/gnat_rm/implementation_defined_pragmas.rst: Document the Exit_Cases pragma. * doc/gnat_rm/implementation_defined_aspects.rst: Document the Exit_Cases aspect. * gnat_rm.texi: Regenerate.
2025-01-06ada: Correct xref of operator expression function bodyBob Duff1-2/+11
For an expression function body that is an operator, make sure the xref entry in the ALI file points one past the double quote mark. For example, if the name is ">", point to the greater-than symbol, not the double quote. This was already the case for proper bodies. gcc/ada/ChangeLog: * sem_util.adb (Copy_Subprogram_Spec): When copying an N_Defining_Operator_Symbol, create an N_Defining_Operator_Symbol rather than an N_Defining_Identifier. This will cause Lib.Xref to "skip the initial quote for navigation purposes" (as per comments in Lib.Xref body).
2025-01-06ada: Small housekeeping work in Exp_AggrEric Botcazou1-22/+19
This moves a few declarations around and tweaks a few comments. gcc/ada/ChangeLog: * exp_aggr.adb (Case_Table_Type): Fix reference in comment. (In_Place_Assign_OK): Move declaration around. (Is_Build_In_Place_Aggregate_Return): Likewise and adjust. (Expand_Array_Aggregate): Streamline for the sake of consistency. (Aggr_Assignment_OK_For_Backend): Remove reference to Gigi/gcc. (Backend_Processing_Possible): Likewise. (Expand_Array_Aggregate): Add comment.
2025-01-06ada: cleanup documentation for shift and rotateBob Duff1-18/+16
Documentation updated. gcc/ada/ChangeLog: * sinfo.ads (Shift_Count_OK): Update comments. (Is_Power_Of_2_For_Shift): Likewise.
2025-01-06ada: Fix memory leak when failing to initialize newly allocated memoryEric Botcazou8-27/+140
This makes the compiler generate cleanup code to deallocate the memory when the evaluation of the expression of an allocator raises an exception, if the expression is a call to a function that may raise, i.e. is not declared with the No_Raise aspect/pragma. This can also be disabled by means of -gnatdQ. gcc/ada/ChangeLog: * debug.adb (dQ): Document usage. * exp_ch4.ads (Build_Cleanup_For_Allocator): New declaration. * exp_ch4.adb (Build_Cleanup_For_Allocator): New procedure. (Expand_Allocator_Expression): Build a cleanup to deallocate the memory when the evaluation of the expression raises an exception. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise. * exp_util.adb (Build_Allocate_Deallocate_Proc): Do not generate the detachment if the deallocation is for the cleanup of an allocator. * gen_il-fields.ads (Opt_Field_Enum): Add For_Allocator. * gen_il-gen-gen_nodes.adb (N_Free_Statement): Likewise. * sinfo.ads (For_Allocator): Document usage on N_Free_Statement.
2025-01-06ada: Fix assertion failure on 'Old in post-condition with -gnat2022Eric Botcazou1-2/+11
It comes from a small oversight in the updated implementation for Ada 2022. gcc/ada/ChangeLog: PR ada/117956 * sem_util.adb (Is_Known_On_Entry): Be prepared for constants coming from a renaming declaration.
2025-01-06ada: Declare that the new argument may not be usedTonu Naks1-5/+2
gcc/ada/ChangeLog: * adaint.c (__gnat_locate_exec_on_path): modify function signature
2025-01-06ada: Fix crash on Depends contract with homonym functionsPiotr Trojanek1-5/+1
When resolving names in flow contracts, we refine the ordinary analysis by knowing that an overloaded name must refer to an abstract state and not a function. However, when all overloadings refer to function, we shouldn't crash, but instead let the error to be diagnosed later. gcc/ada/ChangeLog: * sem_prag.adb (Resolve_State): Continue ordinary processing.
2025-01-06ada: Crash in prefix notation with access to class-wide objectJavier Miranda1-10/+19
The compiler crashes analyzing a prefix notation call when its prefix is an access to a class-wide object, an actual parameter is missing, and the sources are compiled with language extensions (-gnatX) and full errors (-gnatf). gcc/ada/ChangeLog: * sem_ch4.adb (Try_Object_Operation): if no candidate interpretation matches the context, redo the same analysis with Report_Error True to report the error.
2025-01-06ada: Plug small loophole in previous changeEric Botcazou1-1/+6
The initial change only deals with the controlled record case for assignment statements, but the controlled array case needs the same treatment. gcc/ada/ChangeLog: * exp_ch5.adb (Expand_Assign_Array): Bail out for controlled components if the RHS is a function call and the assignment has the No_Ctrl_Actions flag set.
2025-01-06ada: Fix printing boolean attributes in the SARIF reportViljar Indus3-4/+21
Boolean attributes should have the value true or false without any quotes. gcc/ada/ChangeLog: * diagnostics-json_utils.adb: Add new method Write_Boolean_Attribute. * diagnostics-json_utils.ads: Likewise. * diagnostics-sarif_emitter.adb (Print_Invocations): print the executionSuccesful property value without extra quotes.