aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2025-01-23Daily bump.GCC Administrator1-0/+5
2025-01-22d,ada/spec: only sub nostd{inc,lib} rather than nostd{inc,lib}*Arsen Arsenović1-3/+3
This prevents the gcc driver erroneously accepting -nostdlib++ when it should not when Ada was enabled. Also, similarly, -nostdinc* (where * is nonempty) is unhandled by either the Ada or D compiler, so the spec should not substitute those either (thanks for pointing that out, Jakub). Brought to my attention by Michał Górny <mgorny@gentoo.org>. gcc/ada/ChangeLog: * gcc-interface/lang-specs.h: Replace %{nostdinc*} %{nostdlib*} with %{nostdinc} %{nostdlib}. gcc/d/ChangeLog: * lang-specs.h: Replace %{nostdinc*} with %{nostdinc}. gcc/testsuite/ChangeLog: * gcc.dg/driver-nostdlibstar.c: New test.
2025-01-15Daily bump.GCC Administrator1-0/+9
2025-01-14Ada: add missing support for the S/390 and RISC-V architecturesEric Botcazou2-5/+33
...to the object file reader present in the run-time library. gcc/ada/ PR ada/118459 * libgnat/s-objrea.ads (Object_Arch): Add S390 and RISCV. * libgnat/s-objrea.adb (EM_S390): New named number. (EM_RISCV): Likewise. (ELF_Ops.Initialize): Deal with EM_S390 and EM_RISCV. (Read_Address): Deal with S390 and RISCV.
2025-01-14Daily bump.GCC Administrator1-0/+97
2025-01-13ada: Update gnatdll documentation (-b option removed)Pascal Obry2-22/+8
gcc/ada/ChangeLog: * doc/gnat_ugn/platform_specific_information.rst: Update. * gnat_ugn.texi: Regenerate.
2025-01-13ada: Cleanup preanalysis of static expressions (part 5)Javier Miranda1-8/+20
Partially revert the fix for sem_ch13.adb as it does not comply with RM 13.14(7.2/5). gcc/ada/ChangeLog: * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Restore calls to Preanalyze_Spec_Expression that were replaced by calls to Preanalyze_And_Resolve. Add documentation. (Check_Aspect_At_Freeze_Point): Ditto.
2025-01-13ada: Fix relocatable DLL creation with gnatdllPascal Obry2-15/+6
gcc/ada/ChangeLog: * mdll.adb: For the created DLL to be relocatable we do not want to use the base file name when calling gnatdll. * gnatdll.adb: Removes option -d which is not working anymore. And when using a truly relocatable DLL the base-address has no real meaning. Also reword the usage string for -d as we do not want to specify relocatable as gnatdll can be used to create both relocatable and non relocatable DLL.
2025-01-13ada: Remove redundant parentheses inside unary operators (cont.)Piotr Trojanek1-8/+8
GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid build errors. gcc/ada/ChangeLog: * libgnat/a-strunb.ads: Remove redundant parentheses inside NOT operators.
2025-01-13ada: Cleanup preanalysis of static expressions (part 4)Javier Miranda2-7/+23
Fix regression in the SPARK 2014 testsuite. gcc/ada/ChangeLog: * sem_util.adb (Build_Actual_Subtype_Of_Component): No action under preanalysis. * sem_ch5.adb (Set_Assignment_Type): If the right-hand side contains target names, expansion has been disabled to prevent expansion that might move target names out of the context of the assignment statement. Restore temporarily the current compilation mode so that the actual subtype can be built.
2025-01-13ada: Warn about redundant parentheses inside unary operatorsPiotr Trojanek1-0/+38
GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning is now emitted for unary operators as well. gcc/ada/ChangeLog: * par-ch4.adb (P_Factor): Warn when the operand of a unary operator doesn't require parentheses.
2025-01-13ada: Remove redundant parentheses inside unary operators in commentsPiotr Trojanek1-1/+1
GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid future build errors. gcc/ada/ChangeLog: * libgnat/s-genbig.adb: Remove redundant parentheses in comments.
2025-01-13ada: Remove redundant parentheses inside unary operatorsPiotr Trojanek34-115/+115
GNAT already emits a style warning when redundant parentheses appear inside logical and short-circuit operators. A similar warning will be soon emitted for unary operators as well. This patch removes the redundant parentheses to avoid future build errors. gcc/ada/ChangeLog: * checks.adb, exp_dist.adb, exp_imgv.adb, exp_util.adb, libgnarl/a-reatim.adb, libgnat/a-coinve.adb, libgnat/a-nbnbre.adb, libgnat/a-ngcoty.adb, libgnat/a-ngelfu.adb, libgnat/a-ngrear.adb, libgnat/a-strbou.ads, libgnat/a-strfix.ads, libgnat/a-strsea.adb, libgnat/a-strsea.ads, libgnat/a-strsup.ads, libgnat/a-strunb__shared.ads, libgnat/g-alleve.adb, libgnat/g-spitbo.adb, libgnat/s-aridou.adb, libgnat/s-arit32.adb, libgnat/s-dourea.ads, libgnat/s-genbig.adb, libgnat/s-imager.adb, libgnat/s-statxd.adb, libgnat/s-widthi.adb, sem_attr.adb, sem_ch10.adb, sem_ch3.adb, sem_ch6.adb, sem_ch7.adb, sem_dim.adb, sem_prag.adb, sem_res.adb, uintp.adb: Remove redundant parentheses inside NOT and ABS operators.
2025-01-13ada: Fix spurious warning about redundant parentheses in range boundPiotr Trojanek1-5/+11
Use the same logic for warning about redundant parentheses in lower and upper bounds of a discrete range. This fixes a spurious warning that, if followed, would render the code illegal. gcc/ada/ChangeLog: * par-ch3.adb (P_Discrete_Range): Detect redundant parentheses in the lower bound like in the upper bound.
2025-01-13ada: Unbounded recursion on character aggregates with predicated component ↵Gary Dismukes1-5/+6
subtype The compiler was recursing endlessly when analyzing an aggregate of an array type whose component subtype has a static predicate and the component expressions are static, repeatedly transforming the aggregate first into a string literal and then back into an aggregate. This is fixed by suppressing the transformation to a string literal in the case where the component subtype has predicates. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Aggregate): Add another condition to prevent rewriting an aggregate whose type is an array of characters, testing for the presence of predicates on the component type.
2025-01-13ada: Simplify expansion of negative membership operatorPiotr Trojanek2-9/+4
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch4.adb: (Expand_N_Not_In): Preserve Alternatives in expanded membership operator just like preserving Right_Opnd (though only one of these fields is present at a time). * par-ch4.adb (P_Membership_Test): Remove redundant setting of fields to their default values.
2025-01-13ada: Warn about redundant parentheses in upper range boundsPiotr Trojanek1-3/+7
Fix a glitch in condition that effectively caused detection of redundant parentheses in upper range bounds to be dead code. gcc/ada/ChangeLog: * par-ch3.adb (P_Discrete_Range): Replace N_Subexpr, which was catching all subexpressions, with kinds that catch nodes that require parentheses to become "simple expressions".
2025-01-13ada: Add more commentary to System.Val_Real.Large_PowfiveEric Botcazou1-0/+5
gcc/ada/ChangeLog: * libgnat/s-valrea.adb (Large_Powfive) [2 parameters]: Add a couple of additional comments.
2025-01-13ada: Fix parsing of raise expressions with no parensPiotr Trojanek1-6/+4
According to Ada grammar, raise expression is an expression, but requires parens to be a simple_expression. We wrongly classified raise expressions as expressions, because we mishandled a global state variable in the parser. This patch causes some illegal code to be rejected. gcc/ada/ChangeLog: * par-ch4.adb (P_Relation): Prevent Expr_Form to be overwritten when parsing the raise expression itself. (P_Simple_Expression): Fix manipulation of Expr_Form.
2025-01-11Daily bump.GCC Administrator1-0/+37
2025-01-10ada: Incorrect accessibilty level for library level subprogramssquirek1-0/+9
The patch fixes an issue in the compiler whereby accessibility level calculations for objects declared witihin library-level subprograms were done incorrectly - potentially allowing runtime accessibility checks to spuriously pass. gcc/ada/ChangeLog: * accessibility.adb: (Innermost_master_Scope_Depth): Add special case for expressions within library level subprograms.
2025-01-10ada: Remove empty line.Marc Poulhiès1-2/+1
gcc/ada/ChangeLog: * env.h: Remove last empty line.
2025-01-10ada: Set syntactic node properties immediately when crating the nodesPiotr Trojanek5-26/+19
When creating a node, we can directly set its syntactic properties. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * contracts.adb (Build_Call_Helper_Decl): Tune whitespace. * exp_attr.adb (Analyze_Attribute): Set Of_Present while creating the node; reorder setting Subtype_Indication to match the syntax order. * exp_ch3.adb (Build_Equivalent_Aggregate): Likewise for Box_Present and Expression properties. * sem_ch12.adb (Analyze_Formal_Derived_Type): Set type properties when creating the nodes. * sem_ch3.adb (Check_Anonymous_Access_Component): Likewise.
2025-01-10ada: Turn Is_Effective_Use_Clause from syntactic to semantic flagPiotr Trojanek1-2/+2
For a USE clause being effective is a semantic property, not a syntactic. AST cleanup; behavior is unaffected. gcc/ada/ChangeLog: * gen_il-gen-gen_nodes.adb (Gen_Nodes): Change Is_Effective_Use_Clause from syntactic to semantic property.
2025-01-10ada: Reorder syntactic node fields to match the Ada RM grammarPiotr Trojanek3-44/+48
Several AST nodes had their syntactic fields in a different order than specified by the Ada RM grammar. With the variable-size nodes this no longer had an impact on the AST memory layout and was making the automatically generated Nmake routines a bit unintuitive to use. gcc/ada/ChangeLog: * exp_ch3.adb (Predef_Spec_Or_Body): Add explicit parameter associations, because now the Empty_List actual parameter would be confused as being for the Aspect_Specifications formal parameter. * gen_il-gen-gen_nodes.adb (Gen_Nodes): Reorder syntactic fields. * sem_util.adb (Declare_Indirect_Temp): Add explicit parameter association, because now the parameter will be interpreted as a subpool handle name.
2025-01-10Daily bump.GCC Administrator1-0/+32
2025-01-09ada: Fix missing detection of late equality operator returning subtype of ↵Eric Botcazou2-3/+15
Boolean In Ada 2012, the compiler fails to check that a primitive equality operator for an untagged record type must appear before the type is frozen, when the operator returns a subtype of Boolean. This plugs the legality loophole but adds the debug switch -gnatd_q to go back to the previous state. gcc/ada/ChangeLog: PR ada/18765 * debug.adb (d_q): Document new usage. * sem_ch6.adb (New_Overloaded_Entity): Apply the special processing to all equality operators whose base result type is Boolean, but do not enforce the new Ada 2012 freezing rule if the result type is a proper subtype of it and the -gnatd_q switch is specified.
2025-01-09ada: Accept predefined multiply operator for fixed point in expression functionEric Botcazou1-5/+7
The RM 4.5.5(19.1/2) subclause says that the predefined multiply operator for universal_fixed is still available, despite the declaration of a user- defined primitive multiply operator for the fixed-point type at stake, if it is identified using an expanded name with prefix denoting Standard, but this is currently not the case in the context of an expression function. gcc/ada/ChangeLog: PR ada/118274 * sem_ch4.adb (Check_Arithmetic_Pair.Has_Fixed_Op): Use the original node of the operator to identify the case of an expanded name whose prefix is the package Standard.
2025-01-09ada: Error on Disable_Controlled aspect in Multiway_Treessquirek2-49/+39
This patch fixes an issue in the compiler whereby instantiating Multiway_Trees with a formal type leads to a compile-time error due to the expression supplied for aspect Disable_Controlled specified on types decalred within Multiway_Trees' body not being static. gcc/ada/ChangeLog: * libgnat/a-comutr.adb, libgnat/a-comutr.ads: Move the declarations of iterator types into the specification and add additional comments.
2025-01-09ada: Cleanup preanalysis of static expressions (part 3)Javier Miranda2-3/+7
Avoid reporting spurious errors. gcc/ada/ChangeLog: * freeze.adb (Freeze_Expr_Types): Reverse patch; that is, restore calls to Preanalyze_Spec_Expression instead of Preanalyze_And_Resolve for the sake of consistency with Analyze_Expression_Function. Patch suggested by Eric Botcazou. * exp_put_image.adb (Image_Should_Call_Put_Image): Ensure that function Defining_Identifier is called with a proper node to avoid internal assertion failure.
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.