aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2024-08-23ada: First controlling parameter aspectJavier Miranda1-2/+12
gcc/ada/ * sem_ch6.adb (Check_Private_Overriding): Improve code detecting error on private function with controlling result. Fixes the regression of ACATS bde0003.
2024-08-23ada: Fix style in lines starting with assignment operatorPiotr Trojanek24-148/+151
Style cleanup; semantics is unaffected. Offending occurrences found with grep "^ *:=" and fixed manually. gcc/ada/ * checks.ads, cstand.adb, exp_aggr.adb, exp_ch4.adb, exp_ch5.adb, exp_dbug.adb, exp_util.adb, gnatlink.adb, lib-util.adb, libgnat/a-except.adb, libgnat/a-exexpr.adb, libgnat/a-ngcoar.adb, libgnat/s-rannum.adb, libgnat/s-trasym__dwarf.adb, osint.adb, rtsfind.adb, sem_case.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch6.adb, sem_eval.adb, sem_prag.adb, sem_util.adb: Fix style.
2024-08-23ada: Cleanup validity of boolean operatorsPiotr Trojanek1-13/+3
Move detection of always valid expressions from routine Ensure_Valid (which inserts validity checks) to Expr_Known_Valid (which decides their validity). In particular, this patch removes duplicated detection of boolean operators, which were recognized in both these routines. Code cleanup; behavior is unaffected. gcc/ada/ * checks.adb (Ensure_Valid): Remove detection of boolean and short-circuit operators. (Expr_Known_Valid): Detect short-circuit operators; detection of boolean operators was already done in this routine.
2024-08-23ada: Simplify validity checks for scalar parametersPiotr Trojanek1-50/+8
Replace low-level iteration over formal and actual parameters with a call to high-level Find_Actual routine. Code cleanup; behavior is unaffected. gcc/ada/ * checks.adb (Ensure_Valid): Use Find_Actual.
2024-08-23ada: Fix validity checks for named parameter associationsPiotr Trojanek4-12/+10
When iterating over actual and formal parameters, we should use First_Actual/Next_Actual and not simply First/Next, because the order of actual parameters might be different than the order of formal parameters obtained with First_Formal/Next_Formal. This patch fixes a glitch in validity checks for actual parameters and applies the same fix to other misuses of First/Next as well. gcc/ada/ * checks.adb (Ensure_Valid): Use First_Actual/Next_Actual. * exp_ch6.adb (Is_Direct_Deep_Call): Likewise. * exp_util.adb (Type_Of_Formal): Likewise. * sem_util.adb (Is_Container_Element): Likewise; cleanup membership test by using a subtype.
2024-08-23ada: First controlling parameter aspectJavier Miranda1-3/+0
gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Temporarily remove reporting an error when the new aspect is set to True and the extensions are not enabled.
2024-08-23ada: Error missing when 'access is applied to an interface type objectJavier Miranda4-1/+25
The compiler does not report an error when 'access is applied to a non-aliased class-wide interface type object. gcc/ada/ * exp_util.ads (Is_Expanded_Class_Wide_Interface_Object_Decl): New subprogram. * exp_util.adb (Is_Expanded_Class_Wide_Interface_Object_Decl): ditto. * sem_util.adb (Is_Aliased_View): Handle expanded class-wide type object declaration. * checks.adb (Is_Aliased_Unconstrained_Component): Protect the frontend against calling Is_Aliased_View with Empty. Found working on this issue.
2024-08-23ada: First controlling parameter aspectJavier Miranda19-23/+860
This patch adds support for a new GNAT aspect/pragma that modifies the semantics of dispatching primitives. When a tagged type has this aspect/pragma, only subprograms that have the first parameter of this type will be considered dispatching primitives; this new pragma/aspect is inherited by all descendant types. gcc/ada/ * aspects.ads (Aspect_First_Controlling_Parameter): New aspect. Defined as implementation defined aspect that has a static boolean value and it is converted to pragma when the value is True. * einfo.ads (Has_First_Controlling_Parameter): New attribute. * exp_ch9.adb (Build_Corresponding_Record): Propagate the aspect to the corresponding record type. (Expand_N_Protected_Type_Declaration): Analyze the inherited aspect to add the pragma. (Expand_N_Task_Type_Declaration): ditto. * freeze.adb (Warn_If_Implicitly_Inherited_Aspects): New subprogram. (Has_First_Ctrl_Param_Aspect): New subprogram. (Freeze_Record_Type): Call Warn_If_Implicitly_Inherited_Aspects. (Freeze_Subprogram): Check illegal subprograms of tagged types and interface types that have this new aspect. * gen_il-fields.ads (Has_First_Controlling_Parameter): New entity field. * gen_il-gen-gen_entities.adb (Has_First_Controlling_Parameter): The new field is a semantic flag. * gen_il-internals.adb (Image): Add Has_First_Controlling_Parameter. * par-prag.adb (Prag): No action for Pragma_First_Controlling_Parameter since processing is handled entirely in Sem_Prag. * sem_ch12.adb (Validate_Private_Type_Instance): When the generic formal has this new aspect, check that the actual type also has this aspect. * sem_ch13.adb (Analyze_One_Aspect): Check that the aspect is applied to a tagged type or a concurrent type. * sem_ch3.adb (Analyze_Full_Type_Declaration): Derived tagged types inherit this new aspect, and also from their implemented interface types. (Process_Full_View): Propagate the aspect to the full view. * sem_ch6.adb (Is_A_Primitive): New subprogram; used to factor code and also clarify detection of primitives. * sem_ch9.adb (Check_Interfaces): Propagate this new aspect to the type implementing interface types. * sem_disp.adb (Check_Controlling_Formals): Handle tagged type that has the aspect and has subprograms overriding primitives of tagged types that lack this aspect. (Check_Dispatching_Operation): Warn on dispatching primitives disallowed by this new aspect. (Has_Predefined_Dispatching_Operation_Name): New subprogram. (Find_Dispatching_Type): Handle dispatching functions of tagged types that have the new aspect. (Find_Primitive_Covering_Interface): For primitives of tagged types that have the aspect and override a primitive of a parent type that does not have the aspect, we must temporarily unset attribute First_Controlling_ Parameter to properly check conformance. * sem_prag.ads (Aspect_Specifying_Pragma): Add new pragma. * sem_prag.adb (Pragma_First_Controlling_Parameter): Handle new pragma. * snames.ads-tmpl (Name_First_Controlling_Parameter): New name. * warnsw.ads (Warn_On_Non_Dispatching_Primitives): New warning. * warnsw.adb (Warn_On_Non_Dispatching_Primitives): New warning; not set by default when GNAT_Mode warnings are enabled, nor when all warnings are enabled (-gnatwa).
2024-08-20Daily bump.GCC Administrator1-0/+9
2024-08-19gnat: fix lto-type-mismatch between C_Version_String and gnat_version_string ↵Arsen Arsenović2-2/+6
[PR115917] gcc/ada/ChangeLog: PR ada/115917 * gnatvsn.ads: Add note about the duplication of this value in version.c. * version.c (VER_LEN_MAX): Define to the same value as Gnatvsn.Ver_Len_Max. (gnat_version_string): Use VER_LEN_MAX as bound.
2024-08-09Daily bump.GCC Administrator1-0/+62
2024-08-08ada: Missing legality check when type completedSteve Baird2-0/+25
An access discriminant is allowed to have a default value only if the discriminated type is immutably limited. In the case of a discriminated limited private type declaration, this rule needs to be checked when the completion of the type is seen. gcc/ada/ * sem_ch6.adb (Check_Discriminant_Conformance): Perform check for illegal access discriminant default values when the completion of a limited private type is analyzed. * sem_aux.adb (Is_Immutably_Limited): If passed the not-yet-analyzed entity for the full view of a record type, test the Limited_Present flag (which is set by the parser).
2024-08-08ada: Etype missing for raise expressionSteve Baird1-2/+5
If the primitive equality operator of the component type of an array type is abstract, then a call to that abstract function raises Program_Error (when such a call is legal). The FE generates a raise expression to implement this. That raise expression is an expression so it should have a valid Etype. gcc/ada/ * exp_ch4.adb (Build_Eq_Call): In the abstract callee case, copy the Etype of the callee onto the Make_Raise_Program_Error result.
2024-08-08ada: Run-time error with GNAT-LLVM on container aggregate with finalizationGary Dismukes1-1/+2
When unnesting is enabled, the compiler was failing to copy the At_End_Proc field from a block statement to the procedure created to replace it when unnesting of top-level blocks is done. At run time this could lead to exceptions due to missing finalization calls. gcc/ada/ * exp_ch7.adb (Unnest_Block): Copy the At_End_Proc from the block statement to the newly created subprogram body.
2024-08-08ada: Futher refinements to mutably tagged typesJustin Squirek5-21/+71
This patch further enhances the mutably tagged type implementation by fixing several oversights relating to generic instantiations, attributes, and type conversions. gcc/ada/ * exp_put_image.adb (Append_Component_Attr): Obtain the mutably tagged type for the component type. * mutably_tagged.adb (Make_Mutably_Tagged_Conversion): Add more cases to avoid conversion generation. * sem_attr.adb (Check_Put_Image_Attribute): Add mutably tagged type conversion. * sem_ch12.adb (Analyze_One_Association): Add rewrite for formal type declarations which are mutably tagged type to their equivalent type. (Instantiate_Type): Add condition to obtain class wide equivalent types. (Validate_Private_Type_Instance): Add check for class wide equivalent types which are considered "definite". * sem_util.adb (Is_Variable): Add condition to handle selected components of view conversions. Add missing check for selected components. (Is_View_Conversion): Add condition to handle class wide equivalent types.
2024-08-08ada: Spurious maximum nesting level warningsJustin Squirek1-1/+2
This patch fixes an issue in the compiler whereby disabling style checks via pragma Style_Checks ("-L") resulted in the minimum nesting level being zero but the style still being enabled - leading to spurious maximum nesting level exceeded warnings. gcc/ada/ * stylesw.adb (Set_Style_Check_Options): Disable max nesting level when unspecified
2024-08-08ada: Finalization_Size raises Constraint_ErrorJavier Miranda1-1/+24
When the attribute Finalization_Size is applied to an interface type object, the compiler-generated code fails at runtime, raising a Constraint_Error exception. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference) <Finalization_Size>: If the prefix is an interface type, generate code to obtain its address and displace it to reference the base of the object.
2024-08-08Ada, libgnarl: Fix s-taprop__posix.adb compilation.Iain Sandoe1-1/+1
Bootstrap on Darwin, and likely any other targets using the posix implementation of s-taprop was broken by commits between r15-2743 and r15-2747: s-taprop.adb:297:15: error: "size_t" is not visible s-taprop.adb:297:15: error: multiple use clauses cause hiding s-taprop.adb:297:15: error: hidden declaration at s-osinte.ads:58 s-taprop.adb:297:15: error: hidden declaration at i-c.ads:9 This seems to be caused by an omitted change to use Interfaces.C.size_t instead of just size_t. Fixed thus. gcc/ada/ChangeLog: * libgnarl/s-taprop__posix.adb (Stack_Guard): Use Interfaces.C.size_t for the type of Page_Size. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-08-08ada: Fix s-taprop__solaris.adb compilationRainer Orth1-1/+1
Solaris Ada bootstrap is broken as of 2024-08-06 with s-taprop.adb:1971:23: error: "int" is not visible s-taprop.adb:1971:23: error: multiple use clauses cause hiding s-taprop.adb:1971:23: error: hidden declaration at s-osinte.ads:51 s-taprop.adb:1971:23: error: hidden declaration at i-c.ads:62 because one instance of int isn't qualified. This patch fixes this. Bootstrapped without regressions on i386-pc-solaris2.11 and sparc-sun-solaris2.11. 2024-08-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc/ada: * libgnarl/s-taprop__solaris.adb (Set_Task_Affinity): Fully quality int.
2024-08-07Daily bump.GCC Administrator1-0/+73
2024-08-06ada: Fix error in GNATprove inlining with array concatenationYannick Moy1-0/+2
Wrong interpretation of the type of the concatenation can lead to a spurious error in GNATprove when inlining code. Now fixed. gcc/ada/ * sem_ch4.adb (Analyze_Concatenation_Rest): Do not add a wrong interpretation of the concatenation, using the type of the operand already recognized as of the element type.
2024-08-06ada: Implement type inference for generic parametersBob Duff4-36/+485
...based on previous work that added Gen_Assocs_Rec. Minor cleanup of that previous work. gcc/ada/ * sem_ch12.adb: Implement type inference for generic parameters. (Maybe_Infer_One): Forbid inference of anonymous subtypes and types. (Inference_Reason): Fix comment. * debug.adb: Document -gnatd_I switch. * errout.ads: Document that Empty is not allowed for "&". * errout.adb (Set_Msg_Insertion_Node): Minor: Do not allow Error_Msg_Node_1 = Empty for "&". Use "in" instead of multiple "=". Improve comment.
2024-08-06ada: GNAT-LLVM compiler crash on container aggregates with iteratorsGary Dismukes1-2/+9
Recent fixes for container aggregates with iterated element associations exposed a latent bug with loops that are wrapped in blocks, where the loop entity's scope was not adjusted to reflect the new enclosing block scope. gcc/ada/ * sem_ch5.adb (Analyze_Loop_Statement.Wrap_Loop_Statement): Remove the loop Entity_Id from its old scope and insert it in the new block scope that wraps it.
2024-08-06ada: Spurious error on the default value of a derived scalar typeJavier Miranda1-1/+18
When the aspect Default_Value is inherited by a derived scalar type, and both the parent type T and the derived type DT are declared in the same scope, a spurious error may be reported. This occurs if a subprogram declared in the same scope has a parameter of type DT with a default value, leading the compiler to incorrectly flag the default value specified in the aspect of type T as having the wrong type. gcc/ada/ * freeze.adb (Freeze_Entity): For scalar derived types that inherit the aspect Default_Value, do not analyze and resolve the inherited aspect, as the type of the aspect remains the parent type.
2024-08-06ada: Use fully qualified in more library filesViljar Indus2-6/+7
gcc/ada/ * libgnarl/s-interr__hwint.adb: Use fully qualified names to avoid ambiguity. * libgnarl/s-taprop__qnx.adb: Likewise.
2024-08-06ada: Assert failure in repinfoJavier Miranda1-1/+5
Using switch gnatR4, the frontend crashes when generating information for a private record type. gcc/ada/ * repinfo.adb (List_Record_Info): Handle private record types.
2024-08-06ada: Use fully qualified in the runtime libraryViljar Indus4-12/+12
gcc/ada/ * libgnarl/s-taprop__mingw.adb: Use fully qualified names to avoid ambiguity. * libgnarl/s-taprop__posix.adb: Likewise. * libgnarl/s-taprop__qnx.adb: Likewise. * libgnarl/s-taprop__rtems.adb: Likewise.
2024-08-06ada: Fix propagation of SPARK_Mode for renaming-as-bodyYannick Moy2-0/+16
The value of SPARK_Mode associated with a renaming-as-body might not be the correct one, when the private part of the package containing the declaration has SPARK_Mode Off while the public part has SPARK_Mode On. This may lead to analysis of code by GNATprove that should not be analyzed. gcc/ada/ * freeze.adb (Build_Renamed_Body): Propagate SPARK_Pragma to body build from renaming, so that locally relevant value is taken into account. * sem_ch6.adb (Analyze_Expression_Function): Propagate SPARK_Pragma to body built from expression function, so that locally relevant value is taken into account.
2024-08-06ada: Reject use-clause conflicts in the run-time libraryBob Duff10-6/+48
This patch fixes a bug where GNAT would fail to detect certain errors when compiling the run-time library. In particular, if two overloaded homographs are both directly visible, it would pick one, rather than complaining about the ambiguity. The problem was that some special-purpose code in Sem_Ch8 was trying to make a user name take precedence over some run-time library declaration that (incorrectly) appears to be visible because of rtsfind. The solution is to disable that code while compiling the run-time library itself. In addition, we fix the newly-found errors in the run-time library. gcc/ada/ * sem_ch8.adb (Find_Direct_Name): Disable the special-purpose code when we are actually compiling the run-time library itself. * libgnarl/a-exetim__posix.adb: Fix newly-found use-clause conflicts. * libgnat/a-direct.adb: Likewise. * libgnat/a-nbnbin.adb: Likewise. * libgnat/a-timoio__128.adb: Likewise. * libgnat/a-timoio.adb: Likewise. * libgnat/a-wtmoio__128.adb: Likewise. * libgnat/a-wtmoio.adb: Likewise. * libgnat/a-ztmoio__128.adb: Likewise. * libgnat/a-ztmoio.adb: Likewise.
2024-08-03Daily bump.GCC Administrator1-0/+288
2024-08-02ada: Fix handling of SPARK_Mode on standalone child subprogramYannick Moy2-2/+18
SPARK_Mode aspect was not properly propagated to the body of a standalone child subprogram from the generated spec for that subprogram, leading GNATprove to not analyze this body. Now fixed. gcc/ada/ * aspects.adb (Find_Aspect): Take into account the case of a node of kind N_Defining_Program_Unit_Name. * sem_ch10.adb (Analyze_Compilation_Unit): Copy the SPARK aspect from the spec to the body. Delay semantic analysis after that point to ensure that SPARK_Mode is properly analyzed.
2024-08-02ada: Fix handling of iterated component associations with sub-aggregatesPiotr Trojanek2-3/+20
Fix a number of problems in handling of actions generated for a 2-dimensional array aggregate where the outer aggregate has iterated component association and the inner aggregate involves run-time checks. gcc/ada/ * exp_aggr.adb (Add_Loop_Actions): Actions are now attached to iterated component association just like they are attached to ordinary component association. (Build_Array_Aggr_Code): If resolution of the array aggregate generated some actions, e.g. for run-time checks, then we must keep them; same for the Other_Clause. * sem_aggr.adb (Resolve_Iterated_Component_Association): Unset references to iterator variable in loop actions (which might come from run-time check), just these references are unset in the expression itself.
2024-08-02ada: Remove unused null branchPiotr Trojanek1-3/+0
Code cleanup; semantics is unaffected. gcc/ada/ * exp_util.adb (Insert_Actions): Remove null ELSE branch.
2024-08-02ada: Simplify manipulation of the list with loop actionsPiotr Trojanek1-1/+1
Code cleanup; behavior is unaffected. gcc/ada/ * exp_aggr.adb (Add_Loop_Actions): Change manipulation of list to avoid unnecessary calls to Parent and Loop_Actions.
2024-08-02ada: Refactor negated conjunctsPiotr Trojanek1-6/+7
Code cleanup; semantics is unaffected. gcc/ada/ * exp_util.adb (Insert_Actions): Move negation in front of complex conjunctions.
2024-08-02ada: Simplify code by reusing Choice_ListPiotr Trojanek2-11/+5
Code cleanup; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Gen_Assign): Fix layout. * sem_aggr.adb (Empty_Range): Reuse Choice_List.
2024-08-02ada: Errors on legal container aggregates with iterated_element_associationsGary Dismukes7-18/+20
The compiler rejects various cases of container aggregates with iterated_element_associations that include a loop_parameter_subtype_indication or that include the "reverse" keyword. The fixes are in the parser, for naccepting the syntax for these cases, as well as for properly accounting for reverse iterators in the analyzer and expander. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate.Expand_Iterated_Component): Set the Reverse_Present flag when creating the loop's iteration_scheme. * gen_il-gen-gen_nodes.adb: Add flag Reverse_Present to N_Iterated_Component_Association nodes. * par-ch3.adb (P_Constraint_Op): Remove testing for and ignoring of Tok_In following a constraint. It's allowed for "in" to follow a constraint of loop_parameter_subtype_indication of an iterator_specification, so it shouldn't be ignored. * par-ch4.adb (P_Iterated_Component_Association): Account for "reverse" following the "in" in an iterated_component_association, and set the Reverse_Present flag on the N_Iterated_Component_Association node. Add handling for a ":" following the identifier in an iterator_specification of an iterated_element_association, sharing the code with the "of" case (which backs up to the identifier at the beginning of the iterator_specification). Fix incorrect trailing comment following the call to Scan. (Build_Iterated_Element_Association): Set the Reverse_Present flag on an N_Loop_Parameter_Specification node of an N_Iterated_Element_Association. * par-ch5.adb (P_Iterator_Specification): Remove error-recovery and error code that reports "subtype indication is only legal on an element iterator", as that error can no longer be emitted (and was formerly only reported on one fixedbugs test). * sem_aggr.adb (Resolve_Container_Aggregate.Resolve_Iterated_Association): When creating an N_Iterator_Specification for an N_Iterated_Component_Association, set the Reverse_Present flag of the N_Iterated_Specification from the flag on the latter. * sinfo.ads: Add comments for the Reverse_Present flag, which is now allowed on nodes of kind N_Iterated_Component_Association.
2024-08-02ada: Plug loophole in handling of No_Raise pragmaEric Botcazou1-3/+10
Unlike the aspect, the pragma needs to be propagated explicitly from a generic subprogram to its instances. gcc/ada/ * sem_ch12.adb (Analyze_Subprogram_Instantiation): Propagate the No_Raise flag like the No_Return flag.
2024-08-02ada: Tweak container aggregate expansion codeRonan Desplanques1-18/+22
This patch makes a minor modification to Expand_Container_Aggregate in order to silence a GNAT SAS false positive. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Remove variables. (To_Int): New function. (Add_Range_Size): Use newly introduced function.
2024-08-02ada: Add contracts to Ada.Strings.Unbounded and adapt implementationYannick Moy4-260/+2068
Add complete functional contracts to all subprograms in Ada.Strings.Unbounded, except Count, following the specification from Ada RM A.4.5. These contracts are similar to the contracts found in Ada.Strings.Fixed and Ada.Strings.Bounded. A difference is that type Unbounded_String is controlled, thus we avoid performing copies of a parameter Source with Source'Old, and instead apply 'Old attribute on the enclosing call, such as Length(Source)'Old. As Unbounded_String is controlled, the implementation is not in SPARK. Instead, we have separately proved a slightly different implementation for which Unbounded_String is not controlled, against the same specification. This ensures that the specification is consistent. To minimize differences between this test from the SPARK testsuite and the actual implementation (the one in a-strunb.adb), and to avoid overflows in the actual implementation, some code is slightly rewritten. Delete and Insert are modified to return the correct result in all cases allowed by the standard. The same contracts are added to the version in a-strunb__shared.ads and similar implementation patches are applied to the body a-strunb__shared.adb. In particular, tests are added to avoid overflows on strings for which the last index is Natural'Last, and the computations that involve Sum to guarantee that an exception is raised in case of overflow are rewritten to guarantee correct detection and no intermediate overflows (and such tests are applied consistently between the procedure and the function when both exist). gcc/ada/ * libgnat/a-strunb.adb (Sum, Saturated_Sum, Saturated_Mul): Adapt function signatures to more precise types that allow proof. (function "&"): Conditionally assign a slice to avoid possible overflow which only occurs when the assignment is a noop (because the slice is empty in that case). (Append): Same. (function "*"): Retype K to avoid a possible overflow. Add early return on null length for proof. (Delete): Fix implementation to return the correct result in all cases allowed by the Ada standard. (Insert): Same. Also avoid possible overflows. (Length): Rewrite as expression function for proof. (Overwrite): Avoid possible overflows. (Slice): Same. (To_String): Rewrite as expression function for proof. * libgnat/a-strunb.ads: Extend Assertion_Policy to new contracts used. Add complete functional contracts to all subprograms of the public API except Count. * libgnat/a-strunb__shared.adb (Sum): Adapt function signature to more precise types that allow proof. (function "&"): Conditionally assign a slice to avoid possible overflow. (function "*"): Retype K to avoid a possible overflow. (Delete): Fix implementation to return the correct result in all cases allowed by the Ada standard. (Insert): Avoid possible overflows. (Overwrite): Avoid possible overflows. (Replace_Slice): Same. (Slice): Same. (To_String): Rewrite as expression function for proof. * libgnat/a-strunb__shared.ads: Extend Assertion_Policy to new contracts used. Add complete functional contracts to all subprograms of the public API except Count. Mark public part of spec as in SPARK.
2024-08-02ada: Ensure variable is initialized before useRonan Desplanques1-0/+1
This patch is motivated by a GNAT SAS report. gcc/ada/ * scng.adb (Slit): Initialize object in uncommon path.
2024-08-02ada: Remove unreferenced procedureRichard Kenner1-43/+0
gcc/ada/ * exp_ch4.adb (Generate_Temporary): Remove unused procedure.
2024-08-02ada: Clean up handling of inlining of finalizer proceduresRichard Kenner10-32/+25
Change Is_Finalizer from synthesized attribute into flag. Remove duplicate Is_Finalizer_Proc. Add new Try_Inline_Always for backend usage. gcc/ada/ * einfo-utils.ads (Is_Finalizer): Delete. * einfo-utils.adb (Is_Finalizer): Delete. * einfo.ads: Adjust comment. * gen_il-fields.ads, gen_il-gen-gen_entities.adb: Add Is_Finalizer flag. * exp_ch3.adb (Build_Init_Procedure): Set it. * exp_ch7.adb (Create_Finalizer): Likewise. * exp_util.adb (Try_Inline_Always): New function. * exp_util.ads (Try_Inline_Always): New function. * sem_elab.adb (Is_Finalizer_Proc): Replace with Is_Finalizer.
2024-08-02ada: Add leap second support to conversion of Unix_TimeTonu Naks1-65/+70
Unix timestamp jumps one second back when a leap second is applied and doesn't count cumulative leap seconds. This was not taken into account in conversions between Unix time and Ada time. Now fixed. gcc/ada/ * libgnat/a-calend.adb: Modify unix time handling.
2024-08-02ada: Update doc of Style_Checks pragmaTonu Naks3-8/+150
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Add examples. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-08-02ada: Reject ambiguous function calls in interpolated string expressionsJavier Miranda6-55/+213
This patch enhances support for this language feature by rejecting more ambiguous function calls. In terms of name resolution, the analysis of interpolated expressions is now treated as an expression of any type, as required by the documentation. Additionally, support for nested interpolated strings has been removed. gcc/ada/ * gen_il-fields.ads (Is_Interpolated_String_Literal): New field. * gen_il-gen-gen_nodes.adb (Is_Interpolated_String_Literal): The new field is a flag handled by the parser (syntax flag). * par-ch2.adb (P_Interpolated_String_Literal): Decorate the new flag. * sem_ch2.adb (Analyze_Interpolated_String_Literal): Improve code detecting and reporting ambiguous function calls. * sem_res.adb (Resolve_Interpolated_String_Literal): Restrict resolution imposed by the context type to string literals that have the new flag. * sinfo.ads (Is_Interpolated_String_Literal): New field defined in string literals. Fix documentation of the syntax rule of interpolated string literal.
2024-08-02ada: Compiler accepts illegal assignment to reference type target.Steve Baird1-8/+0
An assignment statement whose LHS is of a reference type is never legal. If no other legality rule is violated, then it is ambiguous. In some cases this ambiguity was not correctly detected. gcc/ada/ * sem_ch5.adb (Analyze_Assignment): Delete code that was incorrectly implementing a preference rule.
2024-08-02ada: Finish up support for relaxed finalizationEric Botcazou2-4/+72
This adds a variant of the System.Finalization_Primitives unit that supports only controlled types with relaxed finalization, and adds the description of its implementation to Exp_Ch7. gcc/ada/ * exp_ch7.adb (Relaxed Finalization): New paragraph in head comment. * sem_ch13.adb (Validate_Finalizable_Aspect): Give an error message if strict finalization is required but not supported by the runtime.
2024-08-02ada: Fix handling reference warnings with slicesViljar Indus1-2/+3
gcc/ada/ * sem_util.adb (Set_Referenced_Modified): Set referenced as LHS for the prefixes of array slices.
2024-08-02ada: Reject illegal uses of type/subtype current instanceSteve Baird2-11/+44
The current instance of a type or subtype (see RM 8.6) is an object or value, not a type or subtype. So a name denoting such a current instance is illegal in any context that requires a name denoting a type or subtype. In some cases this error was not detected. gcc/ada/ * sem_ch8.adb (Find_Type): If Is_Current_Instance returns True for N (and Comes_From_Source (N) is also True) then flag an error. Call Is_Current_Instance (twice) instead of duplicating (twice) N_Access_Definition-related code in Is_Current_Instance. * sem_util.adb (Is_Current_Instance): Implement access-type-related clauses of the RM 8.6 current instance rule. For pragmas Predicate and Predicate_Failure, distinguish between the first and subsequent pragma arguments.