aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2020-10-23[Ada] Further Ada 2020 work on accessibility checkingJustin Squirek14-571/+925
gcc/ada/ * checks.adb (Apply_Accessibility_Check): Skip checks against the extra accessibility of a function result when in Ada 2005 mode or earlier. * exp_ch3.adb (Build_Initialization_Call): Modify accessibility level calls to use Accessibility_Level. (Expand_N_Object_Declaration): Modify accessibility level calls to use Accessibility_Level. * exp_ch4.adb (Expand_Allocator_Expression): Add static check for anonymous access discriminants. Remove unneeded propagation of accessibility actual. (Expand_N_In): Modify accessibility level calls to use Accessibility_Level. (Expand_N_Type_Conversion): Modify accessibility level calls to use Accessibility_Level. * exp_ch5.adb (Expand_N_Assignment_Statement): Modify accessibility level calls to use Accessibility_Level. * exp_ch6.adb (Expand_Call_Helper): Rewrite accessibility calculation for the extra accessibility of result actual in function calls, and modify accessibility level calls to use Accessibility_Level. (Check_Against_Result_Level): Removed. * exp_ch9.adb (Expand_N_Requeue_Statement): Add dynamic accessibility check for requeues * sem_attr.adb (Resolve_Attribute): Modify accessibility level calls to use Accessibility_Level. * sem_ch13.adb (Associate_Storage_Pool): Modify accessibility level calls to use Accessibility_Level. * sem_ch4.adb (Analyze_Call): Add static check for explicitly aliased formals in function calls within return statements. * sem_ch6.adb (Check_Return_Construct_Accessibility): Rewrite routine to account for non-aggregate return objects. (Generate_Minimum_Accessibility): Created. (Analyze_Call): Modify accessibility level calls to use Accessibility_Level. (Analyze_Subprogram_Body_Helper): Add generation of minimum accessibility for the extra accessibility of the function result. * sem_ch9.adb (Analyze_Requeue): Modify accessibility level calls to use Accessibility_Level. * sem_res.adb: (Check_Aliased_Parameters): Modify accessibility level calls to use Accessibility_Level. (Valid_Conversion): Modify accessibility level calls to use Accessibility_Level. * sem_util.adb, sem_util.ads (Accessibility_Level_Helper): Renamed to Accessibility_Level, add detection for functions in prefix notation, and add cases where to return zero when specified. Modified to take new, more descriptive, parameters. (Accessibility_Level): Created. (Function_Call_Level): Removed. (Function_Call_Or_Allocator_Level): Created to centralize the calculation accessibility levels for function calls and allocators. (Static_Accessibility_Level): Removed. (Dynamic_Accessibility_Level): Removed. (Get_Dynamic_Accessibility): Renamed from Get_Accessibility. (In_Return_Value): Created to determine if a given expression contributes to the current function's return value. (Is_Master): Created. (Is_Explicitly_Aliased): Created
2020-10-23[Ada] gnatpp: Document --no-comments-fillBob Duff1-2/+3
gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Document --no-comments-fill.
2020-10-23[Ada] Reject illegal syntax in pragma Contract_CasesPiotr Trojanek2-4/+13
gcc/ada/ * contracts.adb (Analyze_Entry_Or_Subprogram_Contract, Analyze_Subprogram_Body_Stub_Contract): Fix missing references to Subprogram_Variant where similar references to Contract_Cases are present. * sem_prag.adb (Analyze_Contract_Case, Analyze_Variant): Check that aggregate parameter has no expressions. (Analyze_Pragma): Replace Contract_Cases with Subprogram_Variant in a copy-pasted comment.
2020-10-23[Ada] GNAT.Sockets: fix comment typoPhilippe Gil1-4/+4
gcc/ada/ * libgnat/g-socket.ads: Fix comment typo.
2020-10-23[Ada] Implement new legality rules introduced in C.6(12) by AI12-0363Eric Botcazou24-479/+393
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Remove uage restrictions in conjunction with Atomic and Aliased. * gnat_rm.texi: Regenerate. * aspects.ads (Aspect_Id): Add Aspect_Full_Access_Only. (Is_Representation_Aspect): Likewise. (Aspect_Names): Likewise. (Aspect_Delay): Likewise. * einfo.ads (Is_Atomic_Or_VFA): Rename into... (Is_Full_Access): ...this. (Is_Volatile_Full_Access): Document new usage for Full_Access_Only. * einfo.adb (Is_Atomic_Or_VFA): Rename into... (Is_Full_Access): ...this. * freeze.ads (Is_Atomic_VFA_Aggregate): Rename into... (Is_Full_Access_Aggregate): ...this. * freeze.adb (Is_Atomic_VFA_Aggregate): Rename into... (Is_Full_Access_Aggregate): ...this. Adjust to above renaming. (Freeze_Array_Type): Likewise. (Freeze_Entity): Likewise. * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Likewise. (Expand_Record_Aggregate): Likewise. * exp_ch4.adb (Expand_N_Op_Eq): Likewise. * exp_ch5.adb (Expand_Assign_Array): Likewise. * exp_ch8.adb (Evaluation_Required): Likewise. * layout.adb (Layout_Type): Likewise. (Set_Composite_Alignment): Likewise. * sem_aux.ads (Has_Rep_Item): Delete. * sem_aux.adb (Has_Rep_Item): Likewise. * sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Implement new legality rules in C.6(12). * sem_ch12.adb (Instantiate_Object): Likewise. * sem_res.adb (Resolve_Actuals): Likewise. * sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Deal with aspect Full_Access_Only. (Check_False_Aspect_For_Derived_Type): Likewise. (Make_Pragma_From_Boolean_Aspect): Test for the presence of Expr. Deal with aspect Full_Access_Only. (Analyze_Aspects_At_Freeze_Point): Likewise. (Analyze_One_Aspect): Do not set Delay_Required to true even for Always_Delay boolean aspects if they have no expression. Force Delay_Required to true for aspect Full_Access_Only in all cases. Reject aspect Full_Access_Only if not in Ada 2020 mode. (Check_Aspect_At_End_Of_Declarations): Deal with empty expression. (Check_Aspect_At_Freeze_Point): Likewise. (Rep_Item_Entity): Delete. (Inherit_Aspects_At_Freeze_Point): Align handling for Bit_Order with that for Scalar_Storage_Order. * sem_prag.adb (Check_Atomic_VFA): Delete. (Check_VFA_Conflicts): Likewise. (Check_Full_Access_Only): New procedure. (Process_Atomic_Independent_Shared_Volatile): Call to implement the new legality checks in C.6(8/2) and mark the entity last. (Analyze_Pragma) <Pragma_Atomic_Components>: Remove obsolete check. * sem_util.ads (Is_Atomic_Or_VFA_Object): Rename into... (Is_Full_Access_Object): ...this. (Is_Subcomponent_Of_Atomic_Object): Rename into... (Is_Subcomponent_Of_Full_Access_Object): ...this. * sem_util.adb (Inherit_Rep_Item_Chain): Use Present_In_Rep_Item. (Is_Atomic_Or_VFA_Object): Rename into... (Is_Full_Access_Object): ...this. (Is_Subcomponent_Of_Atomic_Object): Rename into... (Is_Subcomponent_Of_Full_Access_Object): ...this and adjust. * snames.ads-tmpl (Name_Full_Access_Only): New name of aspect. * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for renaming. (promote_object_alignment): Likewise. (gnat_to_gnu_field): Likewise. Rename local variable and use specific qualifier in error message for Volatile_Full_Access. * gcc-interface/trans.c (lvalue_required_p): Likewise.
2020-10-23[Ada] Clean up in writing of ALI filesArnaud Charlet2-103/+3
gcc/ada/ * lib-writ.ads, lib-writ.adb (Write_ALI): No longer read existing ALI files in -gnatc mode.
2020-10-23[Ada] Fix logic in C_Select under mingwArnaud Charlet1-11/+10
gcc/ada/ * libgnat/g-socthi__mingw.adb (C_Select): Fix logic in code and make it explicit that we are checking against null values before dereferencing them.
2020-10-23[Ada] Do not use Long_Long_Long_Integer'Image with pragma Discard_NamesEric Botcazou1-5/+8
gcc/ada/ * exp_imgv.adb (Expand_Image_Attribute): For an enumeration type subject to pragma Discard_Names, convert 'Pos to Long_Long_Integer before applying 'Img to the result.
2020-10-23[Ada] Crash on expression function and access typeEd Schonberg1-10/+10
gcc/ada/ * freeze.adb (Freeze_Type_Refs): Add guard on freezing of the designated type of an access type appearing in the expression, when expression includes an explicit dereference whose prefix includes a function call.
2020-10-23[Ada] Fix crash in SPARK on array delta_aggregate with subtype_indicationPiotr Trojanek1-8/+13
gcc/ada/ * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Handle subtype_indication; do not apply range checks for ranges; add comment saying that others_choices is not allowed.
2020-10-23[Ada] Decorate iterated_component_association in SPARK expansionPiotr Trojanek1-1/+94
gcc/ada/ * exp_spark.adb (Expand_SPARK_N_Aggregate, Expand_SPARK_Delta_Or_Update): Expand Iterated_Component_Association occurring within delta aggregates. (Expand_SPARK): Apply SPARK-specific expansion to ordinary aggregates.
2020-10-23[Ada] GNATprove: remove support for external axiomatizationsJohannes Kanig4-218/+1
gcc/ada/ * exp_util.adb, exp_util.ads (Containing_Package_With_Ext_Axioms, Has_Annotate_Pragma_For_External_Axiomatizations): Removed. * sem_ch8.adb (Analyze_Subprogram_Renaming): Removed code related to external axiomatizations. * einfo.ads (Is_Generic_Actual_Subprogram): Removed comment about external axiomatization.
2020-10-23[Ada] Ignore container types for aggregates if not in Ada_2020Ed Schonberg1-0/+1
gcc/ada/ * sem_aggr.adb (Resolve_Aggregate): Do not call Resolve_Container_Aggregate if compilation version is earlier than Ada_2020.
2020-10-23[Ada] Improve documentation of pragma Abort_DeferArnaud Charlet2-2/+30
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Improve documentation of pragma Abort_Defer. * gnat_rm.texi: Regenerate.
2020-10-23[Ada] CUDA: fix CUDA_Execute not working with aggregatesGhjuvan Lacambre1-4/+21
gcc/ada/ * exp_prag.adb (Etype_Or_Dim3): New function. (Expand_Pragma_Cuda_Execute): Use Etype_Or_Dim3 for temporary decls.
2020-10-23[Ada] Error when closing c_streamArnaud Charlet1-2/+2
gcc/ada/ * libgnat/s-fileio.adb (Open): Fix setting of Tempfile.
2020-10-23[Ada] CUDA: Use internal types instead of public onesGhjuvan Lacambre2-61/+121
gcc/ada/ * exp_prag.adb (Get_Launch_Kernel_Arg_Type): Renamed to Get_Nth_Arg_Type and made more generic. (Build_Dim3_Declaration): Now builds a CUDA.Internal.Dim3 instead of a CUDA.Vector_Types.Dim3. (Build_Shared_Memory_Declaration): Now infers needed type from Launch_Kernel instead of using a hard-coded type. (Expand_Pragma_CUDA_Execute): Build additional temporaries to store Grids and Blocks. * rtsfind.ads: Move Launch_Kernel from public to internal package.
2020-10-23[Ada] Missing detection of unused with_clauseArnaud Charlet2-10/+23
gcc/ada/ * sem_ch4.adb (Complete_Object_Operation): Only mark entities referenced if we are compiling the extended main unit. * sem_attr.adb (Analyze_Attribute [Attribute_Tag]): Record a reference on the type and its scope.
2020-10-23[Ada] Prevent copying uninitialized array with address clauseEd Schonberg1-1/+48
gcc/ada/ * freeze.adb (Is_Uninitialized_Aggregate): Recognize an array aggregate with box initialization, scalar components, and no component default values. (Freeze_Entity, Check_Address_Clause): Call it, and simplify freeze code for entity by removing useless assignment.
2020-10-23[Ada] Spurious errors on tagged types with renamed subprogramsJavier Miranda1-3/+11
gcc/ada/ * sem_ch3.adb (Check_Abstract_Overriding): Subprogram renamings cannot be overridden. (Derive_Subprogram): Enable setting attribute Requires_Overriding on functions with controlling access results of record extensions with a null extension part require overriding (AI95-00391/06).
2020-10-23[Ada] Fix scope of index parameter inside a delta aggregatePiotr Trojanek1-2/+2
gcc/ada/ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): Push scope of the implicit loop before entering name of the index parameter, not after; enter name no matter if the identifier has been decorated before.
2020-10-23[Ada] Better error for illegal call to abstract operation in instantiationsGary Dismukes1-0/+19
gcc/ada/ * sem_ch4.adb (Analyze_Call): In the case where the call is not overloaded, check for a call to an abstract nondispatching operation and flag an error.
2020-10-23[Ada] Always enable the support for 128-bit integer types on 64-bit platformsEric Botcazou1-21/+12
gcc/ada/ * gnat1drv.adb (Adjust_Global_Switches): Rewrite again code enabling or disabling the support for 128-bit integer types.
2020-10-23[Ada] Update header of front-end filesArnaud Charlet72-714/+280
gcc/ada/ * alloc.ads, aspects.adb, aspects.ads, atree.adb, atree.ads, casing.adb, casing.ads, csets.adb, csets.ads, debug.adb, debug.ads, einfo.adb, einfo.ads, elists.adb, elists.ads, fname.adb, fname.ads, gnatvsn.adb, gnatvsn.ads, hostparm.ads, indepsw-aix.adb, indepsw-darwin.adb, indepsw-gnu.adb, indepsw.adb, indepsw.ads, krunch.adb, krunch.ads, lib-list.adb, lib-sort.adb, lib.adb, lib.ads, namet-sp.adb, namet-sp.ads, namet.adb, namet.ads, nlists.adb, nlists.ads, opt.adb, opt.ads, output.adb, output.ads, rident.ads, scans.adb, scans.ads, scil_ll.adb, scil_ll.ads, sem_aux.ads, sem_aux.adb, sfn_scan.adb, sinfo.adb, sinfo.ads, sinput.adb, sinput.ads, snames.adb-tmpl, snames.ads-tmpl, stand.ads, stringt.adb, stringt.ads, table.adb, table.ads, types.adb, types.ads, uintp.adb, uintp.ads, uname.adb, uname.ads, urealp.adb, urealp.ads, vast.adb, vast.ads, widechar.adb, widechar.ads: Update header.
2020-10-23[Ada] Take advantage of Long_Long_Long_Integer in From_StringArnaud Charlet3-8/+58
gcc/ada/ * libgnat/a-nbnbin.adb (From_String): Take advantage of Long_Long_Long_Integer. * libgnat/s-genbig.ads, libgnat/s-genbig.adb (To_Bignum): New function taking a Long_Long_Long_Integer.
2020-10-23[Ada] Iterative patch for accessibility cleanupJustin Squirek1-20/+85
gcc/ada/ * sem_util.adb (Accessibility_Call_Helper): In the selected component case, test if a prefix is a function call and whether the subprogram call is not being used in its entirety and use the Innermost_Master_Scope_Depth in that case. (Innermost_Master_Scope_Depth): Test against the node_par instead of its identifier to avoid misattributing unnamed blocks as not being from source. (Function_Call_Level): Add calculation for whether a subprogram call is initializing an object in its entirety. (Subprogram_Call_Level): Renamed to Function_Call_Level.
2020-10-23[Ada] Sync code for external properties with SPARK RMPiotr Trojanek1-35/+29
gcc/ada/ * sem_prag.adb (Check_External_Properties): Rewrite to match the SPARK RM description.
2020-10-23[Ada] Fix whitespace in code for external property pragmasPiotr Trojanek1-8/+8
gcc/ada/ * contracts.adb (Check_Type_Or_Object_External_Properties): Cleanup.
2020-10-23[Ada] Fix default value for re-analysis of external property pragmasPiotr Trojanek1-5/+7
gcc/ada/ * sem_prag.adb (Analyze_External_Property_In_Decl_Part): Set the output parameter Expr_Val to the (implicit) pragma argument even when returning early.
2020-10-23Daily bump.GCC Administrator1-0/+318
2020-10-22[Ada] Enable the support of 128-bit integer types by defaultEric Botcazou8-142/+977
gcc/ada/ * Makefile.rtl (GNATRTL_128BIT_PAIRS): Add i-cexten.ads. * debug.adb (d.H): Document new usage. * doc/gnat_rm/representation_clauses_and_pragmas.rst (Size Clauses): Document new limit on 64-bit platforms. (Component_Size Clauses): Likewise. (Pragma Pack for Arrays): Likewise. (Pragma Pack for Records): Likewise. (Record Representation Clauses): Likewise. * gnat_rm.texi: Regenerate. * gnat1drv.adb (Adjust_Global_Switches): Rewrite code enabling or disabling the support for 128-bit integer types. * switch-c.adb (Scan_Front_End_Switches): Do not deal with e128. * usage.adb (Write_Switch_Char): Do not print -gnate128 switch. * libgnat/i-cexten__128.ads: New file. gcc/testsuite/ * ada/acats/run_all.sh: Define and substitute target_{max,min}_int. * ada/acats/support/macro.dfs: Parameterize {MAX,MIN}_INT. * gnat.dg/assert1.adb: Adjust conditionally to 128-bit integer types. * gnat.dg/size_clause1.adb: Do not expect a warning for LP64 targets. * gnat.dg/warn11.adb: Likewise. * gnat.dg/specs/rep_clause5.ads (Array_2_Type): Add alignment clause.
2020-10-22[Ada] ACATS 4.1H - B853001 - missed errors for renamed limitedJavier Miranda6-121/+229
gcc/ada/ * einfo.ads (Has_Limited_View): New synthesized attribute. * einfo.adb (Has_Limited_View): New synthesized attribute. (Set_Limited_View): Complete assertion. * sem_ch10.ads (Is_Visible_Through_Renamings): Make this routine public to invoke it from Find_Expanded_Name and avoid reporting spurious errors on renamings of limited-with packages. (Load_Needed_Body): Moved to have this spec alphabetically ordered. * sem_ch10.adb (Is_Visible_Through_Renamings): Moved to library level. (Is_Limited_Withed_Unit): New subprogram. * sem_ch3.adb (Access_Type_Declaration): Adding protection to avoid reading attribute Entity() when not available. * sem_ch8.adb (Analyze_Package_Renaming): Report error on renamed package not visible through context clauses. (Find_Expanded_Name): Report error on renamed package not visible through context clauses; handle special case where the prefix is a renaming of a (now visible) shadow package.
2020-10-22[Ada] CUDA: discover runtime types instead of hard-codingGhjuvan Lacambre2-4/+21
gcc/ada/ * exp_prag.adb (Get_Launch_Kernel_Arg_Type): New function. (Build_Shared_Memory_Declaration): Use Get_Launch_Kernel_Arg_Type. (Build_Stream_Declaration): Use Get_Launch_Kernel_Arg_Type. * rtsfind.ads: Remove RO_IC_Unsigned_Long_Long.
2020-10-22[Ada] Add more annotations and assertions in the runtimeArnaud Charlet2-2/+14
gcc/ada/ * libgnat/s-imenne.adb, libgnat/s-imgrea.adb: Add assertions.
2020-10-22[Ada] Update annotations for codepeer analysis on GNAT runtimeArnaud Charlet1-2/+2
gcc/ada/ * libgnat/s-imgrea.adb (Set_Image_Real): Update annotations.
2020-10-22[Ada] AI12-0211: Consistency of inherited nonoverridable aspectsSteve Baird6-3/+317
gcc/ada/ * aspects.ads: Introduce the subtype Nonoverridable_Aspect_Id, whose Static_Predicate reflects the list of nonoverridable aspects given in Ada RM 13.1.1(18.7). * sem_util.ads, sem_util.adb: Add two new visible subprograms, Check_Inherited_Nonoverridable_Aspects and Is_Confirming. The former is used to check the consistency of inherited nonoverridable aspects from multiple sources. The latter indicates whether two aspect specifications for a nonoverridable aspect are confirming. Because of compatibility concerns in compiling QGen, Is_Confirming always returns True if Relaxed_RM_Semantics (i.e., -gnatd.M) is specified. * sem_ch3.adb (Derived_Type_Declaration): Call new Check_Inherited_Nonoverridable_Aspects procedure if interface list is non-empty. * sem_ch9.adb (Check_Interfaces): Call new Check_Inherited_Nonoverridable_Aspects procedure if interface list is non-empty. * sem_ch13.adb (Analyze_Aspect_Specifications): When an explicit aspect specification overrides an inherited nonoverridable aspect, check that the explicit specification is confirming.
2020-10-22[Ada] Update the head comment of Check_Compile_Time_SizeEric Botcazou1-7/+7
gcc/ada/ * freeze.ads (Check_Compile_Time_Size): Adjust size limit.
2020-10-22[Ada] Allow use of debug routines when output is going elsewhereRichard Kenner2-0/+18
gcc/ada/ * sprint.adb (pg, po, ps): Use {Push,Pop}_Output. * treepr.adb (pl, pn): Likewise.
2020-10-22[Ada] Minor fix in GNAT RMEric Botcazou2-10/+10
gcc/ada/ * doc/gnat_rm/implementation_advice.rst: Minor fix. * gnat_rm.texi: Regenerate.
2020-10-22[Ada] Implement AI12-0280's interactions with container aggregatesSteve Baird1-56/+91
gcc/ada/ * sem_util.adb (Is_Container_Aggregate): A new local predicates which indicates whether a given expression is a container aggregate. The implementation of this function is incomplete; in the unusual case of a record aggregate (i.e., not a container aggregate) of a type whose Aggregate aspect is specified, the function will incorrectly return True. (Immediate_Context_Implies_Is_Potentially_Unevaluated): Improve handling of aggregate components. (Is_Repeatedly_Evaluated): Test for container aggregate components along with existing test for array aggregate components.
2020-10-22[Ada] Get rid of useless if-then-else in Exp_Fixd.Fpt_ValueEric Botcazou1-13/+2
gcc/ada/ * exp_fixd.adb (Fpt_Value): Fold if-then-else with identical arms.
2020-10-22[Ada] Ada_2020 AI12-0250: Iterator filters in Iterated_Element_AssocationsEd Schonberg2-15/+58
gcc/ada/ * par-ch4.adb (P_Iterated_Component_Association): If the construct includes an iterator filter it corresponds to an Iterated_Element_Association, so build the proper node for it. * exp_aggr.adb (Expand_Container_Aggregate, Aggregate_Size): If the component is an Iterated_Element_Association, treat it as having a non-static size.
2020-10-22[Ada] Fix parser not detecting casing issues in keywordsGhjuvan Lacambre1-1/+8
gcc/ada/ * scng.adb (Scan): Check if any letter of the token is uppercase.
2020-10-22[Ada] Wrong accessibility for conversion to named accessJustin Squirek1-0/+7
gcc/ada/ * sem_util.adb (Accessibility_Level_Helper): Conversions to named access types get the level associated with the named access type.
2020-10-22[Ada] Adjust documentation for Has_Constrained_Partial_View flagEric Botcazou1-1/+1
gcc/ada/ * einfo.ads (Has_Constrained_Partial_View): Add "base type" marker.
2020-10-22[Ada] AI12-0095 Formal types and Constrained Partial ViewsGary Dismukes2-4/+4
gcc/ada/ * einfo.adb (Has_Constrained_Partial_View): Apply Base_Type to Id. * sem_res.adb (Resolve_Actuals.Check_Aliased_Parameter): Remove "not Is_Generic_Type" test and call Object_Type_Has_Constrained_Partial_View instead of Has_Constrained_Partial_View. Improve related error message to say "does not statically match" instead of just "does not match".
2020-10-22[Ada] Implement AI12-0030: Stream attribute availabilitySteve Baird5-5/+163
gcc/ada/ * sem_util.ads, sem_util.adb: Declare and implement a new predicate, Derivation_Too_Early_To_Inherit. This function indicates whether a given derived type fails to inherit a given streaming-related attribute from its parent type because the declaration of the derived type precedes the corresponding attribute_definition_clause of the parent. * exp_tss.adb (Find_Inherited_TSS): Call Derivation_Too_Early_To_Inherit instead of unconditionally assuming that a parent type's streaming attribute is available for inheritance by an immediate descendant type. * sem_attr.adb (Stream_Attribute_Available): Call Derivation_Too_Early_To_Inherit instead of unconditionally assuming that a parent type's streaming attribute is available for inheritance by an immediate descendant type. * exp_attr.adb (Default_Streaming_Unavailable): A new predicate; given a type, indicates whether predefined (as opposed to user-defined) streaming operations for the type should be implemented by raising Program_Error. (Expand_N_Attribute_Reference): For each of the 4 streaming-related attributes (i.e., Read, Write, Input, Output), after determining that no user-defined implementation is available (including a Stream_Convert pragma), call Default_Streaming_Unavailable; if that call returns True, then implement the streaming operation as "raise Program_Error;".
2020-10-22[Ada] Fix bogus error on conversion from Float to 128-bit unsignedEric Botcazou1-0/+18
gcc/ada/ * checks.adb (Apply_Float_Conversion_Check): Saturate the bounds of the check to those of the base type of the expression.
2020-10-22[Ada] Reimplementation of accessibility checkingJustin Squirek18-1312/+994
gcc/ada/ * checks.adb (Apply_Accessibility_Check): Modify condition to avoid flawed optimization and use Get_Accessibility over Extra_Accessibility. * exp_attr.adb: Remove inclusion of Exp_Ch2.adb. * exp_ch2.adb, exp_ch2.ads (Param_Entity): Moved to sem_util. * exp_ch3.ads (Init_Proc_Level_Formal): New function. * exp_ch3.adb (Build_Init_Procedure): Add extra accessibility formal for init procs when the associated type is a limited record. (Build_Initialization_Call): Add condition to handle propagation of the new extra accessibility paramter actual needed for init procs. (Init_Proc_Level_Formal): Created to fetch a the extra accessibility parameter associated with init procs if one exists. * exp_ch4.adb (Build_Attribute_Reference): Modify static check to be dynamic. * exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Move logic used to expand conditional expressions used as actuals for anonymous access formals. (Expand_Call_Helper): Remove extranious accessibility calculation logic. * exp_util.adb: Remove inclusion of Exp_Ch2.adb. * par-ch3.adb (P_Array_Type_Definition): Properly set Aliased_Present on access definitions * sem_attr.adb (Resolve_Attribute): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_ch13.adb (Storage_Pool): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_ch6.adb (Check_Return_Construct_Accessibility): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_ch9.adb (Analyze_Requeue): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_res.adb (Check_Aliased_Parameter, Check_Allocator_Discrim_Accessibility, Valid_Conversion): Replace instances for Object_Access_Level with Static_Accessibility_Level. * sem_util.adb, sem_util.ads (Accessibility_Level_Helper): Created to centralize calculation of accessibility levels. (Build_Component_Subtype): Replace instances for Object_Access_Level with Static_Accessibility_Level. (Defining_Entity): Add extra parameter to dictate whether an error is raised or empty is return in the case of an irrelevant N. (Dynamic_Accessibility_Level): Rewritten to use Accessibility_Level_Helper. (Is_View_Conversion): Check membership against Etype to capture nodes like explicit dereferences which have types but are not expanded names or identifers. (Object_Access_LeveL): Removed. (Param_Entity): Moved from sem_util. (Static_Accessibility_Level): Created as a replacement to Object_Access_Level, it also uses Accessibility_Level_Helper for its implementation. * snames.ads-tmpl: Added new name for extra accessibility parameter in init procs.
2020-10-22[Ada] Refactor appending to possibly empty listsPiotr Trojanek2-17/+5
gcc/ada/ * exp_prag.adb (Expand_Pragma_Contract_Cases, Expand_Pragma_Loop_Variant): Reuse Append_New_To. * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Fix typo. (Analyze_Pre_Post_Condition): Refactor repeated calls to Defining_Entity.