aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
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.
2025-01-06ada: Remove level attribute from Rules in the SARIF reportViljar Indus1-6/+0
A Rule object in the SARIF report does not have a level attribute. Result objects are the elements in the SARIF reprot that have a level attribute that ultimately determines the level of each diagnostic object. Rules can have a defaultConfiguration attribute which has a level attribute that can be overridden in multiple ways. This can make the overall report more complex than it needs to be. It is simpler to remove the attribute from rules where it does not really matter and add it back in under the defaultConfiguration when there is an explicit need for it. gcc/ada/ChangeLog: * diagnostics-sarif_emitter.adb (Print_Rule): Remove printing of the level attribute since it does not match the SARIF schema.
2025-01-06ada: Avoid null-exclusion checks for Node_Field_TablePiotr Trojanek3-3/+3
By generating the type of Node_Field_Table with a "not null" qualifier we check the null exclusion of its elements only once, at the object declaration. Tiny performance improvement for the debug builds (because in production builds checks are disabled anyway); semantics is unaffected. gcc/ada/ChangeLog: * gen_il-gen.adb (Put_Tables): Add "not null" to the generated code. * rtsfind.adb (Cstring_Ptr): Same for table with predefined RE_Id error messages. * impunit.adb (Aunit_Record): Same for array of alternative unit names.
2025-01-06ada: Ada version used to compile runtime is constantPiotr Trojanek1-1/+1
Code cleanup. gcc/ada/ChangeLog: * opt.ads (Ada_Version_Runtime): Now a constant, since it cannot and should never be modified.
2025-01-06ada: null procedure cannot be used as compilation unitBob Duff3-19/+14
This patch gives a syntax error if a null procedure is used as a compilation unit. The error was already given during semantic analysis; now it is given in the parser, which is more convenient for other tools like gprbuild, because the -gnats switch now gives the error. Note that the old message "null procedure cannot be declared at library level" was wrong; "library level" is not the same thing as "is a library unit". gcc/ada/ChangeLog: * par-ch10.adb (P_Compilation_Unit): Give an error for "is null". * sem_ch10.adb (Analyze_Subunit): Remove check for "is null" as a subunit. * sem_ch6.adb (Analyze_Subprogram_Declaration): Remove check for "is null" as a library unit.
2025-01-06ada: Cleanup preanalysis of static expressionsJavier Miranda1-0/+6
Complete previous patch; required to avoid regressions in GNATProve. gcc/ada/ChangeLog: * sem_ch6.adb (Analyze_Expression_Function): Set the parent of the new node to be the parent of the original to get the proper context, which is needed for complete error reporting and for semantic analysis. Patch suggested by Eric Botcazou.
2025-01-06ada: C++ exception hierarchies: adjust for gnat-llvmAlexandre Oliva2-16/+47
gnat-llvm doesn't support C++ imports, so arrange for the GNAT.CPP* units to be omitted from gnat-llvm builds. Drop G++ exception interoperability support from raise-gcc.c, so as to not require the GNAT.CPP* units that define some of the required symbols. Co-Authored-By: Olivier Hainque <hainque@adacore.com> gcc/ada/ChangeLog: * Makefile.rtl (LLVM_BUILD): Define based on LLVM_CONFIG. (GNATRTL_NONTASKING_OBJS): Make g-cpp, g-cppstd, and g-cstyin conditional on -gcc or -arm EH, and on no LLVM_BUILD. * raise-gcc.c (GXX_EH_INTEROP): Define as 0 on gnat-llvm or CERT, and 1 otherwise. (__gnat_get_cxx_dependent_exception) Omit on !GXX_EH_INTEROP. (__gnat_maybe_get_cxx_dependent_exception): Likewise. (__gnat_get_cxx_exception_type_info): Likewise. (__gnat_obtain_caught_object): Likewise. (is_handled_by): Omit eid parameter and G++ interop on !GXX_EH_INTEROP. Adjust callers.
2025-01-06ada: Elide copy for calls as default values of nonlimited by-reference ↵Eric Botcazou6-118/+180
components This prevents a temporary from being created on the primary stack to hold the result of the function calls before it is copied to the object being elaborated in the nonlimited by-reference case. That's already not done in the nonlimited non-by-reference case and there is no reason to do it in the former case either. The main issue are the calls to Remove_Side_Effects in Expand_Ctrl_Function_Call (controlled case only) and in Expand_N_Assignment_Statement, which serve various purposes including very technical ones beside removing side effects. The change is therefore very conservative and only removes the copy in the case of a naked function call for the time being. gcc/ada/ChangeLog: * einfo.ads (Returns_By_Ref): Fix description. * exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Do not adjust the component manually (if need be), set No_Finalize_Actions instead of No_Ctrl_Actions for this purpose. Do not adjust when the expression is a naked function call. * exp_ch5.adb (Make_Tag_Ctrl_Assignment): Document the quirks of the function. Assert that the LHS of the assignment does not have side effects and replace calls to Duplicate_Subexpr_No_Checks with calls to New_Copy_Tree. Rename local variable Asn to New_N. (Expand_N_Assignment_Statement): In the tagged or controlled record case, do remove side effects from both operands on entry. Remove them in the controlled record case, except if the RHS is a function call and the assignment has the No_Ctrl_Actions flag set. * exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out when the parent node is an assignment statement with the No_Ctrl_Actions flag set. * sem_util.adb (Statically_Different): Return True for a function call that does not return its result by reference. * sinfo.ads (No_Ctrl_Actions): Adjust description and add a note for the code generator. (No_Finalize_Actions): Likewise.
2025-01-06ada: Follow-on to Use inheritance in Gen_ILBob Duff1-1/+2
Fix too-long line. gcc/ada/ChangeLog: * gen_il-gen.adb: Fix too-long line.
2025-01-06ada: Silence unused parameter warning on linuxTonu Naks1-0/+4
In __gnat_locate_exec_on_path (char *exec_name, int current_dir_on_windows) the recently added second parameter is for windows only. On non-windows platforms its usage is removed by the preprocessor and the compiler reports unused parameter. gcc/ada/ChangeLog: * adaint.c: void parameter on non-windows platforms
2025-01-06ada: Use inheritance in Gen_ILBob Duff4-296/+289
In Gen_IL, detect cases where fields could be inherited from an abstract type instead of being defined in each of two or more descendants of that type. Raise Illegal when that is the case, except in specific cases called out as exceptions to this rule. For every such case, either update the types declared in Gen_Nodes and Gen_Entities to use inheritance, or add the case to the list of exceptions where we do not want to use inheritance. gcc/ada/ChangeLog: * gen_il-internals.ads: Split Fields field into two fields Imm_Fields and Fields. * gen_il-gen.adb: Modify the field-inheritance algorithm to inherit at each level of the type hierarchy, rather than just inheriting into concrete types. For example, if C is a concrete type derived from B, which is in turn derived from A, we now set the Fields of B to include those of A. (We had always set the Fields of C to include those of A and B, and we still do that.) (Compute_Fields_For_One_Type): Detect cases where a given field is declared for all descendants of a given abstract type, in which case we should consider declaring it in the abstract type, and inheriting it in those descendants. (Exception_To_Inheritance_Rule): These are the cases where we could inherit, but we don't want to. * gen_il-gen-gen_nodes.adb: Move fields up the type hierarchy, so they are inherited instead of being defined separately. * gen_il-gen-gen_entities.adb: Likewise.
2025-01-06ada: Fix incorrect incomplete type errorViljar Indus1-1/+3
In Ada 2005 even if the formal is using a tagged limited type then the type should not be considered incomplete. gcc/ada/ChangeLog: * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Exchange_Limited_Views also in Ada 2005.
2025-01-06ada: Fix finalization issue introduced by previous changeEric Botcazou2-4/+5
When detecting calls to subprograms specified for aspects of a type, the entity denoted by the aspects must go through Ultimate_Alias, since that of the name of the calls did the same. gcc/ada/ChangeLog: * exp_ch6.adb (Expand_Call_Helper): Call Ultimate_Alias for the detection of calls to subprograms specified for Constant_Indexing. * exp_util.adb (Is_Indexed_Container): Likewise. (Is_Iterated_Container): Likewise for Default_Iterator.
2025-01-06ada: Fix markup in user's guideRonan Desplanques2-3/+3
gcc/ada/ChangeLog: * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix markup. * gnat_ugn.texi: Regenerate.
2025-01-06ada: Remove workaround for RM_Size being unable to represent unknown sizePiotr Trojanek1-39/+3
When validating instances of Ada.Unchecked_Conversion, we explicitly detected null arrays, because a size of 0 was used to indicate both an unknown size and an actual size of 0. This limitation has been lifted, so we can remove detection of null arrays. Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_ch13.adb (Validate_Unchecked_Conversions): Remove detection of null arrays; remove tests for sizes being present, which are redundant after calling Known_Static_RM_Size.
2025-01-06Ada: fix documentation of pragma Unimplemented_UnitEric Botcazou2-6/+6
gcc/ada PR ada/117936 * doc/gnat_rm/implementation_defined_pragmas.rst (Unimplemented_Unit): Adjust the description of the error message. * gnat_rm.texi: Regenerate.