aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2025-01-06Daily bump.GCC Administrator1-0/+7
2025-01-05Ada: Fix build for dummy s-tapropEstevan Castilho (Tevo)1-9/+2
gcc/ada * libgnarl/s-taprop__dummy.adb: Remove use clause for System.Parameters. (Unlock): Remove Global_Lock formal parameter. (Write_Lock): Likewise.
2025-01-04Daily bump.GCC Administrator1-0/+401
2025-01-03ada: Rely on default parameter when making non-null nodesPiotr Trojanek4-15/+11
When calling Make_Access_To_Object_Definition and Make_Parameter_Specification we can rely on the default value of parameter Null_Exclusion_Present being False. This makes code cleaner and consistent with relying on the default value of other parameters of this routine. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch3.adb, exp_ch4.adb, exp_disp.adb, inline.adb: Remove explicit actual parameter Null_Exclusion_Present equal False.
2025-01-03ada: Rely on default parameter when making non-constant nodesPiotr Trojanek2-7/+2
When calling Make_Access_To_Object_Definition and Make_Object_Declaration we can rely on the default value of parameter Constant_Present being False. This makes code cleaner and consistent with relying on the default value of other parameters of this routine, like Null_Exclusion_Present. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch3.adb, exp_disp.adb: Remove explicit actual parameter Constant_Present equal False; tune comments.
2025-01-03ada: Rely on default parameter when making component definition nodesPiotr Trojanek6-36/+7
When calling Make_Component_Definition we can rely on the default value of parameter Aliased_Present being False. This makes code cleaner and consistent with relying on the default value of other parameters of this routine, e.g. Null_Exclusion_Present. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch3.adb, exp_ch9.adb, exp_dist.adb, exp_imgv.adb, exp_util.adb, sem_dist.adb: Remove explicit actual parameter Aliased_Present equal False; tune comments and whitespace.
2025-01-03ada: Simplify code for obtaining function entity from a function callPiotr Trojanek1-22/+2
Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_ch5.adb (Check_Call): Reuse Get_Called_Entity.
2025-01-03ada: Remove extra checks for raising a constraint errorPiotr Trojanek2-13/+3
Routine Is_OK_Static_Expression itself calls Raises_Constraint_Error, so there is no need to call both of these routines in a row. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_attr.adb (Check_Array_Type): Remove extra call. * sem_util.adb (Static_Boolean): Likewise.
2025-01-03ada: Reuse and simplify counting the length of various listsPiotr Trojanek6-84/+26
Use utility routines to compute number of elements in lists of nodes and chains of formal parameters. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_aggr.adb (Others_Check): Reuse List_Length; tune whitespace. * exp_ch3.adb (Constrain_Array): Remove counting of constraints. * exp_disp.adb (Make_DT): Use Elist utility routines; tune whitespace. * sem_ch12.adb (Formal_Dimensions): Reuse List_Length. (Valid_Default_Attribute): Reuse Number_Formals. * sem_prag.adb (Process_Convention): Likewise. * sem_util.adb (Normalize_Actuals): Likewise. (Check_Function_Writable_Actuals): Reuse List_Length.
2025-01-03ada: Remove guards against empty listsPiotr Trojanek2-19/+6
There is no need to guard against calling First on a No_List, in which case the call intentionally returns Empty. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * contracts.adb (Create_Generic_Contract): Remove calls to Present. * sem_util.adb (Normalize_Actuals): Likewise.
2025-01-03ada: Enclosing_Entity of specless subprogram bodiesBob Duff1-5/+8
Correct Enclosing_Entity of specless subprogram bodies; these are marked as Comes_From_Source = False, so the simple name was missing. gcc/ada/ChangeLog: * sem_util.adb (Append_Entity_Name): Do not skip the simple name for a compilation unit (which includes the case of specless subprogram bodies).
2025-01-03ada: Fix comments and change subtype name in response to reviewTucker Taft1-10/+17
gcc/ada/ChangeLog: * pprint.adb (Expression_Image): Adjust and improve comments to match style recommendations, and change name of subtype from Not_Associative to Non_Associative, in response to code review.
2025-01-03ada: Add parentheses in expressions involving combinations of and & orTucker Taft1-7/+46
In the Expression_Image function, we were not inserting parentheses properly when there was a sequence of and and or operators, even though Ada requires such parentheses to show the correct order of association. gcc/ada/ChangeLog: * pprint.adb (Expression_Image): In local function Expr_Name add a No_Parens flag and define a subtype Not_Associative to represent the short-circuit operations and And/Or/Xor. Insert parentheses to separate the subexpressions when different "Not_Associative" operations occur in a sequence.
2025-01-03ada: Fix latent issue exposed by latest changeEric Botcazou3-28/+20
The finalization machinery needs to precisely locate the point where the initialization of objects is complete in order to generate the attachment to the finalization master. For objects initialized with a built-in-place function call, this is achieved by means of the BIP_Initialization_Call field present in their entity node, but this field is only set in the case where the enclosing scope is transient, which is not guaranteed. gcc/ada/ChangeLog: * einfo.ads (BIP_Initialization_Call): Adjust description. * exp_ch4.adb (Expand_N_Case_Expression): Adjust commentary. (Expand_N_If_Expression): Likewise. * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): Set BIP_Initialization_Call unconditionally in the definite case.
2025-01-03ada: Refine subtype of a universal arithmetic utility routinePiotr Trojanek1-2/+2
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * uintp.adb (N_Digits): Refine return subtype, since this routine always returns a positive number of digits.
2025-01-03ada: Reuse existing utility routine to detect attribute Loop_EntryPiotr Trojanek3-9/+3
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * checks.adb (Generate_Index_Checks): Reuse existing utility routine. * sem_ch4.adb (Analyze_Indexed_Component_Form): Likewise. * sem_prag.adb (Analyze_Pragma): Likewise.
2025-01-03ada: Simplify uses of the global name bufferPiotr Trojanek2-23/+7
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_dist.adb (Assign_Subprogram_Identifier, Reserve_NamingContext_Methods): Simplify. * osint.adb (Append_Suffix_To_File_Name, Find_File, Get_Directory, Object_File_Name, Strip_Directory): Likewise.
2025-01-03ada: Simplify check for No_Coextensions restrictionPiotr Trojanek1-2/+2
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Alocator): Move unrelated code out of a declare block.
2025-01-03ada: Simplify traversal procedures into traversal functionsPiotr Trojanek4-66/+35
Instead of using the generic routine Traverse_Proc to set a global flag when a particular node is found, we can use its underlying routine Traverse_Func and check if traversal has been abandoned. We already used this pattern in a number of places; this patch merely applies it the remaining uses of Traverse_Proc. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch3.adb (Search_Access_Discriminant, Search_Current_Instance, Search_Internal_Call): Use traversal function instead of traversal procedure and remove associated global variables. * exp_util.adb (Search_Calls): Likewise. * sem_prag.adb (Contains_Loop_Entry): Likewise. * sem_util.adb (Mentions_Post_State): Likewise.
2025-01-03ada: Assorted style cleanupsPiotr Trojanek2-2/+2
Whitespace and comment cleanups. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): Fix comment for attribute Image. * tbuild.adb (Make_SC): Remove extra whitespace.
2025-01-03ada: Handle C++ exception hierarchiesAlexandre Oliva19-89/+1550
This patch introduces support for defining exceptions in Ada with C++'s notion of exception type compatibility, such as handling occurrences of derived types, and obtaining class-wide access to the thrown/raised objects. As a bonus, it adds support for C++ dependent (wrapped) exceptions, and introduces types and interfaces to match C++'s std::type_info and std::exception. Support for C++ exceptions with base-type matching, added to raise-gcc by calling subprograms in Ada units, requires these units and their dependencies to be linked into programs that link with raise-gcc. gcc/ada/ChangeLog: * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-cpp, g-cppstd, and g-cstyin. * doc/gnat_rm/interfacing_to_other_languages.rst (Interfacing to C++): Document class-wide matching and new interfaces. * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Add class-wide exception matching support with 'B' as language identifier. * libgnat/a-exexpr.adb (Setup_Current_Excep): Add Id formal. (Set_Foreign_Occurrence): Likewise. (Propagate_GCC_Exception): Adjust. (Set_Exception_Parameter): Likewise. (Unhandled_Except_Handler): Likewise. * libgnat/g-cpp.ads: New. * libgnat/g-cppexc.adb (Raise_Cpp_Exception): Match 'B' lang id. (Get_Object_Address): New. (Get_Object): Rewrite. (Get_Access_To_Object): New. (Get_Access_To_Tagged_Object): New. (Get_Type_Info): New. (Convert_Caught_Object): New. * libgnat/g-cppexc.ads (Get_Object_Address): New. (Get_Object): Note the Cpp Convention requirement. (Get_Access_To_Object): New. (Get_Access_To_Tagged_Object): New. (Get_Type_Info): New. * libgnat/g-cppstd.adb: New. * libgnat/g-cppstd.ads: New. * libgnat/g-csclex.ads: New, unused. * libgnat/g-cstyin.adb: New. * libgnat/g-cstyin.ads: New. * libgnat/g-excact.adb (Exception_Language): New. (Is_Foreign_Exception): Rewrite. * libgnat/g-excact.ads (Exception_Languages): New. (Exception_Language): New. * libgnat/s-stalib.ads (Lang): Document 'B'. * raise-gcc.c (__gnat_setup_current_excep): Add Exception_Id formal. (CXX_DEPENDENT_EXCEPTION_CLASS): New. (cxx_type_info): New. (__cxa_exception): Rename exceptionType to encompass PrimaryException. (_GNAT_Exception): Drop wrapper. (EID_For): Adjust. (exception_class_eq): Likewise. (__gnat_exception_language_is_cplusplus): New. (__gnat_exception_language_is_ada): New. (__gnat_convert_caught_object): Declare. (__gnat_get_cxx_dependent_exception): New. (__gnat_maybe_get_cxx_dependent_exception): New. (__gnat_get_cxx_exception_type_info): New. (__gnat_obtain_caught_object): New. (is_handled_by): Adjust. [!CERT] Add eid formal, handle dependent exceptions and base-type matches. (get_action_description_for) [!CERT]: Add eid formal. Adjust. (personality_body): Adjust. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS, GNATBIND_OBJS) [!STAGE1]: Add new g-cpp, g-cppstd, g-cstyin + preexisting g-cppexc and i-cstrin. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate.
2025-01-03ada: Improve and correct support for inheritance of nonoverriding aspectsGary Dismukes12-921/+1301
This set of changes fixes various issues with the handling of inheritance of nonoverridable aspects (such as for Aggregate, and the indexing and iterator aspects, among others), plus improves some of the error reporting related to those. The prior implementation incorrectly handled types derived from container types with respect to such aspect inheritance, not properly inheriting the parent type's aspects, leading to rejection of legal constructs (such as container aggregates for the derived type). Also, various errors were incorrect (such as stating the wrong aspect) or unclear. In the case of types with indexing aspects, the resolution of indexed names for such types involved locating the eligible indexing functions anew with the analysis of each indexed name, which was both inefficient and wrong in some cases. That is addressed by locating the functions once, when the aspects are resolved, rather doing the location of those in two places, which is a maintenance hazard and could result in inconsistent resolution. Note that this completes work originally undertaken by Ed Schonberg that was also worked on by Steve Baird. gcc/ada/ChangeLog: * diagnostics-constructors.adb (Make_Default_Iterator_Not_Primitive_Error): Revise message to match message change made in sem_ch13.adb. * freeze.adb (Freeze_Record_Type): Output appropriate aspect name in error message, using Get_Name_String. (Freeze_Entity): For derived types, call Analyze_Aspects_At_Freeze_Point on the parent type, and call Inherit_Nonoverridable_Aspects on the type (for both parent type and any progenitor types). Add with_clause for System.Case_Util. * gen_il-fields.ads: Add Aspect_Subprograms to type Opt_Field_Enum. * gen_il-gen-gen_nodes.adb: Add field Aspect_Subprograms to N_Aspect_Specification nodes. * sem_ch4.adb (Try_Container_Indexing): Remove Find_Indexing_Operations and the code calling it. Add new function Indexing_Interpretations for retrieving the eligible indexing functions from the appropriate aspect's Aspect_Subprograms list and call that instead of Find_Value_Of_Aspect. * sem_ch7.adb (Analyze_Package_Specification): In loop over entities, call Analyze_Aspects_At_Freeze_Point for types that have delayed aspects. * sem_ch13.ads (Analyze_Aspects_At_Freeze_Point): Add Nonoverridable_Only formal to restrict processing to nonoverridable aspects. (Check_Function_For_Indexing_Aspect): New exported procedure renamed from Check_One_Function and moved to library level. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Test new formal Nonoverridable_Only formal to skip processing of aspects that are not nonoverridable when the formal is True. Skip the processing for Aspect_Full_Access_Only when Nonoverridable_Only is True. Call Check_Indexing_Functions in the case of indexing aspects (procedure moved from Analyze_Attribute_Definition_Clause to top level). (Analyze_Aspect_Specifications): Locate closest ancestor type with an explicit matching aspect to determine the aspect spec to reference in the error about a nonoverridable aspect not confirming an inherited aspect (skipping intermediate derived parents). Ensures that we retain existing errors flagged on explicit ancestor aspects rather than implicit inherited ones. Change names of variables Parent_Type and Inherited_Aspect to Ancestor_Type and Ancestor_Aspect respectively for clarity. (Analyze_Attribute_Definition_Clause): Move nested subprograms Check_Iterator_Functions and Check_Primitive_Function to top level of package. Move Check_Indexing_Functions (and its nested subprograms) from here to within Analyze_Aspects_At_Freeze_Point (adding some formal parameters and adjusting the code appropriately, and no longer call it from this procedure). (Is_CW_Or_Access_To_CW): Add test for the parent type having the indexing aspect for proper setting of Aspect_Specification_Is_Inherited. Delete "???" comment. (Look_Through_Anon_Access): Remove unneeded tests of Is_Access_Constant and Name_Constant_Indexing, which lead to wrong messages in some cases. (Check_Function_For_Indexing_Aspect): Procedure renamed from Check_One_Function and moved to library level (was nested within Check_Indexing_Functions), plus added formals (including Valid, to check result). Move scope test to beginning, to immediately exclude subprograms not declared immediately within the same scope as the type. Improve several error messages. Add error checking for Constant_Indexing functions. Append the function entity to the Aspect_Subprograms list of the aspect specification. Move code for checking for nonconfirming index aspects and for checking for illegal indexing aspects on full views to Check_Indexing_Functions. (Check_Indexing_Functions): Move procedure Illegal_Indexing from here to within Check_Function_For_Indexing_Aspect. Add a comment to the loop over interpretations about the checking being done as legality rules rather than resolution rules, plus a note referencing AI22-0084. Check for nonconfirming indexing aspects and illegal indexing aspects on full views here rather than in Check_One_Function (now named Check_Function_For_Indexing_Aspect). Remove function Check_One_Function (moved to library level and renamed), and call Check_Function_For_Indexing_Aspect instead. (Check_Inherited_Indexing): Improve spec comment. Remove nested function Same_Chars, and replace call Same_Chars with call to Sem_Util.Same_Name. Replace call to Illegal_Indexing with call to Error_Msg_NE. (Check_One_Function): Unnested from Check_Indexing_Functions, rename to Check_Function_For_Indexing_Aspect, move body to library level, and move declaration to Sem_Ch13 spec. (Analyze_Attribute_Definition_Clause, case Attribute_Default_Iterator): Improve error message related to tagged-type requirement. Suppress call to Check_Iterator_Functions for attribute definition clauses associated with inherited aspects. Remove error checking that is redundant with checking done in Check_Iterator_Functions. (Check_Aspect_At_Freeze_Point, case Attribute_Default_Iterator): Call Check_Iterator_Functions (only if the aspect is not Comes_From_Source). (Check_Iterator_Functions): Procedure unnested from Analyze_Attribute_Definition_Clause. Add formals Typ and Expr. Error messages corrected to say "aspect Default_Iterator" instead of "aspect Iterator". (Valid_Default_Iterator): Improve error message to say "must be a local primitive or class-wide function" instead of "must be a primitive function". (Check_Primitive_Function): Unnested from Analyze_Attribute_Definition_Clause. Add formal Ent. (Rep_Item_Too_Late): Return False when an attribute_definition_clause is not Comes_From_Source, since it was generated by the compiler (such as for an inherited aspect). (Resolve_Aspect_Aggregate): Capture implementation base type. (Valid_Empty): Use implementation base types for result type comparison. (Valid_Add_Named): Use impl base types for comparison of formal's type. (Valid_Add_Unnamed): Use impl base types for comparison of formal's type. (Valid_New_Indexed): Use impl base types for result type comparison. (Validate_Literal_Aspect): Return immediately when aspect does not have Comes_From_Source True (no point in validating inherited aspects). * sem_res.adb (Has_Applicable_User_Defined_Literal): Remove Base_Type comparison and always call Corresponding_Op_Of_Derived_Type for derived types. Add "???" comment about issue with wrapper functions (and indicate that it would be nice to eliminate the call to Corresponding_Primitive_Op). * sem_util.ads (Inherit_Nonoverridable_Aspects): New procedure. (Corresponding_Op_Of_Derived_Type): Update spec comment to indicate return of Ancestor_Op and name changed from Corresponding_Primitive_Op. * sem_util.adb (Check_Inherited_Nonoverridable_Aspects): Fix name in header comment. (Corresponding_Op_Of_Derived_Type): Move declaration of Typ down with other local variables. Remove Assert that doesn't apply in some cases. Simply return Ancestor_Op when it isn't a primitive (it can be a class-wide op). Function name changed from Corresponding_Primitive_Op. (Find_Untagged_Type_Of): Add test of Is_Type (E) as a guard for checking Direct_Primitive_Operations. Remove Assert (False), and return Empty when the primitive is not found. (Profile_Matches_Ancestor): Change comparisons to use implementation base types of the operations' formal and result types. Add tests for interface ancestors. Revise "???" comment. (Is_Confirming): Simplify name-matching test to use the names associated with the aspects rather than going to the N_Attribute_Definition_Clause nodes (may facilitate elimination of those clauses at some point). (Inherit_Nonoverridable_Aspects): New procedure to traverse the aspects of a derived type's parent type and create inherited versions of the parent type's nonoverridable aspects, identifying the appropriate subprograms for each such inherited aspect. (Inherit_Nonoverridable_Aspect): New procedure nested in Inherit_Nonoverridable_Aspects to inherit individual nonoverridable aspects. Identifies the corresponding subprogram(s) associated with an inherited nonoverridable aspect. In the case of indexing aspects, new eligible indexing functions of the type are also identified here, and the entities of all of the identified subprograms are appended to the aspect's Aspect_Subprograms Elist. Add a "???" comment about this. * sinfo.ads: Add documentation for the new Aspect_Subprograms field.
2025-01-03ada: Fix small thinko in previous changeEric Botcazou1-3/+1
Even if the declaration of the conditional object is turned into a renaming during expansion, the conditional object must be finalized when the original object would have been. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Create the Master_Node even if the declaration is turned into a renaming.
2025-01-03ada: Leave empty parent in an array component of an anonymous access typePiotr Trojanek1-6/+0
An itype created for a record component with an anonymous access type has empty parent. However, a similar itype created for an array component has its parent copied from the parent of the array type. The above discrepancy appears to be not needed for the frontend. Also, it is confusing for the GNATprove backend, because it looks like the itype entity of the array component comes from a declaration of the array itself. gcc/ada/ChangeLog: * sem_ch3.adb (Array_Type_Declaration): Don't copy parent for an itype created by an array component declaration.
2025-01-03ada: Incompatible conversion on vxworks in socket.cDouglas B Rupp1-2/+2
In the vxworks section, a conversion between char* and int is attempted, which results in a warning with gcc. However with clang with is an error. Note also on 64bit targets, there's a size mismatch. gcc/ada/ChangeLog: * socket.c [__vxworks]: Change vxw_h_addr type to long from int, and cast the conversion of char* to vxw_h_addr to avoid warning/error.
2025-01-03ada: Do not search executables in current dir by defaultTonu Naks5-21/+39
gcc/ada/ChangeLog: * adaint.c: change default behaviour of __gnat_locate_exec_on_path * adaint.h: change prototype of __gnat_locate_exec_on_path * libgnat/s-os_lib.adb: pass optional argument in Locate_Exec_On_Path * libgnat/s-os_lib.ads: change spec of Locate_Exec_On_Path * libgnat/s-trasym__dwarf.adb: update import of __gnat_locate_exec_on_path
2025-01-03ada: Fix double free at run time for class-wide allocationEric Botcazou1-0/+16
The previous change was too aggressive and overlooked a specific case. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_Allocator_Expression): Put back the call to Remove_Side_Effects in the case of a function call, a class-wide designated type and a regular storage pool.
2025-01-03ada: Warn on unmodified parameters of expression functionsBob Duff2-14/+46
If an 'out' or 'in out' parameter is not modified in a function body, we warn. However, the warning was missing when we have an expression function instead of a proper body. This patch enables the warning on expression functions. gcc/ada/ChangeLog: * sem_ch6.adb (Analyze_Expression_Function): Mark the implicit spec for an expression function as Comes_From_Source. (Analyze_Null_Procedure): Minor cleanup. * sem_warn.adb (Source_E1): New function to compute whether to give warnings. In particular, return True for [in] out parameters of expression functions.
2025-01-03ada: Avoid failing reanalysis of aggregate boundsSteve Baird1-2/+0
An expression like Some_Package."+" (Arg1, Arg2) is sometimes transformed during expansion into an unqualified call of the form "+" (Arg1, Arg2). This is normally ok, but it means that reanalysis of the expression is likely to fail and must therefore be avoided. Remove code that was forcing such reanalysis (the original reason for the now-removed code is unknown). gcc/ada/ChangeLog: * exp_aggr.adb (Check_Bounds): Remove calls that were setting the Analyzed flag to False for two aggregate bound expressions.
2025-01-03ada: Improve expansion of conditional expressions in object declarationsEric Botcazou9-147/+455
This arranges for conditional expressions in objects declarations to have their expansion delayed when they have a type that cannot be easily copied or copied at all, including limited and controlled types. The ultimate goal is to replace the declaration with a renaming declaration of the dereference of an access value designating an object initialized with the dependent expression chosen by the condition. gcc/ada/ChangeLog: * einfo.ads (Is_Independent): Document usage on Master_Node objects. * exp_aggr.adb (In_Place_Assign_OK): Remove Parent_Kind variable. (Convert_To_Assignments): Call Unconditional_Parent and remove the restriction on the known size for the in-place expansion of the aggregate in the context of an object declaration. (Expand_Array_Aggregate): Remove Parent_Kind variable and call Unconditional_Parent and Delay_Conditional_Expressions_Between * exp_ch3.adb: Remove clauses for Exp_Dbug. (Expand_N_Object_Declaration): Factor out the code rewriting the declaration as a renaming in Rewrite_Object_Declaration_As_Renaming and call the procedure. * exp_ch4.adb (Insert_Conditional_Object_Declaration): Declare. (Expand_N_Case_Expression): Delay expanding the expression if it is in the context of an optimizable object declaration. If the parent node is this object declaration, then replace it with a renaming of the dereference of an access value designating an object initialized with the dependent expression chosen by the condition. (Expand_N_If_Expression): Likewise. (Insert_Conditional_Object_Declaration): New procedure. * exp_ch6.adb (Expand_Ctrl_Function_Call): Test the unconditional parent in the case of an object declaration too. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Pass Strict to Processing_Actions from the Is_Independent flag on a Master_Node. * exp_util.ads (Rewrite_Object_Declaration_As_Renaming): Declare. * exp_util.adb: Add clauses for Exp_Dbug. (Rewrite_Object_Declaration_As_Renaming): New procedure extracted from Expand_N_Object_Declaration. * sem_ch3.adb (Analyze_Object_Declaration): Also leave the analysis if the declaration has been replaced with a renaming in the case of an initialization expression that is a conditional expression.
2025-01-03ada: Preliminary work in analysis and expansion of initialized allocatorsEric Botcazou3-159/+160
This makes the expansion of the various cases of initialized allocators more uniform by factoring out common processing as much as possible. This also avoids giving the warning or error for a default-initialized allocator when it is marked with No_Initialization. No functional changes. gcc/ada/ChangeLog: * checks.adb (Apply_Predicate_Check): Preserve Comes_From_Source. * exp_ch4.adb (Expand_Allocator_Expression): Factor out common code for the various cases. Also delay applying the 2nd predicate check. In the default case, defer to Make_Build_In_Place_Call_In_Allocator entirely in the build-in-place case. * sem_ch4.adb (Analyze_Allocator): Do not give the warning or error for a default-initialized allocator with No_Initialization.
2025-01-03ada: Remove useless space in ALI P linesRonan Desplanques1-1/+0
The generated ALI files are syntactically unchanged. gcc/ada/ChangeLog: * lib-writ.adb (Write_ALI): Remove useless space.
2025-01-03ada: Fix omissions of ALI P line parametersRonan Desplanques2-21/+20
Before this patch, the compiler would not report various tasking settings specified in library units when these library units did not use tasking, or when they were predefined. While this behavior was implemented deliberately, that was a long time ago and it proved to be a pitfall that could cause configuration pragmas to be silently ignored. This patch makes the compiler report the aforementioned tasking settings in ALI files unconditionally. Also, this patch fixes an incorrect statement and a couple of typos in the spec of Lib.Writ. gcc/ada/ChangeLog: * lib-writ.adb (Write_ALI): Remove condition for writing P line parameters. * lib-writ.ads: Fix typos. Clarify comment.
2025-01-03Daily bump.GCC Administrator1-0/+5
2025-01-02Update copyright dates.Jakub Jelinek2-2/+2
Manual part of copyright year updates. 2025-01-02 Jakub Jelinek <jakub@redhat.com> gcc/ * gcc.cc (process_command): Update copyright notice dates. * gcov-dump.cc (print_version): Ditto. * gcov.cc (print_version): Ditto. * gcov-tool.cc (print_version): Ditto. * gengtype.cc (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/fortran/ * gfortranspec.cc (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libitm/ * libitm.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year.
2025-01-02Rotate ChangeLog files.Jakub Jelinek16-8321/+8302
Rotate ChangeLog files for ChangeLogs with yearly cadence. Also remove empty lines before Form Feed line.
2024-12-23Daily bump.GCC Administrator1-0/+12
2024-12-22Ada: Fix GNU/Hurd maximum prioritySamuel Thibault1-1/+1
gcc/ada/ChangeLog: * libgnat/system-gnu.ads: Set Max_Priority to 60. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2024-12-22Ada: Add GNU/Hurd glibc api bitsSamuel Thibault1-7/+7
They are mostly shared with Linux gcc/ada/ChangeLog: * s-oscons-tmplt.c [__GNU__] (_XOPEN_SOURCE, _BSD_SOURCE): Define. [__GNU__]: Include <pthread.h> and <signal.h> [__GNU__]: Set MSG_Forced_Flags to "MSG_NOSIGNAL". [__GNU__]: Define SIZEOF_sigset. [__GNU__]: Define PTHREAD_*SIZE Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2024-12-19Daily bump.GCC Administrator1-0/+6
2024-12-18Output the load address in backtraces for PIE executables on DarwinSimon Wright1-1/+19
This aligns Darwin with Linux and Windows. gcc/ada/ PR target/117538 * libgnat/s-trasym.adb (Symbolic_Traceback): Prepend the load address of the executable if it is not null.
2024-12-15Daily bump.GCC Administrator1-0/+6
2024-12-14opts: Use OPTION_SET_P instead of magic value 2 for -fshort-enums default ↵Jakub Jelinek1-1/+1
[PR118011] The magic values for default (usually -1 or sometimes 2) for some options are from times we haven't global_options_set, I think we should eventually get rid of all of those. The PR is about gcc -Q --help=optimizers reporting -fshort-enums as [enabled] when it is disabled. For this the following patch is just partial fix; with explicit gcc -Q --help=optimizers -fshort-enums or gcc -Q --help=optimizers -fno-short-enums it already worked correctly before, with this patch it will report even with just gcc -Q --help=optimizers correct value on most targets, except 32-bit arm with some options or defaults, so I think it is a step in the right direction. But, as I wrote in the PR, process_options isn't done before --help= and even shouldn't be in its current form where it warns on some option combinations or errors or emits sorry on others, so I think ideally process_options should have some bool argument whether it is done for --help= purposes or not, if yes, not emit warnings and just adjust the options, otherwise do what it currently does. 2024-12-14 Jakub Jelinek <jakub@redhat.com> PR c/118011 gcc/ * opts.cc (init_options_struct): Don't set opts->x_flag_short_enums to 2. * toplev.cc (process_options): Test !OPTION_SET_P (flag_short_enums) rather than flag_short_enums == 2. gcc/ada/ * gcc-interface/misc.cc (gnat_post_options): Test !OPTION_SET_P (flag_short_enums) rather than flag_short_enums == 2.
2024-12-14Daily bump.GCC Administrator1-0/+208
2024-12-13ada: Fix internal error on packed record with 0-size componentEric Botcazou1-1/+17
The problem is that the order of components listed in a constant CONSTRUCTOR does not match that of the associated record type. gcc/ada/ChangeLog: * gcc-interface/utils2.cc (compare_elmt_bitpos): Deal specially with 0-sized components when the bit position is the same.
2024-12-13ada: Pass artificial_p to create_type_declTom Tromey1-2/+2
The recent "nameless types" change to gcc-interface caused the gdb pretty-printer for VSS to fail. This happens because one call to create_type_decl unconditionally passes "true" as the "artificial_p" parameter. This patch changes this call to instead pass the entity's local artificial_p value instead. This makes sense, I think, because the type decl being created for debug purposes (as the comment says) is there to represent the relevant entity from the source. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Pass artificial_p to create_type_decl.
2024-12-13ada: Cleanup preanalysis of static expressionsJavier Miranda16-164/+144
During preanalysis, the frontend does not generate freeze nodes. The exception to this rule occurs during the preanalysis of default and per-object expressions, where static expressions are frozen. A patch merged six years ago to address an issue in this area introduced additional complexity and confusion regarding the frontend's behavior in such cases. The purpose of this patch is to revert that change, simplifying the support for the preanalysis of static expressions to make it cleaner and easier to understand. gcc/ada/ChangeLog: * sem.ads (Inside_Preanalysis_Without_Freezing): Removed. * sem.adb (Semantics): Remove Inside_Preanalysis_Without_Freezing. * sem_ch6.adb (Preanalyze_Formal_Expression): Removed. * sem_ch3.ads (Preanalyze_Assert_Expression): Add documentation. (Preanalyze_Spec_Expression): Add documentation. * sem_ch3.adb (Preanalyze_Assert_Expression) Code cleanup. (Preanalyze_Default_Expression): Code cleanup. * sem_res.ads (Preanalyze_With_Freezing_And_Resolve): Removed. * sem_res.adb (Preanalyze_With_Freezing_And_Resolve): Removed. (Preanalyze_And_Resolve): Code cleanup. * freeze.adb (Freeze_Entity): No freeze under strict preanalysis. (Freeze_Expression): Code cleanup. (Freeze_Expr_Types): Replace call to Preanalyze_Spec_Expression by strict preanalysis during preanalysis of a duplicate of the expression performed to have available the minimum decoration to locate referenced unfrozen types. * sem_aggr.adb (Resolve_Array_Aggregate): Minor code cleanup. * sem_attr.adb (Resolve_Attribute): Add documentation. * sem_ch13.adb (Resolve_Aspect_Expressions[Aspect_Default_Value]): Replace call to Preanalyze_Spec_Expression by Preanalyze_And_Resolve. (Resolve_Aspect_Expressions[Aspect_Default_Component_Value]): Ditto. * sem_ch8.adb (Set_Entity_Or_Discriminal): Code cleaup. * sem_prag.adb (Analyze_Initial_Condition_In_Decl_Part): Replace call to Preanalyze_Assert_Expression by call to Preanalyze_And_Resolve. (Analyze_Pre_Post_Condition): Replace call to Preanayze_Spec_Expression by call to Preanalyze_Assert_Expression. * sem_util.ads (In_Pragma_Expression): Adding a formal to extend the functionality of this subprogram. (Within_Static_Expression): New subprogram. * sem_util.adb (In_Pragma_Expression): Ditto. (Within_Static_Expression): Ditto. * checks.adb (Install_Null_Excluding_Check): No check during preanalysis. (Install_Primitive_Elaboration_Check): Ditto.
2024-12-13ada: Improve expansion of nested conditional expressions in return statementsEric Botcazou8-91/+332
This arranges for nested conditional expressions in simple return statements to have their expansion delayed until the returns are distributed into their dependent expressions. This comprises the case of the elsif part of an if expression present in the source code. This also distributes qualified expressions into the dependent expressions of conditional expressions, although this seems to occur rarely in practice. gcc/ada/ChangeLog: * exp_aggr.ads (Is_Delayed_Conditional_Expression): Move to... * exp_aggr.adb (Is_Delayed_Conditional_Expression): Move to... (Convert_To_Assignments): Use Delay_Conditional_Expressions_Between. * exp_ch3.adb (Expand_N_Object_Declaration): Reset the Analyzed flag by means of Unanalyze_Delayed_Conditional_Expression. * exp_ch4.adb (Expand_N_Case_Expression): Likewise. Delay expanding the expression if it is in the context of a simple return statement. (Expand_N_If_Expression): Likewise. (Expand_N_Qualified_Expression): Fold identical operand. Distribute the expression into an operand that is a conditional expression with expansion delayed. (Process_Transient_In_Expression): Also test the parent node for the presence of a simple return statement. * exp_ch6.adb (Expand_Ctrl_Function_Call): Test the unconditional parent node for the presence of a simple return statement. * exp_util.ads (Delayed Expansion): New description. (Delay_Conditional_Expressions_Between): New procedure. (Is_Delayed_Conditional_Expression): ...here. (Unanalyze_Delayed_Conditional_Expression): New procedure. (Unconditional_Parent): New function. * exp_util.adb (Find_Hook_Context): Take into account conditional statements coming from conditional expressions. (Within_Conditional_Expression): Likewise. (Delay_Conditional_Expressions_Between): New procedure. (Is_Delayed_Conditional_Expression): ...here. (Unanalyze_Delayed_Conditional_Expression): New procedure. (Unconditional_Parent): New function. * sinfo.ads (Expansion_Delayed): Adjust description.
2024-12-13ada: Fix indentation in record component declarationsPiotr Trojanek4-8/+8
Code cleanup. gcc/ada/ChangeLog: * exp_aggr.adb (Case_Bounds): Fix indentation. * sem_case.adb (Choice_Bounds): Likewise. * libgnat/s-dourea.ads (Duuble_T): Likewise. * libgnat/s-excmac__arm.ads (Cleanup_Cache_Type): Likewise.
2024-12-13ada: Fix code indentationPiotr Trojanek34-253/+254
Fix uncontroversial coding style violations detected by an experiment with a tree-sitter indentation support in Emacs. gcc/ada/ChangeLog: * atree.adb, diagnostics-pretty_emitter.adb, diagnostics-utils.adb, einfo-utils.adb, errout.adb, exp_aggr.adb, exp_ch3.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_imgv.adb, exp_pakd.adb, exp_prag.adb, exp_unst.adb, exp_util.adb, gnatchop.adb, gnatlink.adb, inline.adb, itypes.adb, osint.adb, rtsfind.adb, sem_aggr.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch4.adb, sem_dim.adb, sem_elab.adb, sem_prag.adb, sem_util.adb, sprint.adb, switch-m.adb, table.adb: Fix code indentation.