aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/snames.ads-tmpl
AgeCommit message (Collapse)AuthorFilesLines
2020-07-10[Ada] Reformatting and typo correctionsGary Dismukes1-1/+1
gcc/ada/ * exp_aggr.adb, exp_spark.adb, sem_ch13.ads, sem_ch13.adb, snames.ads-tmpl: Minor reformatting and typo fixes.
2020-07-10[Ada] Part of implementation of AI12-0212: container aggregatesEd Schonberg1-0/+9
gcc/ada/ * aspects.ads: Add Aspect_Aggregate. * exp_aggr.adb (Expand_Container_Aggregate): Expand positional container aggregates into separate initialization and insertion operations. * sem_aggr.ads (Resolve_Container_Aggregate): New subprogram. * sem_aggr.adb (Resolve_Container_Aggregate): Parse aspect aggregate, establish element types and key types if present, and resolve aggregate components. * sem_ch13.ads (Parse_Aspect_Aggregate): Public subprogram used in validation, resolution and expansion of container aggregates * sem_ch13.adb (Parse_Aspect_Aggregate): Retrieve names of primitives specified in aspect specification. (Validate_Aspect_Aggregate): Check legality of specified operations given in aspect specification, before nane resolution. (Resolve_Aspect_Aggregate): At freeze point resolve operations and verify that given operations have the required profile. * sem_res.adb (Resolve): Call Resolve_Aspect_Aggregate if aspect is present for type. * snames.ads-tmpl: Add names used in aspect Aggregate: Empty, Add_Named, Add_Unnamed, New_Indexed, Assign_Indexed.
2020-06-16[Ada] Implement AI12-0249, AI12-0295 (user-defined numeric & string literals)Steve Baird1-0/+3
2020-06-16 Steve Baird <baird@adacore.com> gcc/ada/ * snames.ads-tmpl: Define names of the three new aspects. * aspects.ads: Define the three new aspects. * sem_util.ads, sem_util.adb, sem_dim.adb: Move the function String_From_Numeric_Literal from being declared in the body of package Sem_Dim to being declared in the visible part of package Sem_Util. * sem_ch13.ads, sem_ch13.adb: Declare new visible procedure Validate_Literal_Aspect. This is where most of the legality checking occurs for an aspect specification for one of the three new aspects, as well as resolution of the subprogram named in the aspect specification. Follow example of other aspects (e.g., Validate_Literal_Aspect is called in much the same way as Validate_Iterable_Aspect in Analyze_Aspects_At_Freeze_Point; a small amount of legality checking is performed in Analyze_One_Aspect in much the same way as for Default_Value or Default_Component_Value aspects). Most of the work is done in Validate_Literal_Aspect. * contracts.adb (Add_Contract_Item): Call Validate_Literal_Aspect in much the same way that Validate_Iterable_Aspect was already being called. * sem_res.adb (Resolve): Rewrite a literal as a call if it is a user-defined literal. This is where the dynamic semantics of the 3 new aspects are implemented. * sem_ch6.adb (Fully_Conformant_Expressions): Two numeric literals that have different text but the same value (e.g., 12345 and 12_345) do not conform if they are user-defined literals. Introduce a new function User_Defined_Numeric_Literal_Mismatch to avoid duplication in making this check. * sem_type.adb (Has_Compatible_Type): A numeric literal can be compatible with a non-numeric type (and a string literal can be compatible with a non-string type) if it can be interpreted as a user-defined literal.
2020-06-15[Ada] Support aspect Relaxed_Initialization and attribute InitializedPiotr Trojanek1-0/+3
2020-06-15 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * aspects.ads (Aspect_Id): Add Aspect_Relaxed_Initialization. (Implementation_Defined_Aspect): Add new aspect. (Aspect_Argument): Add new aspect with Optional_Expression argument. (Is_Representation_Aspect): Add new aspect as a non-representation one. (Aspect_Names): Add name for the new aspect. (Aspect_Delay): Add new aspect as a non-delayed one. * sem_ch3.adb: Minor reformatting. * einfo.ads, einfo.adb (Is_Relaxed_Initialization_State): New query; reuses existing code for querying abstract state options. * exp_attr.adb (Expand_N_Attribute_Reference): For now ignore attribute 'Initialized. * sem_attr.adb (Analyze_Attribute_Old_Result): Allow attribute 'Result to be used in the aspect Relaxed_Initialization expression. (Analyze_Attribute): Analyze attribute 'Initialized; based on existing code for attribute 'Valid_Scalars. (Eval_Attribute): Do not expect attribute 'Initialized, just like attribute 'Valid_Scalars is not expected. * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): New routine. (Analyze_Aspect_Specifications): Analyze new aspect in a dedicated routine. (Check_Aspect_At_Freeze_Point): Do not expect new aspect. * sem_prag.adb (Analyze_Abstract_State): Support option Relaxed_Initialization on abstract states. * sem_util.ads, sem_util.adb (Has_Relaxed_Initialization): New query for the GNATprove backend. * snames.ads-tmpl (Snames): Add Name_Ids for the new aspect and attribute; add an Attribute_Id for the new attribute.
2020-06-12[Ada] Alphabetic ordering for name and pragmasPiotr Trojanek1-2/+2
2020-06-12 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * par-prag.adb: Fix ordering. * snames.ads-tmpl (Name_Test_Case, Pragma_Test_Case): Likewise. * sem_prag.adb (Sig_Flags): Likewise.
2020-06-10[Ada] AI12-0311 New checks for language-defined unitsArnaud Charlet1-1/+8
2020-06-10 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * snames.ads-tmpl (Name_Characters_Assertion_Check, Name_Containers_Assertion_Check, Name_Interfaces_Assertion_Check, Name_IO_Assertion_Check, Name_Numerics_Assertion_Check, Name_Strings_Assertion_Check, Name_System_Assertion_Check): New constants. * types.ads (Characters_Assertion_Check, Containers_Assertion_Check, Interfaces_Assertion_Check, IO_Assertion_Check, Numerics_Assertion_Check, Strings_Assertion_Check, System_Assertion_Check): New constants. (All_Checks): Update accordingly.
2020-06-09[Ada] Implement AI12-0028: Import of variadic C functionsEric Botcazou1-27/+74
2020-06-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch6.adb (Freeze_Subprogram): Deal with convention C_Family. * freeze.adb (Freeze_Profile): Likewise. Add missing guard. * sem_mech.adb (Set_Mechanisms): Likewise. * lib-xref.adb (Output_Import_Export_Info): Ditto for C_Variadic. * repinfo.adb (List_Subprogram_Info): Likewise. * sem_prag.adb (Set_Convention_From_Pragma): Move main checks for Stdcall to... (Process_Convention): ...here. Add checks for C_Variadic. * snames.ads-tmpl: Add Name_C_Variadic_0 .. Name_C_Variadic_16. Use consistent format for subtype declarations. (Convention_Id): Add Convention_C_Variadic_0 .. C_Variadic_16 and move Convention_CPP up. (Convention_C_Family): New subtype of Convention_Id. (Convention_C_Variadic): Likewise. (Foreign_Convention): Use explicit upper bound. Add pragma Inline for Is_Configuration_Pragma_Name, Is_Function_Attribute_Name, Is_Internal_Attribute_Name and Is_Procedure_Attribute_Name. * snames.adb-tmpl (Get_Convention_Id): Deal with Name_Variadic_n. (Get_Convention_Name): Deal with Convention_Variadic_n. * types.h (Convention_Id): New typedef. * xsnamest.adb (Name2): New variable. (Is_Conv): New pattern. (Get_Subt1): Likewise. (Get_Subt2): Likewise. Output subtypes of Convention_Id into the C header file.
2020-06-08[Ada] Implement AI12-0291 (Jorvik profile)Steve Baird1-0/+1
2020-06-08 Steve Baird <baird@adacore.com> gcc/ada/ * libgnat/s-rident.ads: Add Jorvik to the Profile_Name enumeration type. Add an element for Jorvik to the array aggregate that is the initial value of the constant Profile_Info. * targparm.adb (Get_Target_Parameters): Handle "pragma Profile (Jorvik);" similarly to "pragma Profile (Ravenscar);". * snames.ads-tmpl: Declare Name_Jorvik Name_Id. Unlike Ravenscar, Jorvik is not a pragma name and has no corresponding element in the Pragma_Id enumeration type; this means that its declaration must not occur between those of First_Pragma_Name and Last_Pragma_Name. * sem_prag.adb (Analyze_Pragma): Add call to Set_Ravenscar_Profile for Jorvik, similar to the existing calls for Ravenscar and the GNAT Ravenscar variants.
2020-06-08[Ada] Restore Snames.Name_SPARK as it used in the GNATprove backendPiotr Trojanek1-0/+1
2020-06-08 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * snames.ads-tmpl (Name_SPARK): Restore after being deleted.
2020-06-08[Ada] Remove processing of SPARK_05 restrictionArnaud Charlet1-1/+0
2020-06-08 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * exp_aggr.adb, exp_ch6.adb, par-ch11.adb, par-ch6.adb, par-ch7.adb, par-prag.adb, restrict.adb, restrict.ads, scans.ads, scng.adb, sem_aggr.adb, sem_attr.adb, sem_ch11.adb, sem_ch12.adb, sem_ch3.adb, sem_ch3.ads, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_res.adb, sem_util.adb, sem_util.ads, snames.ads-tmpl, gnatbind.adb, libgnat/s-rident.ads, doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: Remove processing of SPARK_05 restriction. * gnat_rm.texi: Regenerate. * opt.ads: Remove processing of old checksum which is now handled by gprbuild directly.
2020-06-08[Ada] AI12-0309 Missing checks for pragma SuppressArnaud Charlet1-0/+2
2020-06-08 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * snames.ads-tmpl (Name_Program_Error_Check, Name_Tasking_Check): New constants. * types.ads (Program_Error_Check, Tasking_Check): New constants. (All_Checks): Update accordingly.
2020-06-05[Ada] Support 'Reduce under -gnatXArnaud Charlet1-1/+1
2020-06-05 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * scng.adb (Scan): Fix typo to take into account all future versions of Ada. * sem_attr.ads (Attribute_Impl_Def): Add Attribute_Reduce for now. * sem_attr.adb (Analyze_Attribute): Only allow 'Reduce under -gnatX. * snames.ads-tmpl (Name_Reduce): Update comment.
2020-06-04[Ada] Put_Image attributeBob Duff1-0/+2
2020-06-04 Bob Duff <duff@adacore.com> gcc/ada/ * libgnat/a-stobbu.adb, libgnat/a-stobbu.ads, libgnat/a-stobfi.adb, libgnat/a-stobfi.ads, libgnat/a-stoubu.adb, libgnat/a-stoubu.ads, libgnat/a-stoufi.adb, libgnat/a-stoufi.ads, libgnat/a-stoufo.adb, libgnat/a-stoufo.ads, libgnat/a-stouut.adb, libgnat/a-stouut.ads, libgnat/a-stteou.ads, libgnat/s-putaim.adb, libgnat/s-putaim.ads, libgnat/s-putima.adb, libgnat/s-putima.ads (Ada.Strings.Text_Output and children, System.Put_Images): New runtime support for Put_Image. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add exp_put_image.o. * exp_put_image.adb, exp_put_image.ads: New compiler package that generates calls to runtime routines that implement Put_Image. * Makefile.rtl: Add object files for Ada.Strings.Text_Output and children and System.Put_Images. * aspects.adb: Simplify initialization of Canonical_Aspect. * aspects.ads: Improve documentation. Add Aspect_Put_Image. * exp_attr.adb: Add support for Put_Image, by calling routines in Exp_Put_Image. * sem_util.adb (Is_Predefined_Dispatching_Operation): Return True for new TSS_Put_Image operation. * exp_ch3.adb: For tagged types, build a dispatching TSS_Put_Image operation by calling routines in Exp_Put_Image. * exp_disp.adb, exp_disp.ads: Make TSS_Put_Image be number 10, adjusting other operations' numbers after 10. We choose 10 because that's the last number shared by all runtimes. * exp_strm.adb: Use named notation as appropriate. * exp_cg.adb, exp_tss.ads: Add TSS_Put_Image. * libgnat/a-tags.ads: Modify Max_Predef_Prims for the new TSS_Put_Image. * impunit.adb: Add new runtime packages. * rtsfind.adb, rtsfind.ads: Add support for Ada.Strings.Text_Output, Ada.Strings.Text_Output.Utils, and System.Put_Images. * sem_attr.adb: Error checking for Put_Image calls. * sem_ch12.adb (Valid_Default_Attribute): Support for passing Put_Image as a generic formal parameter. * sem_ch13.adb: Analysis of Put_Image aspect. Turn it into a Put_Image attribute definition clause. * sem_ch8.adb (Analyze_Subprogram_Renaming): Support for renaming of the Put_Image attribute. * snames.adb-tmpl: Fix comments. * snames.ads-tmpl (Name_Put_Image): New Name_Id. (Attribute_Put_Image): New Attribute_Id. * tbuild.adb, tbuild.ads (Make_Increment): New utility.
2020-06-04[Ada] Remove OpenACC supportArnaud Charlet1-36/+2
2020-06-04 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * back_end.adb, opt.ads, par-prag.adb, sem_ch5.adb, sem_prag.adb, sinfo.adb, sinfo.ads, snames.ads-tmpl, doc/gnat_rm/implementation_defined_pragmas.rst: Remove experimental support for OpenACC. * gcc-interface/misc.c, gcc-interface/trans.c, gcc-interface/lang.opt: Ditto. * gnat_rm.texi: Regenerate. gcc/testsuite/ * gnat.dg/openacc1.adb: Remove testcase.
2020-06-02[Ada] snames.ads-tmpl: add commentBob Duff1-4/+9
2020-06-02 Bob Duff <duff@adacore.com> gcc/ada/ * snames.ads-tmpl: Add comments explaining that enumeration types have to be kept in synch with subtypes of Name_Id.
2020-06-02[Ada] Treat attribute Img equivalent to attribute ImageArnaud Charlet1-2/+2
2020-06-02 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * snames.ads-tmpl (Name_Img, Attribute_Img): Make it an attribute returning renamable functions.
2019-12-16[Ada] Prototype implementastion of Ada2020 Map-reduce constructEd Schonberg1-0/+2
2019-12-16 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * scng.adb (Scan): In Ada2020, a left-bracket indicates the start of an homogenous aggregate. * par-ch4.adb (P_Reduction_Attribute_Reference): New procedure. (P_Aggregate): Recognize Ada2020 bracket-delimited aggregates. (P_Primary): Ditto. * par-util.adb (Comma_Present): Return false on a right bracket in Ada2020, indicating the end of an aggregate. * snames.ads-tmpl: Introduce Name_Reduce and Attribute Reduce. * sinfo.ads, sinfo.adb (Is_Homogeneous_Aggregate): New flag on aggregates, to designate an Ada2020 array or container aggregate that is bracket-delimited in the source. * sem_attr.adb (Analyze_Attribute): For attribute Reduce, verify that two arguments are present, and verify that the prefix is a stream or an object that is iterable (array or contrainer). (Resolve_Attribute): For attribute Reduce, resolve initial value with the type of the context. Type-checking of element type of prefix is performed after expansion. * exp_attr.adb (Expand_N_Attribute_Reference): For attribute Reduce, expand into a loop: a) If prefix is an aggregate with a single iterated component association, use its iterator specification to construct a loop, b) If prefix is a name, build a loop using an element iterator loop. * scans.ads: Add brackets tokens. From-SVN: r279431
2019-08-20[Ada] New pragma Aggregate_Individually_AssignPatrick Bernardi1-0/+2
Where possible GNAT will store the binary representation of a record aggregate in memory for space and performance reasons. This configuration pragma changes this behaviour so that record aggregates are instead always converted into individual assignment statements. The following package pack.ads: -- pack.ads pragma Aggregate_Individually_Assign; pragma Restrictions (No_Multiple_Elaboration); package Pack is type A_Rec is record A, B, C, D : Boolean; end record; A : A_Rec := (True, False, True, True); end Pack; when compiled with gcc -c -gnatdg pack.ads should produce the following output: Source recreated from tree for Pack (spec) ------------------------------------------ pragma aggregate_individually_assign; pragma restrictions (no_multiple_elaboration); package pack is type pack__a_rec is record a : boolean; b : boolean; c : boolean; d : boolean; end record; freeze pack__a_rec [ procedure pack__a_recIP (_init : out pack__a_rec) is begin %push_constraint_error_label () %push_program_error_label () %push_storage_error_label () null; %pop_constraint_error_label %pop_program_error_label %pop_storage_error_label return; end pack__a_recIP; ] pack__a : pack__a_rec := ( a => true, b => false, c => true, d => true); pack__a.a := true; pack__a.b := false; pack__a.c := true; pack__a.d := true; null; end pack; 2019-08-20 Patrick Bernardi <bernardi@adacore.com> gcc/ada/ * exp_aggr.adb (Expand_Record_Aggregate): Always convert a record Aggregate to assignment statements if the option Aggregate_Individually_Assign is set. * opt.ads (Aggregate_Individually_Assign): New option. * par-prag.adb (Prag): Add Pragma_Aggregate_Individually_Assign. * sem_prag.adb (Analyze_Pragma): Likewise. * snames.ads-tmpl: Add Pragma_Aggregate_Individually_Assign and Name_Aggregate_Individually_Assign. * doc/gnat_rm/implementation_defined_pragmas.rst: Document pragma Aggregate_Individually_Assign. * gnat_rm.texi: Regenerate. From-SVN: r274730
2019-08-13[Ada] Implement pragma Max_Entry_Queue_LengthJustin Squirek1-2/+3
This patch implements AI12-0164-1 for the aspect/pragma Max_Entry_Queue_Length. Previously, the GNAT specific pragma Max_Queue_Length fulfilled this role, but was not named to match the standard and thus was insufficent. ------------ -- Source -- ------------ -- pass.ads with System; package Pass is SOMETHING : constant Integer := 5; Variable : Boolean := False; protected type Protected_Example is entry A (Item : Integer) with Max_Entry_Queue_Length => 2; -- OK entry B (Item : Integer); pragma Max_Entry_Queue_Length (SOMETHING); -- OK entry C (Item : Integer); -- OK entry D (Item : Integer) with Max_Entry_Queue_Length => 4; -- OK entry D (Item : Integer; Item_B : Integer) with Max_Entry_Queue_Length => Float'Digits; -- OK entry E (Item : Integer); pragma Max_Entry_Queue_Length (SOMETHING * 2); -- OK entry E (Item : Integer; Item_B : Integer); pragma Max_Entry_Queue_Length (11); -- OK entry F (Item : Integer; Item_B : Integer); pragma Pre (Variable = True); pragma Max_Entry_Queue_Length (11); -- OK entry G (Item : Integer; Item_B : Integer) with Pre => (Variable = True), Max_Entry_Queue_Length => 11; -- OK private Data : Boolean := True; end Protected_Example; Prot_Ex : Protected_Example; end Pass; -- fail.ads package Fail is -- Not near entry pragma Max_Entry_Queue_Length (40); -- ERROR -- Task type task type Task_Example is entry Insert (Item : in Integer) with Max_Entry_Queue_Length => 10; -- ERROR -- Entry family in task type entry A (Positive) (Item : in Integer) with Max_Entry_Queue_Length => 10; -- ERROR end Task_Example; Task_Ex : Task_Example; -- Aspect applied to protected type protected type Protected_Failure_0 with Max_Entry_Queue_Length => 50 is -- ERROR entry A (Item : Integer); private Data : Integer := 0; end Protected_Failure_0; Protected_Failure_0_Ex : Protected_Failure_0; protected type Protected_Failure is pragma Max_Entry_Queue_Length (10); -- ERROR -- Duplicates entry A (Item : Integer) with Max_Entry_Queue_Length => 10; -- OK pragma Max_Entry_Queue_Length (4); -- ERROR entry B (Item : Integer); pragma Max_Entry_Queue_Length (40); -- OK pragma Max_Entry_Queue_Length (4); -- ERROR entry C (Item : Integer) with Max_Entry_Queue_Length => 10, -- OK Max_Entry_Queue_Length => 40; -- ERROR -- Duplicates with the same value entry AA (Item : Integer) with Max_Entry_Queue_Length => 10; -- OK pragma Max_Entry_Queue_Length (10); -- ERROR entry BB (Item : Integer); pragma Max_Entry_Queue_Length (40); -- OK pragma Max_Entry_Queue_Length (40); -- ERROR entry CC (Item : Integer) with Max_Entry_Queue_Length => 10, -- OK Max_Entry_Queue_Length => 10; -- ERROR -- On subprogram procedure D (Item : Integer) with Max_Entry_Queue_Length => 10; -- ERROR procedure E (Item : Integer); pragma Max_Entry_Queue_Length (4); -- ERROR function F (Item : Integer) return Integer with Max_Entry_Queue_Length => 10; -- ERROR function G (Item : Integer) return Integer; pragma Max_Entry_Queue_Length (4); -- ERROR -- Bad parameters entry H (Item : Integer) with Max_Entry_Queue_Length => 0; -- ERROR entry I (Item : Integer) with Max_Entry_Queue_Length => -1; -- ERROR entry J (Item : Integer) with Max_Entry_Queue_Length => 16#FFFF_FFFF_FFFF_FFFF_FFFF#; -- ERROR entry K (Item : Integer) with Max_Entry_Queue_Length => False; -- ERROR entry L (Item : Integer) with Max_Entry_Queue_Length => "JUNK"; -- ERROR entry M (Item : Integer) with Max_Entry_Queue_Length => 1.0; -- ERROR entry N (Item : Integer) with Max_Entry_Queue_Length => Long_Integer'(3); -- ERROR -- Entry family entry O (Boolean) (Item : Integer) with Max_Entry_Queue_Length => 5; -- ERROR private Data : Integer := 0; end Protected_Failure; I : Positive := 1; Protected_Failure_Ex : Protected_Failure; end Fail; -- dtest.adb with Ada.Text_IO; use Ada.Text_IO; procedure Dtest is protected Prot is entry Wait; pragma Max_Entry_Queue_Length (2); procedure Wakeup; private Barrier : Boolean := False; end Prot; protected body Prot is entry Wait when Barrier is begin null; end Wait; procedure Wakeup is begin Barrier := True; end Wakeup; end Prot; task type T; task body T is begin Put_Line ("Waiting..."); Prot.Wait; exception when others => Put_Line ("Got exception"); end T; T1, T2 : T; begin delay 0.1; Prot.Wait; Put_Line ("Done"); exception when others => Put_Line ("Main got exception"); Prot.Wakeup; end Dtest; ---------------------------- -- Compilation and output -- ---------------------------- & gcc -c -g -gnatDG pass.ads & gcc -c -g fail.ads & grep -c "(2, 5, 0, 4, 6, 10, 11, 11, 11)" pass.ads.dg & gnatmake -g -q dtest fail.ads:5:04: pragma "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:12:15: aspect "Max_Entry_Queue_Length" cannot apply to task entries fail.ads:17:15: aspect "Max_Entry_Queue_Length" cannot apply to task entries fail.ads:26:12: aspect "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:36:07: pragma "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:42:07: pragma "Max_Entry_Queue_Length" duplicates aspect declared at line 41 fail.ads:46:07: pragma "Max_Entry_Queue_Length" duplicates pragma declared at line 45 fail.ads:50:15: aspect "Max_Entry_Queue_Length" for "C" previously given at line 49 fail.ads:56:07: pragma "Max_Entry_Queue_Length" duplicates aspect declared at line 55 fail.ads:60:07: pragma "Max_Entry_Queue_Length" duplicates pragma declared at line 59 fail.ads:64:15: aspect "Max_Entry_Queue_Length" for "CC" previously given at line 63 fail.ads:69:15: aspect "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:72:07: pragma "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:75:15: aspect "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:78:07: pragma "Max_Entry_Queue_Length" must apply to a protected entry fail.ads:83:35: entity for aspect "Max_Entry_Queue_Length" must be positive fail.ads:86:35: entity for aspect "Max_Entry_Queue_Length" must be positive fail.ads:89:35: entity for aspect "Max_Entry_Queue_Length" out of range of Integer fail.ads:92:35: expected an integer type fail.ads:92:35: found type "Standard.Boolean" fail.ads:95:35: expected an integer type fail.ads:95:35: found a string type fail.ads:98:35: expected an integer type fail.ads:98:35: found type universal real 2019-08-13 Justin Squirek <squirek@adacore.com> gcc/ada/ * aspects.adb, aspects.ads: Register new aspect. * par-prag.adb (Prag): Register new pragma * sem_ch13.adb (Analyze_Aspect_Specifications): Add processing for new aspect similar to Aspect_Max_Entry_Queue_Length. * sem_prag.adb, sem_prag.ads (Analyze_Pragma): Register new pragma and set it to use the same processing as Pragma_Max_Queue_Length. * snames.ads-tmpl: Move definition of Name_Max_Entry_Queue_Length so that it can be processed as a pragma in addition to a restriction and add an entry for the pragma itself. From-SVN: r274346
2019-08-12[Ada] New aspect/pragma No_Caching for analysis of volatile dataYannick Moy1-0/+2
A new aspect/pragma can be attached to volatile variables to indicate that such a variable is not used for interactions with the external world, but only that accesses to that variable should not be optimized by the compiler. This is in particular useful for guarding against fault injection. SPARK Reference manual has been updated to allow this use of volatile data, see section 7.1.2, so that GNATprove can analyze such variables as not volatile. 2019-08-12 Yannick Moy <moy@adacore.com> gcc/ada/ * aspects.adb, aspects.ads (Aspect_No_Caching): New aspect. * contracts.adb, contracts.ads (Add_Contract_Item): Add handling of No_Caching. (Analyze_Object_Contract): Add handling of No_Caching. * einfo.adb, einfo.ads (Get_Pragma): Add handling of No_Caching. * doc/gnat_rm/implementation_defined_aspects.rst, doc/gnat_rm/implementation_defined_pragmas.rst: Document new aspect/pragma. * gnat_rm.texi: Regenerate. * par-prag.adb (Prag): New pragma Pragma_No_Caching. * sem_ch13.adb (Analyze_Aspect_Specifications, Check_Aspect_At_Freeze_Point): Add handling of No_Caching. * sem_prag.adb (Analyze_Pragma): Deal with pragma No_Caching. * sem_prag.ads (Analyze_External_Property_In_Decl_Part): Now applies to No_Caching. * sem_util.adb, sem_util.ads (Is_Effectively_Volatile): Add handling of No_Caching. (No_Caching_Enabled): New query function. * snames.ads-tmpl: New names for pragma. gcc/testsuite/ * gnat.dg/no_caching.adb, gnat.dg/no_caching.ads: New testcase. From-SVN: r274292
2019-07-11[Ada] New Repinfo.Input unit to read back JSON representation info.Eric Botcazou1-0/+5
For some time the Repinfo unit has been able to output the representation information in the JSON data interchange format in addition to the usual text and binary formats. The new Repinfo.Input unit makes it possible to read back this information under this format and make it available to clients, the main one being ASIS. The big advantage of using this approach over manipulating a binary blob is that the writer and the reader of the JSON representation need not be binary compatible, i.e. in practice need not be the same version of the compiler or ASIS for the same target. The patch also adds a -gnatd_j switch to read back the information in the compiler itself, which makes it easy to keep the writer and the reader in sync using only one tool, namely the compiler. The typical usage is: gcc -c p.ads -gnatR4js gcc -c p.ads -gnatd_j to exercise respectively the writer and the reader from the compiler. 2019-07-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * alloc.ads (Rep_JSON_Table_Initial): New constant. (Rep_JSON_Table_Increment): Likewise. * debug.adb: Document -gnatd_j switch. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add repinfo-input.o. * gnat1drv.adb: Add with clause for Repinfo.Input. Add with and use clauses for Sinput. (Read_JSON_Files_For_Repinfo): New procedure. (Gnat1drv1): Deal with -gnatd_j switch. * repinfo-input.ad[sb]: New unit. * snames.ads-tmpl (Name_Discriminant): New constant. (Name_Operands): Likewise. From-SVN: r273382
2018-09-26[Ada] Minor reformattingsHristian Kirtchev1-4/+6
2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * contracts.adb, exp_unst.adb, exp_util.adb, gnat1drv.adb, opt.ads, par-prag.adb, sem_ch3.adb, sem_ch5.adb, sem_prag.adb, sinfo.ads, snames.ads-tmpl: Minor reformatting. From-SVN: r264621
2018-09-26[Ada] Front-end support for OpenACC pragmasOlivier Hainque1-166/+202
This patch introduces the upper part of the Ada front-end support for a first set of OpenACC directives (Acc_Kernels, Acc_Loop, Acc_Parallel, Acc_Data) and their clauses. The pragmas syntax is documented, pragmas are recognized and checked for syntactic correctness, keyed on -fopenacc. A couple of new flags are defined on loop statements in the GNAT tree. 2018-09-26 Olivier Hainque <hainque@adacore.com> gcc/ada/ * opt.ads (OpenAcc_Enabled): New flag. False by default. True when OpenACC pragmas are requested to be honored, when -fopenacc is found on the command line. * back_end.adb (Scan_Compiler_Arguments): Set OpenACC_Enabled if -fopenacc is seen on the command line. * sinfo.adb, sinfo.ads (Is_OpenAcc_Environment): New flag/predicate on Loop statements which embed an Acc_Kernels, Acc_Parallel or Acc_Data pragma. (Is_OpenAcc_Loop): New flag/predicate on Loop statements which embed an Acc_Loop pragma. (Set_Is_OpenAcc_Environment, Set_Is_OpenAcc_Loop): Setters for the new flags. * par-prag.adb (Prag): Handle Acc_Data, Acc_Loop, Acc_Parallel and Acc_Kernels pragmas. Nothing to do here, all handled by sem_prag. * sem_prag.adb (Acc_First, Acc_Next, Validate_Acc_Condition_Clause, Validate_Acc_Data_Clause, Validate_Acc_Int_Expr_Clause, Validate_Acc_Int_Expr_List_Clause, Validate_Acc_Loop_Collapse, Validate_Acc_Loop_Gang, Validate_Acc_Loop_Vector, Validate_Acc_Loop_Worker, Validate_Acc_Name_Reduction, Validate_Acc_Size_Expressions): New helper for Analyze_Pragma, to handle OpenACC pragmas. (Analyze_Pragma): Handle Acc_Data, Acc_Loop, Acc_Parallel and Acc_Kernels pragmas. * sem_ch5.adb (Disable_Constant): Unset Is_True_Constant on variable entity, action for ... (Disable_Constants): Helper for Analyze_Loop_Statement, to ... (Analyze_Loop_Statement): Disable True_Constant on variables referenced within an OpenACC environment. * snames.ads-tmpl: Declare Name_Ids for the OpenACC directives and clauses we can handle. Remove an exraneous whitespace before columns, preventing line length overflow in the generated spec with Ids now reaching beyond 999. * doc/gnat_rm/implementation_defined_pragmas.rst: Document pragma Acc_Parallel, Acc_Loop, Acc_Kernels and Acc_Data. * gnat_rm.texi: Regenerate. From-SVN: r264617
2018-05-30[Ada] Implement pragma Max_Entry_Queue_DepthJustin Squirek1-1/+2
This patch implements AI12-0164-1 for the aspect/pragma Max_Entry_Queue_Depth. Previously, the GNAT specific pragma Max_Queue_Length fulfilled this role, but was not named to match the standard and thus was insufficent. ------------ -- Source -- ------------ -- pass.ads with System; package Pass is SOMETHING : constant Integer := 5; Variable : Boolean := False; protected type Protected_Example is entry A (Item : Integer) with Max_Entry_Queue_Depth => 2; -- OK entry B (Item : Integer); pragma Max_Entry_Queue_Depth (SOMETHING); -- OK entry C (Item : Integer); -- OK entry D (Item : Integer) with Max_Entry_Queue_Depth => 4; -- OK entry D (Item : Integer; Item_B : Integer) with Max_Entry_Queue_Depth => Float'Digits; -- OK entry E (Item : Integer); pragma Max_Entry_Queue_Depth (SOMETHING * 2); -- OK entry E (Item : Integer; Item_B : Integer); pragma Max_Entry_Queue_Depth (11); -- OK entry F (Item : Integer; Item_B : Integer); pragma Pre (Variable = True); pragma Max_Entry_Queue_Depth (11); -- OK entry G (Item : Integer; Item_B : Integer) with Pre => (Variable = True), Max_Entry_Queue_Depth => 11; -- OK private Data : Boolean := True; end Protected_Example; Prot_Ex : Protected_Example; end Pass; -- fail.ads package Fail is -- Not near entry pragma Max_Entry_Queue_Depth (40); -- ERROR -- Task type task type Task_Example is entry Insert (Item : in Integer) with Max_Entry_Queue_Depth => 10; -- ERROR -- Entry family in task type entry A (Positive) (Item : in Integer) with Max_Entry_Queue_Depth => 10; -- ERROR end Task_Example; Task_Ex : Task_Example; -- Aspect applied to protected type protected type Protected_Failure_0 with Max_Entry_Queue_Depth => 50 is -- ERROR entry A (Item : Integer); private Data : Integer := 0; end Protected_Failure_0; Protected_Failure_0_Ex : Protected_Failure_0; protected type Protected_Failure is pragma Max_Entry_Queue_Depth (10); -- ERROR -- Duplicates entry A (Item : Integer) with Max_Entry_Queue_Depth => 10; -- OK pragma Max_Entry_Queue_Depth (4); -- ERROR entry B (Item : Integer); pragma Max_Entry_Queue_Depth (40); -- OK pragma Max_Entry_Queue_Depth (4); -- ERROR entry C (Item : Integer) with Max_Entry_Queue_Depth => 10, -- OK Max_Entry_Queue_Depth => 40; -- ERROR -- Duplicates with the same value entry AA (Item : Integer) with Max_Entry_Queue_Depth => 10; -- OK pragma Max_Entry_Queue_Depth (10); -- ERROR entry BB (Item : Integer); pragma Max_Entry_Queue_Depth (40); -- OK pragma Max_Entry_Queue_Depth (40); -- ERROR entry CC (Item : Integer) with Max_Entry_Queue_Depth => 10, -- OK Max_Entry_Queue_Depth => 10; -- ERROR -- On subprogram procedure D (Item : Integer) with Max_Entry_Queue_Depth => 10; -- ERROR procedure E (Item : Integer); pragma Max_Entry_Queue_Depth (4); -- ERROR function F (Item : Integer) return Integer with Max_Entry_Queue_Depth => 10; -- ERROR function G (Item : Integer) return Integer; pragma Max_Entry_Queue_Depth (4); -- ERROR -- Bad parameters entry H (Item : Integer) with Max_Entry_Queue_Depth => 0; -- ERROR entry I (Item : Integer) with Max_Entry_Queue_Depth => -1; -- ERROR entry J (Item : Integer) with Max_Entry_Queue_Depth => 16#FFFF_FFFF_FFFF_FFFF_FFFF#; -- ERROR entry K (Item : Integer) with Max_Entry_Queue_Depth => False; -- ERROR entry L (Item : Integer) with Max_Entry_Queue_Depth => "JUNK"; -- ERROR entry M (Item : Integer) with Max_Entry_Queue_Depth => 1.0; -- ERROR entry N (Item : Integer) with Max_Entry_Queue_Depth => Long_Integer'(3); -- ERROR -- Entry family entry O (Boolean) (Item : Integer) with Max_Entry_Queue_Depth => 5; -- ERROR private Data : Integer := 0; end Protected_Failure; I : Positive := 1; Protected_Failure_Ex : Protected_Failure; end Fail; -- dtest.adb with Ada.Text_IO; use Ada.Text_IO; procedure Dtest is protected Prot is entry Wait; pragma Max_Entry_Queue_Depth (2); procedure Wakeup; private Barrier : Boolean := False; end Prot; protected body Prot is entry Wait when Barrier is begin null; end Wait; procedure Wakeup is begin Barrier := True; end Wakeup; end Prot; task type T; task body T is begin Put_Line ("Waiting..."); Prot.Wait; exception when others => Put_Line ("Got exception"); end T; T1, T2 : T; begin delay 0.1; Prot.Wait; Put_Line ("Done"); exception when others => Put_Line ("Main got exception"); Prot.Wakeup; end Dtest; ---------------------------- -- Compilation and output -- ---------------------------- & gcc -c -g -gnatDG pass.ads & gcc -c -g fail.ads & grep -c "(2, 5, 0, 4, 6, 10, 11, 11, 11)" pass.ads.dg & gnatmake -g -q dtest fail.ads:5:04: pragma "Max_Queue_Length" must apply to a protected entry fail.ads:12:15: aspect "Max_Queue_Length" cannot apply to task entries fail.ads:17:15: aspect "Max_Queue_Length" cannot apply to task entries fail.ads:26:12: aspect "Max_Queue_Length" must apply to a protected entry fail.ads:36:07: pragma "Max_Queue_Length" must apply to a protected entry fail.ads:42:07: pragma "Max_Queue_Length" duplicates aspect declared at line 41 fail.ads:46:07: pragma "Max_Queue_Length" duplicates pragma declared at line 45 fail.ads:50:15: aspect "Max_Queue_Length" for "C" previously given at line 49 fail.ads:56:07: pragma "Max_Queue_Length" duplicates aspect declared at line 55 fail.ads:60:07: pragma "Max_Queue_Length" duplicates pragma declared at line 59 fail.ads:64:15: aspect "Max_Queue_Length" for "CC" previously given at line 63 fail.ads:69:15: aspect "Max_Queue_Length" must apply to a protected entry fail.ads:72:07: pragma "Max_Queue_Length" must apply to a protected entry fail.ads:75:15: aspect "Max_Queue_Length" must apply to a protected entry fail.ads:78:07: pragma "Max_Queue_Length" must apply to a protected entry fail.ads:83:35: entity for aspect "Max_Queue_Length" must be positive fail.ads:86:35: entity for aspect "Max_Queue_Length" must be positive fail.ads:89:35: entity for aspect "Max_Queue_Length" out of range of Integer fail.ads:92:35: expected an integer type fail.ads:92:35: found type "Standard.Boolean" fail.ads:95:35: expected an integer type fail.ads:95:35: found a string type fail.ads:98:35: expected an integer type fail.ads:98:35: found type universal real 2018-05-30 Justin Squirek <squirek@adacore.com> gcc/ada/ * aspects.adb, aspects.ads: Register new aspect. * par-prag.adb (Prag): Register new pragma. * sem_ch13.adb (Analyze_Aspect_Specifications): Add processing for new aspect similar to Aspect_Max_Queue_Length. * sem_prag.adb, sem_prag.ads (Analyze_Pragma): Register new pragma and set it to use the same processing as Pragma_Max_Queue_Length. * snames.ads-tmpl: Move definition of Name_Max_Entry_Queue_Depth so that it can be processed as a pragma in addition to a restriction and add an entry for the pragma itself. From-SVN: r260945
2018-05-22[Ada] In-place initialization for Initialize_ScalarsHristian Kirtchev1-0/+24
This patch optimizes the initialization and allocation of scalar array objects when pragma Initialize_Scalars is in effect. The patch also extends the syntax and semantics of pragma Initialize_Scalars to allow for the specification of invalid values pertaining to families of scalar types. The new syntax is as follows: pragma Initialize_Scalars [ ( TYPE_VALUE_PAIR {, TYPE_VALUE_PAIR} ) ]; TYPE_VALUE_PAIR ::= SCALAR_TYPE => static_EXPRESSION SCALAR_TYPE := Short_Float | Float | Long_Float | Long_Long_Flat | Signed_8 | Signed_16 | Signed_32 | Signed_64 | Unsigned_8 | Unsigned_16 | Unsigned_32 | Unsigned_64 Depending on the value specified by pragma Initialize_Scalars, the backend may optimize the creation of the scalar array object into a fast memset. ------------ -- Source -- ------------ -- gnat.adc pragma Initialize_Scalars (Short_Float => 0.0, Float => 0.0, Long_Float => 0.0, Long_Long_Float => 0.0, Signed_8 => 0, Signed_16 => 0, Signed_32 => 0, Signed_64 => 0, Unsigned_8 => 0, Unsigned_16 => 0, Unsigned_32 => 0, Unsigned_64 => 0); -- types.ads with System; package Types is Max : constant := 10_000; subtype Big is Integer range 1 .. Max; type Byte is range 0 .. 255; for Byte'Size use System.Storage_Unit; type Byte_Arr_1 is array (1 .. Max) of Byte; type Byte_Arr_2 is array (Big) of Byte; type Byte_Arr_3 is array (Integer range <>) of Byte; type Byte_Arr_4 is array (Integer range <>, Integer range <>) of Byte; type Constr_Arr_1 is array (1 .. Max) of Integer; type Constr_Arr_2 is array (Big) of Integer; type Constr_Arr_3 is array (1 .. Max, 1 .. Max) of Integer; type Constr_Arr_4 is array (Big, Big) of Integer; type Unconstr_Arr_1 is array (Integer range <>) of Integer; type Unconstr_Arr_2 is array (Integer range <>, Integer range <>) of Integer; subtype Subt_Arr_1 is Unconstr_Arr_1 (1 .. Max); subtype Subt_Arr_2 is Unconstr_Arr_1 (Big); subtype Subt_Arr_3 is Unconstr_Arr_2 (1 .. Max, 1 .. Max); subtype Subt_Arr_4 is Unconstr_Arr_2 (Big, Big); subtype Subt_Str_1 is String (1 .. Max); subtype Subt_Str_2 is String (Big); type Byte_Arr_1_Ptr is access Byte_Arr_1; type Byte_Arr_2_Ptr is access Byte_Arr_2; type Byte_Arr_3_Ptr is access Byte_Arr_3; type Byte_Arr_4_Ptr is access Byte_Arr_4; type Constr_Arr_1_Ptr is access Constr_Arr_1; type Constr_Arr_2_Ptr is access Constr_Arr_2; type Constr_Arr_3_Ptr is access Constr_Arr_3; type Constr_Arr_4_Ptr is access Constr_Arr_4; type Unconstr_Arr_1_Ptr is access Unconstr_Arr_1; type Unconstr_Arr_2_Ptr is access Unconstr_Arr_2; type Subt_Arr_1_Ptr is access Subt_Arr_1; type Subt_Arr_2_Ptr is access Subt_Arr_2; type Subt_Arr_3_Ptr is access Subt_Arr_3; type Subt_Arr_4_Ptr is access Subt_Arr_4; type Str_Ptr is access String; type Subt_Str_1_Ptr is access Subt_Str_1; type Subt_Str_2_Ptr is access Subt_Str_2; end Types; -- main.adb with Types; use Types; procedure Main is Byte_Arr_1_Obj : Byte_Arr_1; Byte_Arr_2_Obj : Byte_Arr_2; Byte_Arr_3_Obj : Byte_Arr_3 (1 .. Max); Byte_Arr_4_Obj : Byte_Arr_3 (Big); Byte_Arr_5_Obj : Byte_Arr_4 (1 .. Max, 1 .. Max); Byte_Arr_6_Obj : Byte_Arr_4 (Big, Big); Constr_Arr_1_Obj : Constr_Arr_1; Constr_Arr_2_Obj : Constr_Arr_2; Constr_Arr_3_Obj : Constr_Arr_3; Constr_Arr_4_Obj : Constr_Arr_4; Unconstr_Arr_1_Obj : Unconstr_Arr_1 (1 .. Max); Unconstr_Arr_2_Obj : Unconstr_Arr_1 (Big); Unconstr_Arr_3_Obj : Unconstr_Arr_2 (1 .. Max, 1 .. Max); Unconstr_Arr_4_Obj : Unconstr_Arr_2 (Big, Big); Subt_Arr_1_Obj : Subt_Arr_1; Subt_Arr_2_Obj : Subt_Arr_2; Subt_Arr_3_Obj : Subt_Arr_3; Subt_Arr_4_Obj : Subt_Arr_4; Str_1_Obj : String (1 .. Max); Str_2_Obj : String (Big); Subt_Str_1_Obj : Subt_Str_1; Subt_Str_2_Obj : Subt_Str_2; Byte_Arr_1_Ptr_Obj : Byte_Arr_1_Ptr := new Byte_Arr_1; Byte_Arr_2_Ptr_Obj : Byte_Arr_2_Ptr := new Byte_Arr_2; Byte_Arr_3_Ptr_Obj : Byte_Arr_3_Ptr := new Byte_Arr_3 (1 .. Max); Byte_Arr_4_Ptr_Obj : Byte_Arr_3_Ptr := new Byte_Arr_3 (Big); Byte_Arr_5_Ptr_Obj : Byte_Arr_4_Ptr := new Byte_Arr_4 (1 .. Max, 1 .. Max); Byte_Arr_6_Ptr_Obj : Byte_Arr_4_Ptr := new Byte_Arr_4 (Big, Big); Constr_Arr_1_Ptr_Obj : Constr_Arr_1_Ptr := new Constr_Arr_1; Constr_Arr_2_Ptr_Obj : Constr_Arr_2_Ptr := new Constr_Arr_2; Constr_Arr_3_Ptr_Obj : Constr_Arr_3_Ptr := new Constr_Arr_3; Constr_Arr_4_Ptr_Obj : Constr_Arr_4_Ptr := new Constr_Arr_4; Unconstr_Arr_1_Ptr_Obj : Unconstr_Arr_1_Ptr := new Unconstr_Arr_1 (1 .. Max); Unconstr_Arr_2_Ptr_Obj : Unconstr_Arr_1_Ptr := new Unconstr_Arr_1 (Big); Unconstr_Arr_3_Ptr_Obj : Unconstr_Arr_2_Ptr := new Unconstr_Arr_2 (1 .. Max, 1 .. Max); Unconstr_Arr_4_Ptr_Obj : Unconstr_Arr_2_Ptr := new Unconstr_Arr_2 (Big, Big); Subt_Arr_1_Ptr_Obj : Subt_Arr_1_Ptr := new Subt_Arr_1; Subt_Arr_2_Ptr_Obj : Subt_Arr_2_Ptr := new Subt_Arr_2; Subt_Arr_3_Ptr_Obj : Subt_Arr_3_Ptr := new Subt_Arr_3; Subt_Arr_4_Ptr_Obj : Subt_Arr_4_Ptr := new Subt_Arr_4; Str_Ptr_1_Obj : Str_Ptr := new String (1 .. Max); Str_Ptr_2_Obj : Str_Ptr := new String (Big); Subt_Str_1_Ptr_Obj : Subt_Str_1_Ptr := new Subt_Str_1; Subt_Str_2_Ptr_Obj : Subt_Str_2_Ptr := new Subt_Str_2; begin null; end Main; ---------------------------- -- Compilation and output -- ---------------------------- $ gcc -c -S -gnatDG -gnatws main.adb $ grep -c "others => types__TbyteB!(0));" main.adb.dg $ grep -c "others => integer!(0));" main.adb.dg $ grep -c "others => character!(0));" main.adb.dg $ grep -c "others => types__TbyteB!(0));" main.adb.dg $ grep -c "memset" main.s 8 12 8 8 44 2018-05-22 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Strip away any conversions before extracting the value of the expression. * exp_ch3.adb (Default_Initialize_Object): Optimize the default initialization of an array of scalars. (Get_Simple_Init_Val): Add processing for array types. Remove the processing of strings because this case is already handled by the array case. (Needs_Simple_Initialization): Moved to Sem_Util. (Simple_Init_Array_Type): New routine. (Simple_Init_Initialize_Scalars_Type): Reimplemented to use the new facilities from Sem_Util. (Simple_Initialization_OK): New routine. * exp_ch3.ads (Needs_Simple_Initialization): Moved to Sem_Util. * exp_ch4.adb (Expand_N_Allocator): Optimize the default allocation of an array of scalars. * sem_prag.adb (Analyze_Float_Value): New routine. (Analyze_Integer_Value): New routine. (Analyze_Pragma): Reimplement the analysis of pragma Initialize_Scalars to handled the extended form of the pragma. (Analyze_Type_Value_Pair): New routine. * sem_util.adb: Add invalid value-related data structures. (Examine_Array_Bounds): New routine. (Has_Static_Array_Bounds): Reimplemented. (Has_Static_Non_Empty_Array_Bounds): New routine. (Invalid_Scalar_Value): New routine. (Needs_Simple_Initialization): Moved from Exp_Ch3. (Set_Invalid_Scalar_Value): New routines. * sem_util.ads (Has_Static_Non_Empty_Array_Bounds): New routine. (Invalid_Scalar_Value): New routine. (Needs_Simple_Initialization): Moved from Exp_Ch3. (Set_Invalid_Scalar_Value): New routines. * snames.ads-tmpl: Add names for the salar type families used by pragma Initialize_Scalars. From-SVN: r260529
2018-01-11[Ada] Aspect/pragma Secondary_Stack_Size can evaluate non-literals as zeroPatrick Bernardi1-3/+2
This patch fixes the problem of aspect/pragma Secondary_Stack_Size expressions with non-literals evaluating as zero in static secondary stacks allocations. The aspect Secondary_Stack_Size is now converted to a pragma instead of an attribute as the attribute does not have visibility on the discriminant. Additionally, the discriminant of the corresponding record type is now referenced if the pragma expression contains a discriminant. No simple test available as the problem only impacts programs when System.Parameters.Sec_Stack_Dynamic = False 2018-01-11 Patrick Bernardi <bernardi@adacore.com> gcc/ada/ * exp_ch9.adb (Expand_N_Task_Type_Declaration): Simplified Secondary_Stack_Size handling as a pragma is now generated for the corresponding aspect instead of an attribute. Pragma expression is relocated instead of evaluated. Discriminant of the corresponding record type is referenced rather than the type discriminant. (Create_Secondary_Stack_For_Task, Make_Task_Create_Call): Update Secondary_Stack_Size rep item checks to only look for the pragma rep. * sem_ch13.adb (Analyze_One_Aspect): Transform Aspect_Secondary_Stack_Size into a pragma instead of an attribute because the attribute does not have visibility on a task type's discriminants when the type's definition is expanded. (Analyze_Attribute_Definition_Clause): Remove handling of Attribute_Secondary_Stack_Size. * snames.adb-tmpl, snames.ads-tmpl: Remove Attribute_Secondary_Stack_Size, no longer used. From-SVN: r256488
2017-12-05[multiple changes]Pierre-Marie de Rodat1-0/+1
2017-12-05 Bob Duff <duff@adacore.com> * exp_ch6.adb (Build_In_Place_Formal): Search for the formal by suffix instead of the full name. * sem_ch6.adb (Create_Extra_Formals): Make sure there are extra formals in the case of an instance of a generic. 2017-12-05 Arnaud Charlet <charlet@adacore.com> (Adjust_Global_Switches): Create an alias GNAT_Annotate to map to pragma Annotate. From-SVN: r255409
2017-09-29exp_ch6.adb (Expand_Call_Helper): Handle case of build-in-place functions ↵Bob Duff1-1/+1
returning nonlimited types. 2017-09-29 Bob Duff <duff@adacore.com> * exp_ch6.adb (Expand_Call_Helper): Handle case of build-in-place functions returning nonlimited types. Allow for qualified expressions and type conversions. (Expand_N_Extended_Return_Statement): Correct the computation of Func_Bod to allow for child units. (Expand_Simple_Function_Return): Remove assumption that b-i-p implies limited (initialization of In_Place_Expansion), and implies >= Ada 2005. (Is_Build_In_Place_Result_Type): New function to accompany Is_Build_In_Place_Function and Is_Build_In_Place_Function_Call, because sometimes we just have the type on our hands, not the function. For now, does the same thing as the old version, so build-in-place is disabled for nonlimited types, except that you can use -gnatd.9 to enable it. * exp_ch6.ads (Is_Build_In_Place_Result_Type): New function to accompany Is_Build_In_Place_Function and Is_Build_In_Place_Function_Call, because sometimes we just have the type on our hands, not the function. (Make_Build_In_Place_Call_In_...): Handle nonlimited build-in-place cases. (Make_Build_In_Place_Call_In_Object_Declaration): Remove the questionable code at the end that was setting the Etype. * exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): New function to determine whether "return (...agg...);" is returning from a build-in-place function. (Initialize_Ctrl_Array_Component, Initialize_Ctrl_Record_Component): Remove assumption that b-i-p implies limited (initialization of In_Place_Expansion). (Build_Record_Aggr_Code): AI-287: fix comment; it can't be wrapped in an unchecked conversion. Add assertions. (Convert_Aggr_In_Object_Decl): Establish_Transient_Scope -- no need for secondary stack here, just because the type needs finalization. That code is obsolete. (Convert_To_Assignments): Only set Unc_Decl if Nkind (N) = N_Aggregate. For "return (...agg...);" don't assume b-i-p implies limited. Needs_Finalization does not imply secondary stack. (Expand_Array_Aggregate): Named notation. Reverse the sense of Component_OK_For_Backend -- more readability with fewer double negatives. * exp_attr.adb (Expand_N_Attribute_Reference): Remove assumptions that b-i-p implies >= Ada 2005. * exp_ch3.adb (Expand_N_Object_Declaration): Remove assumptions that b-i-p implies >= Ada 2005. Remove Adjust if we're building the return object of an extended return statement in place. * exp_ch4.adb (Expand_Allocator_Expression, Expand_N_Indexed_Component, Expand_N_Selected_Component, Expand_N_Slice): Remove assumptions that b-i-p implies >= Ada 2005. * exp_ch5.adb (Expand_N_Assignment_Statement): Remove assumption that b-i-p implies >= Ada 2005. * exp_ch7.adb: Comment fix. * exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Remove assumptions that b-i-p implies >= Ada 2005. * exp_disp.adb (Expand_Interface_Actuals): Remove assumptions that b-i-p implies >= Ada 2005. * exp_util.adb (Build_Allocate_Deallocate_Proc): Look at Storage_Pool (Expr), in case Pool_Id is not set. (Initialized_By_Aliased_BIP_Func_Call): Handle case where the call is qualified or converted. (Is_Secondary_Stack_BIP_Func_Call): Don't check if Nkind (Selector_Name (Param)) = N_Identifier; that's all it could be. * sinfo.ads: Comment fixes. * snames.ads-tmpl: Comment fixes. * debug.adb: Add flag gnatd.9, to enable the build-in-place machinery. From-SVN: r253290
2017-09-08[multiple changes]Arnaud Charlet1-0/+4
2017-09-08 Bob Duff <duff@adacore.com> * par-prag.adb, sem_prag.adb, snames.ads-tmpl: Implement pragma Ada_2020, along the same lines as the other Ada version pragmas. 2017-09-08 Gary Dismukes <dismukes@adacore.com> * sem_ch12.adb: Minor typo fixes and reformatting. 2017-09-08 Yannick Moy <moy@adacore.com> * sem_aggr.adb (Resolve_Record_Aggregate): Rewrite bounds of aggregate subexpressions which may depend on discriminants of the enclosing aggregate. 2017-09-08 Yannick Moy <moy@adacore.com> * sem_ch5.adb: Prevent assertion failure on illegal code. 2017-09-08 Yannick Moy <moy@adacore.com> * lib-xref-spark_specific.adb (Add_SPARK_Xrefs.Is_SPARK_Scope): Avoid calling Renamed_Entity on an entity which cannot be a renaming. 2017-09-08 Eric Botcazou <ebotcazou@adacore.com> * exp_aggr.adb: Add with & use clause for Urealp. (Aggr_Assignment_OK_For_Backend): Accept (almost all) elementary types instead of just discrete types. * sem_eval.adb (Expr_Value): Deal with N_Null for access types. * gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Be prepared for the FP zero value in the memset case. Add small guard. 2017-09-08 Eric Botcazou <ebotcazou@adacore.com> * s-htable.adb (Static_HTable.Reset): Use aggregate instead of loop. From-SVN: r251894
2017-09-06[multiple changes]Arnaud Charlet1-0/+2
2017-09-06 Eric Botcazou <ebotcazou@adacore.com> * ali.ads (ALIs_Record): Add No_Component_Reordering component. (No_Component_Reordering_Specified): New switch. * ali.adb (Initialize_ALI): Set No_Component_Reordering_Specified. (Scan_ALI): Set No_Component_Reordering and deal with NC marker. * bcheck.adb (Check_Consistent_No_Component_Reordering): New check. (Check_Configuration_Consistency): Invoke it. * debug.adb (d.r): Toggle the effect of the switch. (d.v): Change to no-op. * einfo.ads (Has_Complex_Representation): Restrict to record types. (No_Reordering): New alias for Flag239. (OK_To_Reorder_Components): Delete. (No_Reordering): Declare. (Set_No_Reordering): Likewise. (OK_To_Reorder_Components): Delete. (Set_OK_To_Reorder_Components): Likewise. * einfo.adb (Has_Complex_Representation): Expect record types. (No_Reordering): New function. (OK_To_Reorder_Components): Delete. (Set_Has_Complex_Representation): Expect base record types. (Set_No_Reordering): New procedure. (Set_OK_To_Reorder_Components): Delete. (Write_Entity_Flags): Adjust to above change. * fe.h (Debug_Flag_Dot_R): New macro and declaration. * freeze.adb (Freeze_Record_Type): Remove conditional code setting OK_To_Reorder_Components on record types with convention Ada. * lib-writ.adb (Write_ALI): Deal with NC marker. * opt.ads (No_Component_Reordering): New flag. (No_Component_Reordering_Config): Likewise. (Config_Switches_Type): Add No_Component_Reordering component. * opt.adb (Register_Opt_Config_Switches): Copy No_Component_Reordering onto No_Component_Reordering_Config. (Restore_Opt_Config_Switches): Restore No_Component_Reordering. (Save_Opt_Config_Switches): Save No_Component_Reordering. (Set_Opt_Config_Switches): Set No_Component_Reordering. * par-prag.adb (Prag): Deal with Pragma_No_Component_Reordering. * sem_ch3.adb (Analyze_Private_Extension_Declaration): Also set the No_Reordering flag from the default. (Build_Derived_Private_Type): Likewise. (Build_Derived_Record_Type): Likewise. Then inherit it for untagged types and clean up handling of similar flags. (Record_Type_Declaration): Likewise. * sem_ch13.adb (Same_Representation): Deal with No_Reordering and remove redundant test on Is_Tagged_Type. * sem_prag.adb (Analyze_Pragma): Handle No_Component_Reordering. (Sig_Flags): Likewise. * snames.ads-tmpl (Name_No_Component_Reordering): New name. (Pragma_Id): Add Pragma_No_Component_Reordering value. * warnsw.adb (Set_GNAT_Mode_Warnings): Enable -gnatw.q as well. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Copy the layout of the parent type only if the No_Reordering settings match. (components_to_record): Reorder record types with convention Ada by default unless No_Reordering is set or -gnatd.r is specified and do not warn if No_Reordering is set in GNAT mode. 2017-09-06 Ed Schonberg <schonberg@adacore.com> * sem_util.ads, sem_util.adb (Check_Previous_Null_Procedure): new predicate to reject declarations that can be completions, when there is a visible prior homograph that is a null procedure. * sem_ch6.adb (Analyze_Null_Procedure): use it. * sem_ch8.adb (Analyze_Subprogram_Renaming): ditto. 2017-09-06 Thomas Quinot <quinot@adacore.com> * s-regpat.adb (Compile.Parse_Literal): Fix handling of literal run of 253 characters or more. From-SVN: r251760
2017-05-02[multiple changes]Arnaud Charlet1-36/+44
2017-05-02 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Find_Equality_Types, Try_One_Interp): The same relaxed visibility rules for equality operators that apply within an instantiation apply within an inlined body. * sem_type.adb (Add_One_Interp): ditto. 2017-05-02 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Analyze_Pragma): Forbid pragma Contract_Cases on null procedures. 2017-05-02 Eric Botcazou <ebotcazou@adacore.com> * snames.ads-tmpl (Name_Assume, Name_Attribute_Definition, Name_Loop_Optimize, Name_No_Tagged_Streams): Move to regular pragmas. Add placeholders for Default_Scalar_Storage_Order, Dispatching_Domain, and Secondary_Stack_Size. (Pragma_Id): Move Pragma_Assume, Pragma_Attribute_Definition, Pragma_Loop_Optimize and Pragma_No_Tagged_Streams to second part. From-SVN: r247470
2017-04-25[multiple changes]Arnaud Charlet1-1/+4
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * sem_util.adb (Is_Post_State): A reference to a generic in out parameter is considered a change in the post-state of a subprogram. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Load_Parent_Of_Generic); When retrieving the declaration of a subprogram instance within its wrapper package, skip over null statements that may result from the rewriting of ignored pragmas. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * exp_attr.adb (Expand_Attribute_Reference, case 'Read): If the type is an unchecked_union, replace the attribute with a Raise_Program_Error (rather than inserting such before the attribute reference) to handle properly the case where we are processing a component of a larger record, and we need to prevent further expansion for the unchecked union. (Expand_Attribute_Reference, case 'Write): If the type is an unchecked_union, check whether enclosing scope is a Write subprogram. Replace attribute with a Raise_Program_Error if the discriminants of the unchecked_union type have not default values because such a use is erroneous.. 2017-04-25 Tristan Gingold <gingold@adacore.com> * exp_ch9.adb (Expand_N_Task_Type_Declaration): Add relative_deadline to task record on edf profile. (Make_Initialize_Protection): Pass deadline_floor value on edf profile. (Make_Task_Create_Call): Pass relative_deadline value. * par-prag.adb (Prag): Handle Pragma_Deadline_Floor. * s-rident.ads (Profile_Name): Add GNAT_Ravenscar_EDF. (Profile_Info): Add info for GNAT_Ravenscar_EDF. * sem_prag.adb (Set_Ravenscar_Profile): Handle GNAT_Ravenscar_EDF (set scheduling policy). (Analyze_Pragma): Handle GNAT_Ravenscar_EDF profile and Deadline_Floor pragma. (Sig_Flags): Add choice for Pragma_Deadline_Floor. * snames.ads-tmpl (Name_Deadline_Floor, Name_Gnat_Ravenscar_EDF): New names. (Pragma_Deadline_Floor): New pragma. * targparm.adb (Get_Target_Parameters): Recognize GNAT_Ravenscar_EDF profile. From-SVN: r247221
2017-04-25[multiple changes]Arnaud Charlet1-0/+1
2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Derive_Subprogram): Implement rule in RM 6.1.1 (10-15): if derived type T with progenitors is abstract, and primitive P of this type inherits non-trivial classwide preconditions from both a parent operation and from an interface operation, then the inherited operation is abstract if the parent operation is not null. * sem_disp.ads, sem_disp.adb: replace function Covers_Some_Interface with Covered_Interface_Op to yield the actual interface operation that is implemented by a given inherited operation. 2017-04-25 Javier Miranda <miranda@adacore.com> * exp_ch4.adb (Expand_N_Op_Expon): Relocate left and right operands after performing the validity checks. Required because validity checks may remove side effects from the operands. 2017-04-25 Javier Miranda <miranda@adacore.com> * exp_attr.adb (Attribute_Unrestricted_Access): Do not disable implicit type conversion. Required to generate code that displaces the pointer to reference the secondary dispatch table. 2017-04-25 Pascal Obry <obry@adacore.com> * prj-attr.adb, snames.ads-tmpl: Add package Install's Required_Artifacts attribute. From-SVN: r247202
2017-04-25[multiple changes]Arnaud Charlet1-0/+4
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Insert_Valid_Check): Do not generate a validity check when inside a generic. 2017-04-25 Yannick Moy <moy@adacore.com> * sem_res.adb (Resolve_Type_Conversion): Fix bad logic. 2017-04-25 Arnaud Charlet <charlet@adacore.com> * snames.ads-tmpl (Snames): More names for detecting predefined potentially blocking subprograms. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Analyze_Pre_Post_Condition): The rules concerning inheritance of class-wide preconditions do not apply to postconditions. 2017-04-25 Bob Duff <duff@adacore.com> * s-ficobl.ads: Minor comment fix. From-SVN: r247174
2017-04-25[multiple changes]Arnaud Charlet1-0/+2
2017-04-25 Arnaud Charlet <charlet@adacore.com> * a-cfinve.ads, a-cofove.ads (Empty_Vector): add Global contract. 2017-04-25 Justin Squirek <squirek@adacore.com> * sem_ch3.adb (Analyze_Declarations): Minor correction to comments, move out large conditional and scope traversal into a predicate. (Uses_Unseen_Lib_Unit_Priv): Predicate function made from extracted logic. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Selected_Component): Refine analysis of prefix whose type is a current instance of a synchronized type. If the prefix is an object this is an external call (or requeue) that can only access public operations of the object. The previous predicate was too restrictive, and did not allow public protected operations, only task entries. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb, fname.adb: Minor reformatting. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * einfo.adb (Is_Anonymous_Access_Type): New routine. * einfo.ads Update the placement of E_Anonymous_Access_Subprogram_Type along with all subtypes that mention the ekind. (Is_Anonymous_Access_Type): New routine. * exp_ch7.adb (Allows_Finalization_Master): Do not generate a master for an access type subject to pragma No_Heap_Finalization. * exp_util.adb (Build_Allocate_Deallocate_Proc): An object being allocated or deallocated does not finalization actions if the associated access type is subject to pragma No_Heap_Finalization. * opt.ads Add new global variable No_Heap_Finalization_Pragma. * par-prag.adb Pragma No_Heap_Finalization does not need special processing from the parser. * sem_ch6.adb (Check_Return_Subtype_Indication): Remove ancient ??? comments. Use the new predicate Is_Anonymous_Access_Type. * sem_prag.adb Add an entry in table Sig_Flags for pragma No_Heap_Finalization. (Analyze_Pragma): Add processing for pragma No_Heap_Finalization. Update various error messages to use Duplication_Error. * sem_util.ads, sem_util.adb (No_Heap_Finalization): New routine. * snames.ads-tmpl: Add new predefined name No_Heap_Finalization and corresponding pragma id. From-SVN: r247156
2017-01-12sem_prag.adb (Analyze_Pragma): Add appropriate calls to Resolve_Suppressible ↵Justin Squirek1-0/+1
in the pragma Assertion_Policy case. 2017-01-12 Justin Squirek <squirek@adacore.com> * sem_prag.adb (Analyze_Pragma): Add appropriate calls to Resolve_Suppressible in the pragma Assertion_Policy case. (Resolve_Suppressible): Created this function to factor out common code used to resolve Suppress to either Ignore or Check * snames.ads-tmpl: Add name for Suppressible. From-SVN: r244362
2017-01-12exp_ch9.adb, [...]: Minor reformatting.Gary Dismukes1-1/+1
2017-01-12 Gary Dismukes <dismukes@adacore.com> * exp_ch9.adb, s-secsta.adb, snames.ads-tmpl, exp_ch3.adb: Minor reformatting. * debug.adb: Minor comment fixes. From-SVN: r244360
2017-01-12[multiple changes]Arnaud Charlet1-6/+11
2017-01-12 Arnaud Charlet <charlet@adacore.com> * sem_util.adb (Unique_Entity): For concurrent bodies that are defined with stubs and complete a declaration of a single concurrent object return the entity of an implicit concurrent type, not the entity of the anonymous concurrent object. * debug.adb: -gnatd.J is no longer used. * make.adb (Globalize): Removed, no longer used. * sem_ch9.adb: minor typo in comment for entry index 2017-01-12 Patrick Bernardi <bernardi@adacore.com> * aspect.adb, aspect.ads: Added new aspect Secondary_Stack_Size. * exp_ch3.adb (Build_Init_Statements): As part of initialising the value record of a task, set its _Secondary_Stack_Size field if present. * exp_ch9.adb (Expand_N_Task_Type_Declaration): Create a _Secondary_Stack_Size field in the value record of the task if a Secondary_Stack_Size rep item is present. (Make_Task_Create_Call): Include secondary stack size parameter. If No_Secondary_Stack restriction is in place, passes stack size of 0. * par-prag.adb, sem_prag.adb, sem_prag.ads: Added new pragma Secondary_Stack_Size. * s-secsta.adb, s-secsta.ads (Minimum_Secondary_Stack_Size): New function to define the overhead of the secondary stack. * s-tarest.adb (Create_Restricted_Task, Create_Restricted_Task_Sequential): Functions now include Secondary_Stack_Size parameter to pass to Initialize_ATCB. * s-tarest.adb (Create_Restricted_Task, Create_Restricted_Task_Sequential): Calls to Initialize_ATCB now include Secondary_Stack_Size parameter. (Task_Wrapper): Secondary stack now allocated to the size specified by the Secondary_Stack_Size parameter in the task's ATCB. * s-taskin.adb, s-taskin.adb (Common_ATCB, Initialize_ATCB): New Secondary_Stack_Size component. * s-tassta.adb, s-tassta.ads (Create_Restricted_Task, Create_Restricted_Task_Sequential): Function now include Secondary_Stack_Size parameter. (Task_Wrapper): Secondary stack now allocated to the size specified by the Secondary_Stack_Size parameter in the task's ATCB. * s-tproft.adb (Register_Foreign_Thread): Amended Initialize_ATCB call to include Secondary_Stack_Size parameter. * sem_ch13.adb (Analyze_Aspect_Specification): Add support for Secondary_Stack_Size aspect, turning the aspect into its corresponding internal attribute. (Analyze_Attribute_Definition): Process Secondary_Stack_Size attribute. * snames.adb-tmpl, snames.ads-tmpl: Added names Name_Secondary_Stack_Size, Name_uSecondary_Stack_Size, Attribute_Secondary_Stack_Size and Pragma_Secondary_Stack_Size. From-SVN: r244358
2017-01-06aspects.adb, [...]: Reverted previous change for now.Patrick Bernardi1-11/+6
2017-01-06 Patrick Bernardi <bernardi@adacore.com> * aspects.adb, aspects.ads, exp_ch3.adb, exp_ch9.adb, par-prag.adb, sem_ch13.adb, sem_prag.adb, sem_prag.ads, snames.adb-tmpl, snames.ads-tmpl, s-secsta.adb, s-secsta.ads, s-tarest.adb, s-tarest.ads, s-taskin.adb, s-taskin.ads, s-tassta.adb, s-tassta.ads: Reverted previous change for now. From-SVN: r244148
2017-01-06aspect.adb, aspect.ads: Added new aspect Secondary_Stack_Size.Patrick Bernardi1-6/+11
2017-01-06 Patrick Bernardi <bernardi@adacore.com> * aspect.adb, aspect.ads: Added new aspect Secondary_Stack_Size. * exp_ch3.adb (Build_Init_Statements): As part of initialising the value record of a task, set its _Secondary_Stack_Size field if present. * exp_ch9.adb (Expand_N_Task_Type_Declaration): Create a _Secondary_Stack_Size field in the value record of the task if a Secondary_Stack_Size rep item is present. (Make_Task_Create_Call): Include secondary stack size parameter. If No_Secondary_Stack restriction is in place, passes stack size of 0. * par-prag.adb, sem_prag.adb, sem_prag.ads: Added new pragma Secondary_Stack_Size. * s-secsta.adb, s-secsta.ads (Minimum_Secondary_Stack_Size): New function to define the overhead of the secondary stack. * s-tarest.adb (Create_Restricted_Task, Create_Restricted_Task_Sequential): Functions now include Secondary_Stack_Size parameter to pass to Initialize_ATCB. * s-tarest.adb (Create_Restricted_Task, Create_Restricted_Task_Sequential): Calls to Initialize_ATCB now include Secondary_Stack_Size parameter. (Task_Wrapper): Secondary stack now allocated to the size specified by the Secondary_Stack_Size parameter in the task's ATCB. * s-taskin.adb, s-taskin.adb (Common_ATCB, Initialise_ATCB): New Secondary_Stack_Size component. * s-tassta.adb, s-tassta.ads (Create_Restricted_Task, Create_Restricted_Task_Sequential): Function now include Secondary_Stack_Size parameter. (Task_Wrapper): Secondary stack now allocated to the size specified by the Secondary_Stack_Size parameter in the task's ATCB. * sem_ch13.adb (Analyze_Aspect_Specification): Add support for Secondary_Stack_Size aspect, turning the aspect into its corresponding internal attribute. (Analyze_Attribute_Definition): Process Secondary_Stack_Size attribute. * snames.adb-tmpl, snames.ads-tmpl: Added names Name_Secondary_Stack_Size, Name_uSecondary_Stack_Size, Attribute_Secondary_Stack_Size and Pragma_Secondary_Stack_Size. From-SVN: r244146
2017-01-06snames.ads-tmpl (Renamed): New name for the pragma argument.Bob Duff1-0/+1
2017-01-06 Bob Duff <duff@adacore.com> * snames.ads-tmpl (Renamed): New name for the pragma argument. * par-ch2.adb: Allow the new pragma (with analysis deferred to Sem_Prag). * sinfo.ads, sinfo.adb (Map_Pragma_Name, Pragma_Name_Mapped): Keep a mapping from new pragma names to old names. * sem_prag.adb: Check legality of pragma Rename_Pragma, and implement it by calling Map_Pragma_Name. * checks.adb, contracts.adb, einfo.adb, errout.adb, * exp_attr.adb, exp_ch3.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, * exp_prag.adb, exp_util.adb, freeze.adb, frontend.adb, ghost.adb, * inline.adb, lib-writ.adb, scans.adb, scans.ads, sem_attr.adb, * sem_aux.adb, sem_ch10.adb, sem_ch13.adb, sem_ch6.adb, sem_ch9.adb, * sem_elab.adb, sem_res.adb, sem_util.adb, sem_util.ads, * sem_warn.adb: Call Pragma_Name_Mapped instead of Pragma_Name as appropriate. From-SVN: r244144
2017-01-06[multiple changes]Arnaud Charlet1-1/+4
2017-01-06 Gary Dismukes <dismukes@adacore.com> * einfo.ads, sem_res.adb, sem_attr.adb, sem_ch6.adb: Minor reformatting and typo fixes. 2017-01-06 Bob Duff <duff@adacore.com> * snames.ads-tmpl: New names for pragma renaming. * snames.adb-tmpl (Is_Configuration_Pragma_Name): Minor cleanup. * par-prag.adb: Add new pragma name to case statement. * sem_prag.adb (Rename_Pragma): Initial cut at semantic analysis of the pragma. * sinfo.ads, sinfo.adb (Pragma_Name_Mapped): Preparation work, Dummy implementation of Pragma_Name_Mapped. From-SVN: r244140
2017-01-06exp_attr.adb (Expand_N_Attribute_Reference): Add entry for expansion of ↵Justin Squirek1-0/+2
Finalization_Size attribute. 2017-01-06 Justin Squirek <squirek@adacore.com> * exp_attr.adb (Expand_N_Attribute_Reference): Add entry for expansion of Finalization_Size attribute. * sem_attr.adb (Analyze_Attribute): Add entry to check the semantics of Finalization_Size. (Eval_Attribute): Add null entry for Finalization_Size. * sem_attr.ads: Add Finalization_Size to the implementation dependent attribute list. * snames.ads-tmpl: Add name entry for Finalization_Size attribute. From-SVN: r244134
2017-01-06[multiple changes]Arnaud Charlet1-0/+2
2017-01-06 Tristan Gingold <gingold@adacore.com> * ada.ads, a-unccon.ads: Add pragma No_Elaboration_Code_All. 2017-01-06 Hristian Kirtchev <kirtchev@adacore.com> * sem_case.adb: Minor reformatting. 2017-01-06 Thomas Quinot <quinot@adacore.com> * g-socthi-mingw.adb: Remove now extraneous USE TYPE clause 2017-01-06 Justin Squirek <squirek@adacore.com> * aspects.adb: Register aspect in Canonical_Aspect. * aspects.ads: Associate qualities of Aspect_Max_Queue_Length into respective tables. * einfo.ads, einfo.adb: Add a new attribute for handling the parameters for Pragma_Max_Entry_Queue (Entry_Max_Queue_Lengths_Array) in E_Protected_Type. Subprograms for accessing and setting were added as well. * par-prag.adb (Prag): Register Pramga_Max_Entry_Queue. * exp_ch9.adb (Expand_N_Protected_Type_Declaration): Emit declaration for pramga arguments and store them in the protected type node. (Make_Initialize_Protection): Pass a reference to the Entry_Max_Queue_Lengths_Array in the protected type node to the runtime. * rtsfind.adb: Minor grammar fix. * rtsfind.ads: Register new types taken from the runtime libraries RE_Protected_Entry_Queue_Max and RE_Protected_Entry_Queue_Max_Array * s-tposen.adb, s-tpoben.adb (Initialize_Protection_Entry/Initialize_Protection_Entries): Add extra parameter and add assignment to local object. * s-tposen.ads, s-tpoben.ads: Add new types to store entry queue maximums and a field to the entry object record. * sem_ch13.adb (Analyze_Aspect_Specifications): Add case statement for Aspect_Max_Queue_Length. (Check_Aspect_At_Freeze_Point): Add aspect to list of aspects that don't require delayed analysis. * sem_prag.adb (Analyze_Pragma): Add case statement for Pragma_Max_Queue_Length, check semantics, and register arugments in the respective entry nodes. * sem_util.adb, sem_util.ads Add functions Get_Max_Queue_Length and Has_Max_Queue_Length * snames.ads-tmpl: Add constant for the new aspect-name Name_Max_Queue_Length and corrasponding pragma. 2017-01-06 Hristian Kirtchev <kirtchev@adacore.com> * exp_util.adb (Is_Controlled_Function_Call): Reimplemented. Consider any node which has an entity as the function call may appear in various ways. From-SVN: r244126
2016-07-04einfo.adb (Has_Pragma_Unused): Create this function as a setter for a new ↵Justin Squirek1-0/+2
flag294 (Set_Has_Pragma_Unused):... 2016-07-04 Justin Squirek <squirek@adacore.com> * einfo.adb (Has_Pragma_Unused): Create this function as a setter for a new flag294 (Set_Has_Pragma_Unused): Create this procedure as a getter for flag294 (Write_Entity_Flags): Register the new flag with an alias * einfo.ads Add comment documenting Has_Pragma_Unused (flag294) and subsequent getter and setter declarations. * lib-xref.adb (Generate_Reference): Recognize Has_Pragma_Unused flag to print appropriate warning messages. * par-prag.adb (Prag): Classify Pragma_Unused into "All Other Pragmas." * snames.ads-tmpl Add a new name to the name constants and a new pramga to Pragma_Id for pramga Unused. * sem_prag.adb (Analyze_Pragma): Create case for Pragma_Unused and move the block for Pragma_Unmodified and Pragma_Unreferenced out and into local subprograms. (Analyze_Unmodified, Analyze_Unreferenced): From the old pragma blocks that have been separated in to local subprograms add a parameter to indicate the if they are being called in the context of Pragma_Unused and handle it accordingly. (Is_Non_Significant_Pragma_Reference): Add an entry for Pragma_Unused and correct the position of Pragma_Unevaluated_Use_Of_Old. * sem_util.adb (Note_Possible_Modification): Recognize Has_Pragma_Unused flag to print appropriate warning messages. From-SVN: r237961
2016-04-20[multiple changes]Arnaud Charlet1-4/+4
2016-04-20 Arnaud Charlet <charlet@adacore.com> * snames.ads-tmpl (Internal_Attribute_Id, Attribute_Class_Array): Fix indentation. * sem_util.adb (Is_Unchecked_Conversion_Instance): defense against library-level renamings of other functions, which are never instances of Unchecked_Conversion. * einfo.ads: minor fix of casing in comment 2016-04-20 Ed Schonberg <schonberg@adacore.com> * exp_ch6.adb (Expand_N_Subprogram_Stub): Do not expand a body that has been analyzed and expanded already. Qualify the names in the proper body for use in the generation of C code. From-SVN: r235244
2016-04-18[multiple changes]Arnaud Charlet1-0/+1
2016-04-18 Ed Schonberg <schonberg@adacore.com> * sem_aggr.adb (Resolve_Record_Aggregate): If Warn_On_Redundant_Constructs is enabled, report a redundant box association that does not cover any components, as it done for redundant others associations in case statements. 2016-04-18 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Collect_Inherited_Class_Wide_Conditions): Analyze the generated Check pragma for an inherited condition so that it does not freeze the dispatching type of the primitive operation, because it is pre-analyzed at the point of the subprogram declaration (and not in the subprogram body, as is done during regular expansion). 2016-04-18 Vincent Celier <celier@adacore.com> * ali.ads: Increase the range of all _Id types to 100 millions. 2016-04-18 Gary Dismukes <dismukes@adacore.com> * sem_warn.adb (Check_References): Change warning to suggest using pragma Export rather than saying "volatile has no effect". 2016-04-18 Bob Duff <duff@adacore.com> * g-souinf.ads (Compilation_ISO_Date): New function to return the current date in ISO form. * exp_intr.adb (Expand_Source_Info, Add_Source_Info): Expand a call to Compilation_ISO_Date into a string literal containing the current date in ISO form. * exp_intr.ads (Add_Source_Info): Improve documentation. * sem_intr.adb (Check_Intrinsic_Subprogram): Recognize Compilation_ISO_Date. * snames.ads-tmpl (Name_Compilation_ISO_Date): New Name_Id. From-SVN: r235120
2015-11-12[multiple changes]Arnaud Charlet1-0/+1
2015-11-12 Tristan Gingold <gingold@adacore.com> * snames.ads-tmpl: Name_Gnat_Extended_Ravenscar: New identifier. * s-rident.ads (Profile_Name): Add GNAT_Extended_Ravenscar. (Profile_Info): Add new entry for GNAT_Extended_Ravenscar. * sem_prag.adb (Set_Ravenscar_Profile): Add Profile parameter to handle various ravenscar profiles. Adjust error messages. (Analyze_Pragma): Handle GNAT_Extended_Ravenscar profile. * targparm.adb (Get_Target_Parameters): Handle GNAT_Extended_Ravenscar profile. 2015-11-12 Ed Schonberg <schonberg@adacore.com> * sem_warn.adb (Warn_On_Unreferenced_Entity): If the entity is an Out_Parameter the front-end does not emit any warning on it, so do not suppress warnings on the entity because the backend might be able to determine an uninitialized path and warn accordingly. 2015-11-12 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Selected_Component): Diagnose an attempt to reference an internal entity from a synchronized type from within the body of that type, when the prefix of the selected component is not the current instance. 2015-11-12 Ed Falis <falis@adacore.com> * s-stchop-vxworks.adb: Clean up in stack checking code. 2015-11-12 Gary Dismukes <dismukes@adacore.com> * exp_ch6.adb (Is_Build_In_Place_Function_Call): Test Expression (N) in N_Type_Conversion cases as well, since conversions can occur in actual parameter contexts. (Make_Build_In_Place_Call_In_Anonymous_Context): Retrieve function call from Expression (Func_Call) when Nkind (Func_Call) is N_Type_Conversion, since conversions are allowed in "anonymous" contexts (specifically, as actual parameters). From-SVN: r230242
2015-10-27[multiple changes]Arnaud Charlet1-0/+23
2015-10-27 Javier Miranda <miranda@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Improve previous patch. 2015-10-27 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch12.adb (Analyze_Formal_Package_Declaration): Code cleanup. Set and restore the value of global flag Ignore_Pragma_SPARK_Mode. A formal package declaration acts as a package instantation with respect to SPARK_Mode legality. 2015-10-27 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Check_Constituent_Usage): Use logical operators rather than short circuit operators. Emit an error when a state with visible refinement is not refined. * snames.ads-tmpl: Add names for detecting predefined potentially blocking subprograms. 2015-10-27 Arnaud Charlet <charlet@adacore.com> * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Revert previous change. (Expand_Array_Aggregate): Rewrite previous change here as done for other non GCC back-ends. (Build_Record_Aggr_Code): Add special case. From-SVN: r229414
2015-10-26[multiple changes]Arnaud Charlet1-0/+2
2015-10-26 Bob Duff <duff@adacore.com> * snames.ads-tmpl, aspects.adb, aspects.ads: Add the aspect and pragma names and enter into relevant tables. * sem_ch13.adb (Analyze_Aspect_Specifications): Analyze aspect Predicate_Failure. * sem_prag.adb (Predicate_Failure): Analyze pragma Predicate_Failure. * exp_util.adb (Make_Predicate_Check): When building the Check pragma, if Predicate_Failure has been specified, add the relevant String argument to the pragma. * par-prag.adb (Prag): Add Predicate_Failure to list of pragmas handled during semantic analysis. 2015-10-26 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Assignment): If the left-hand side is an indexed component with generalized indexing, discard interpretation that yields a reference type, which is not assignable. This prevent spurious ambiguities when the right-hand side is an aggregate which does not provide a target type. From-SVN: r229358