Commit 9ceeaf9d by Arnaud Charlet

[multiple changes]

2014-10-10  Robert Dewar  <dewar@adacore.com>

	* freeze.adb, sem_attr.adb: Minor reformatting.

2014-10-10  Johannes Kanig  <kanig@adacore.com>

	* a-cfdlli.ads, a-cfhama.ads, a-cfhase.ads, a-cforma.ads,
	a-cforse.ads, a-cofove.ads: add "Default_Initial_Condition"
	to container type.

2014-10-10  Vincent Celier  <celier@adacore.com>

	* prj-conf.adb (Do_Autoconf): In Codepeer mode, do not try to get
	any configuration switches from the project file.

2014-10-10  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Build_Wrapper): Renamed as Build_Operator_Wrapper.
	(Build_Function_Wrapper): New function, to construct a wrapper
	function for actuals that are functions with an arbitrary
	number of parameters. Used in GNATProve mode to simplify proof
	propagation in instantiations.

From-SVN: r216092
parent 4d1429b2
2014-10-10 Robert Dewar <dewar@adacore.com> 2014-10-10 Robert Dewar <dewar@adacore.com>
* freeze.adb, sem_attr.adb: Minor reformatting.
2014-10-10 Johannes Kanig <kanig@adacore.com>
* a-cfdlli.ads, a-cfhama.ads, a-cfhase.ads, a-cforma.ads,
a-cforse.ads, a-cofove.ads: add "Default_Initial_Condition"
to container type.
2014-10-10 Vincent Celier <celier@adacore.com>
* prj-conf.adb (Do_Autoconf): In Codepeer mode, do not try to get
any configuration switches from the project file.
2014-10-10 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Build_Wrapper): Renamed as Build_Operator_Wrapper.
(Build_Function_Wrapper): New function, to construct a wrapper
function for actuals that are functions with an arbitrary
number of parameters. Used in GNATProve mode to simplify proof
propagation in instantiations.
2014-10-10 Robert Dewar <dewar@adacore.com>
* freeze.adb, gnat1drv.adb, sem_ch13.adb: Minor reformatting and * freeze.adb, gnat1drv.adb, sem_ch13.adb: Minor reformatting and
code clean up. code clean up.
......
...@@ -69,7 +69,8 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is ...@@ -69,7 +69,8 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
Iterable => (First => First, Iterable => (First => First,
Next => Next, Next => Next,
Has_Element => Has_Element, Has_Element => Has_Element,
Element => Element); Element => Element),
Default_Initial_Condition;
pragma Preelaborable_Initialization (List); pragma Preelaborable_Initialization (List);
type Cursor is private; type Cursor is private;
......
...@@ -74,7 +74,8 @@ package Ada.Containers.Formal_Hashed_Maps is ...@@ -74,7 +74,8 @@ package Ada.Containers.Formal_Hashed_Maps is
Iterable => (First => First, Iterable => (First => First,
Next => Next, Next => Next,
Has_Element => Has_Element, Has_Element => Has_Element,
Element => Element); Element => Element),
Default_Initial_Condition;
pragma Preelaborable_Initialization (Map); pragma Preelaborable_Initialization (Map);
type Cursor is private; type Cursor is private;
......
...@@ -76,7 +76,8 @@ package Ada.Containers.Formal_Hashed_Sets is ...@@ -76,7 +76,8 @@ package Ada.Containers.Formal_Hashed_Sets is
Iterable => (First => First, Iterable => (First => First,
Next => Next, Next => Next,
Has_Element => Has_Element, Has_Element => Has_Element,
Element => Element); Element => Element),
Default_Initial_Condition;
pragma Preelaborable_Initialization (Set); pragma Preelaborable_Initialization (Set);
type Cursor is private; type Cursor is private;
......
...@@ -78,7 +78,8 @@ package Ada.Containers.Formal_Ordered_Maps is ...@@ -78,7 +78,8 @@ package Ada.Containers.Formal_Ordered_Maps is
Iterable => (First => First, Iterable => (First => First,
Next => Next, Next => Next,
Has_Element => Has_Element, Has_Element => Has_Element,
Element => Element); Element => Element),
Default_Initial_Condition;
pragma Preelaborable_Initialization (Map); pragma Preelaborable_Initialization (Map);
type Cursor is private; type Cursor is private;
......
...@@ -77,7 +77,8 @@ package Ada.Containers.Formal_Ordered_Sets is ...@@ -77,7 +77,8 @@ package Ada.Containers.Formal_Ordered_Sets is
Iterable => (First => First, Iterable => (First => First,
Next => Next, Next => Next,
Has_Element => Has_Element, Has_Element => Has_Element,
Element => Element); Element => Element),
Default_Initial_Condition;
pragma Preelaborable_Initialization (Set); pragma Preelaborable_Initialization (Set);
type Cursor is private; type Cursor is private;
......
...@@ -81,7 +81,8 @@ package Ada.Containers.Formal_Vectors is ...@@ -81,7 +81,8 @@ package Ada.Containers.Formal_Vectors is
Iterable => (First => First, Iterable => (First => First,
Next => Next, Next => Next,
Has_Element => Has_Element, Has_Element => Has_Element,
Element => Element); Element => Element),
Default_Initial_Condition;
type Cursor is private; type Cursor is private;
pragma Preelaborable_Initialization (Cursor); pragma Preelaborable_Initialization (Cursor);
......
...@@ -1858,11 +1858,10 @@ package body Freeze is ...@@ -1858,11 +1858,10 @@ package body Freeze is
-- package. Recurse on inner generic packages. -- package. Recurse on inner generic packages.
function Freeze_Profile (E : Entity_Id) return Boolean; function Freeze_Profile (E : Entity_Id) return Boolean;
-- Freeze formals and return type of subprogram. -- Freeze formals and return type of subprogram. If some type in the
-- If some type in the profile is a limited view, freezing of the entity -- profile is a limited view, freezing of the entity will take place
-- will take place elsewhere, and the function returns False. -- elsewhere, and the function returns False. This routine will be
-- This routine will be modified if and when we can implement AI05-019 -- modified if and when we can implement AI05-019 efficiently ???
-- efficiently.
procedure Freeze_Record_Type (Rec : Entity_Id); procedure Freeze_Record_Type (Rec : Entity_Id);
-- Freeze record type, including freezing component types, and freezing -- Freeze record type, including freezing component types, and freezing
...@@ -2557,8 +2556,8 @@ package body Freeze is ...@@ -2557,8 +2556,8 @@ package body Freeze is
Attribute_Name => Name_Range_Length); Attribute_Name => Name_Range_Length);
Analyze_And_Resolve (Ilen); Analyze_And_Resolve (Ilen);
-- No attempt is made to check number of elements -- No attempt is made to check number of elements if not
-- if not compile time known. -- compile time known.
if Nkind (Ilen) /= N_Integer_Literal then if Nkind (Ilen) /= N_Integer_Literal then
Elmts := Uint_0; Elmts := Uint_0;
...@@ -2601,9 +2600,9 @@ package body Freeze is ...@@ -2601,9 +2600,9 @@ package body Freeze is
end if; end if;
end if; end if;
-- If any of the index types was an enumeration type with a -- If any of the index types was an enumeration type with a non-
-- non-standard rep clause, then we indicate that the array type -- standard rep clause, then we indicate that the array type is
-- is always packed (even if it is not bit packed). -- always packed (even if it is not bit packed).
if Non_Standard_Enum then if Non_Standard_Enum then
Set_Has_Non_Standard_Rep (Base_Type (Arr)); Set_Has_Non_Standard_Rep (Base_Type (Arr));
...@@ -2704,9 +2703,9 @@ package body Freeze is ...@@ -2704,9 +2703,9 @@ package body Freeze is
while Present (Formal) loop while Present (Formal) loop
F_Type := Etype (Formal); F_Type := Etype (Formal);
-- AI05-0151: incomplete types can appear in a profile. -- AI05-0151: incomplete types can appear in a profile. By the
-- By the time the entity is frozen, the full view must -- time the entity is frozen, the full view must be available,
-- be available, unless it is a limited view. -- unless it is a limited view.
if Is_Incomplete_Type (F_Type) if Is_Incomplete_Type (F_Type)
and then Present (Full_View (F_Type)) and then Present (Full_View (F_Type))
...@@ -2724,12 +2723,11 @@ package body Freeze is ...@@ -2724,12 +2723,11 @@ package body Freeze is
and then not Is_Generic_Type (F_Type) and then not Is_Generic_Type (F_Type)
and then not Is_Derived_Type (F_Type) and then not Is_Derived_Type (F_Type)
then then
-- If the type of a formal is incomplete, subprogram -- If the type of a formal is incomplete, subprogram is being
-- is being frozen prematurely. Within an instance -- frozen prematurely. Within an instance (but not within a
-- (but not within a wrapper package) this is an -- wrapper package) this is an artifact of our need to regard
-- artifact of our need to regard the end of an -- the end of an instantiation as a freeze point. Otherwise it
-- instantiation as a freeze point. Otherwise it is -- is a definite error.
-- a definite error.
if In_Instance then if In_Instance then
Set_Is_Frozen (E, False); Set_Is_Frozen (E, False);
...@@ -2741,13 +2739,12 @@ package body Freeze is ...@@ -2741,13 +2739,12 @@ package body Freeze is
then then
Error_Msg_Node_1 := F_Type; Error_Msg_Node_1 := F_Type;
Error_Msg Error_Msg
("type& must be fully defined before this point", ("type & must be fully defined before this point", Loc);
Loc);
end if; end if;
end if; end if;
-- Check suspicious parameter for C function. These tests -- Check suspicious parameter for C function. These tests apply
-- apply only to exported/imported subprograms. -- only to exported/imported subprograms.
if Warn_On_Export_Import if Warn_On_Export_Import
and then Comes_From_Source (E) and then Comes_From_Source (E)
...@@ -2780,20 +2777,22 @@ package body Freeze is ...@@ -2780,20 +2777,22 @@ package body Freeze is
and then not Has_Size_Clause (F_Type) and then not Has_Size_Clause (F_Type)
and then VM_Target = No_VM and then VM_Target = No_VM
then then
Error_Msg_N ("& is an 8-bit Ada Boolean?x?", Formal); Error_Msg_N
Error_Msg_N ("\use appropriate corresponding type in C " ("& is an 8-bit Ada Boolean?x?", Formal);
Error_Msg_N
("\use appropriate corresponding type in C "
& "(e.g. char)?x?", Formal); & "(e.g. char)?x?", Formal);
-- Check suspicious tagged type -- Check suspicious tagged type
elsif (Is_Tagged_Type (F_Type) elsif (Is_Tagged_Type (F_Type)
or else (Is_Access_Type (F_Type) or else
and then (Is_Access_Type (F_Type)
Is_Tagged_Type and then Is_Tagged_Type (Designated_Type (F_Type))))
(Designated_Type (F_Type))))
and then Convention (E) = Convention_C and then Convention (E) = Convention_C
then then
Error_Msg_N ("?x?& involves a tagged type which does not " Error_Msg_N
("?x?& involves a tagged type which does not "
& "correspond to any C type!", Formal); & "correspond to any C type!", Formal);
-- Check wrong convention subprogram pointer -- Check wrong convention subprogram pointer
...@@ -2801,7 +2800,8 @@ package body Freeze is ...@@ -2801,7 +2800,8 @@ package body Freeze is
elsif Ekind (F_Type) = E_Access_Subprogram_Type elsif Ekind (F_Type) = E_Access_Subprogram_Type
and then not Has_Foreign_Convention (F_Type) and then not Has_Foreign_Convention (F_Type)
then then
Error_Msg_N ("?x?subprogram pointer & should " Error_Msg_N
("?x?subprogram pointer & should "
& "have foreign convention!", Formal); & "have foreign convention!", Formal);
Error_Msg_Sloc := Sloc (F_Type); Error_Msg_Sloc := Sloc (F_Type);
Error_Msg_NE Error_Msg_NE
...@@ -2814,8 +2814,8 @@ package body Freeze is ...@@ -2814,8 +2814,8 @@ package body Freeze is
Error_Msg_Qual_Level := 0; Error_Msg_Qual_Level := 0;
end if; end if;
-- Check for unconstrained array in exported foreign -- Check for unconstrained array in exported foreign convention
-- convention case. -- case.
if Has_Foreign_Convention (E) if Has_Foreign_Convention (E)
and then not Is_Imported (E) and then not Is_Imported (E)
...@@ -2830,17 +2830,16 @@ package body Freeze is ...@@ -2830,17 +2830,16 @@ package body Freeze is
then then
Error_Msg_Qual_Level := 1; Error_Msg_Qual_Level := 1;
-- If this is an inherited operation, place the -- If this is an inherited operation, place the warning on
-- warning on the derived type declaration, rather -- the derived type declaration, rather than on the original
-- than on the original subprogram. -- subprogram.
if Nkind (Original_Node (Parent (E))) = N_Full_Type_Declaration if Nkind (Original_Node (Parent (E))) = N_Full_Type_Declaration
then then
Warn_Node := Parent (E); Warn_Node := Parent (E);
if Formal = First_Formal (E) then if Formal = First_Formal (E) then
Error_Msg_NE Error_Msg_NE ("??in inherited operation&", Warn_Node, E);
("??in inherited operation&", Warn_Node, E);
end if; end if;
else else
Warn_Node := Formal; Warn_Node := Formal;
...@@ -2987,8 +2986,7 @@ package body Freeze is ...@@ -2987,8 +2986,7 @@ package body Freeze is
end if; end if;
-- Give warning for suspicious return of a result of an -- Give warning for suspicious return of a result of an
-- unconstrained array type in a foreign convention -- unconstrained array type in a foreign convention function.
-- function.
if Has_Foreign_Convention (E) if Has_Foreign_Convention (E)
...@@ -2997,19 +2995,18 @@ package body Freeze is ...@@ -2997,19 +2995,18 @@ package body Freeze is
and then Is_Array_Type (R_Type) and then Is_Array_Type (R_Type)
and then not Is_Constrained (R_Type) and then not Is_Constrained (R_Type)
-- Exclude imported routines, the warning does not -- Exclude imported routines, the warning does not belong on
-- belong on the import, but rather on the routine -- the import, but rather on the routine definition.
-- definition.
and then not Is_Imported (E) and then not Is_Imported (E)
-- Exclude VM case, since both .NET and JVM can handle -- Exclude VM case, since both .NET and JVM can handle return
-- return of unconstrained arrays without a problem. -- of unconstrained arrays without a problem.
and then VM_Target = No_VM and then VM_Target = No_VM
-- Check that general warning is enabled, and that it -- Check that general warning is enabled, and that it is not
-- is not suppressed for this particular case. -- suppressed for this particular case.
and then Warn_On_Export_Import and then Warn_On_Export_Import
and then not Has_Warnings_Off (E) and then not Has_Warnings_Off (E)
......
...@@ -172,7 +172,7 @@ package body Prj.Conf is ...@@ -172,7 +172,7 @@ package body Prj.Conf is
begin begin
if Config_File = Empty_Node then if Config_File = Empty_Node then
-- Create a dummy config file is none was found -- Create a dummy config file if none was found
Name_Len := Auto_Cgpr'Length; Name_Len := Auto_Cgpr'Length;
Name_Buffer (1 .. Name_Len) := Auto_Cgpr; Name_Buffer (1 .. Name_Len) := Auto_Cgpr;
...@@ -587,7 +587,7 @@ package body Prj.Conf is ...@@ -587,7 +587,7 @@ package body Prj.Conf is
or else or else
(Tgt_Name /= No_Name (Tgt_Name /= No_Name
and then (Length_Of_Name (Tgt_Name) = 0 and then (Length_Of_Name (Tgt_Name) = 0
or else Target = Get_Name_String (Tgt_Name))); or else Target = Get_Name_String (Tgt_Name)));
if not OK then if not OK then
if Autoconf_Specified then if Autoconf_Specified then
...@@ -931,7 +931,8 @@ package body Prj.Conf is ...@@ -931,7 +931,8 @@ package body Prj.Conf is
declare declare
Obj_Dir : constant String := Name_Buffer (1 .. Name_Len); Obj_Dir : constant String := Name_Buffer (1 .. Name_Len);
Config_Switches : Argument_List_Access; Config_Switches : Argument_List_Access :=
new Argument_List'(1 .. 0 => null);
Db_Switches : Argument_List_Access; Db_Switches : Argument_List_Access;
Args : Argument_List (1 .. 5); Args : Argument_List (1 .. 5);
Arg_Last : Positive; Arg_Last : Positive;
...@@ -979,10 +980,13 @@ package body Prj.Conf is ...@@ -979,10 +980,13 @@ package body Prj.Conf is
end case; end case;
end if; end if;
-- Get the config switches. This should be done only now, as some -- If not in Codepeer mode, get the config switches. This should
-- runtimes may have been found if the Builder switches. -- be done only now, as some runtimes may have been found if the
-- Builder switches.
Config_Switches := Get_Config_Switches; if not CodePeer_Mode then
Config_Switches := Get_Config_Switches;
end if;
-- Get eventual --db switches -- Get eventual --db switches
...@@ -1082,12 +1086,11 @@ package body Prj.Conf is ...@@ -1082,12 +1086,11 @@ package body Prj.Conf is
Write_Eol; Write_Eol;
elsif not Quiet_Output then elsif not Quiet_Output then
-- Display no message if we are creating auto.cgpr, unless in -- Display no message if we are creating auto.cgpr, unless in
-- verbose mode -- verbose mode.
if Config_File_Name'Length > 0 if Config_File_Name'Length > 0 or else Verbose_Mode then
or else Verbose_Mode
then
Write_Str ("creating "); Write_Str ("creating ");
Write_Str (Simple_Name (Args (3).all)); Write_Str (Simple_Name (Args (3).all));
Write_Eol; Write_Eol;
...@@ -1300,8 +1303,7 @@ package body Prj.Conf is ...@@ -1300,8 +1303,7 @@ package body Prj.Conf is
Config_Command : constant String := Config_Command : constant String :=
"--config=" & Get_Name_String (Name); "--config=" & Get_Name_String (Name);
Runtime_Name : constant String := Runtime_Name : constant String := Runtime_Name_For (Name);
Runtime_Name_For (Name);
begin begin
if Variable = Nil_Variable_Value if Variable = Nil_Variable_Value
...@@ -1321,14 +1323,14 @@ package body Prj.Conf is ...@@ -1321,14 +1323,14 @@ package body Prj.Conf is
if Is_Absolute_Path (Compiler_Command) then if Is_Absolute_Path (Compiler_Command) then
Result (Count) := Result (Count) :=
new String' new String'
(Config_Command & ",," & Runtime_Name & "," & (Config_Command & ",," & Runtime_Name & ","
Containing_Directory (Compiler_Command) & "," & & Containing_Directory (Compiler_Command) & ","
Simple_Name (Compiler_Command)); & Simple_Name (Compiler_Command));
else else
Result (Count) := Result (Count) :=
new String' new String'
(Config_Command & ",," & Runtime_Name & ",," & (Config_Command & ",," & Runtime_Name & ",,"
Compiler_Command); & Compiler_Command);
end if; end if;
end; end;
end if; end if;
...@@ -1350,20 +1352,14 @@ package body Prj.Conf is ...@@ -1350,20 +1352,14 @@ package body Prj.Conf is
begin begin
Variable := Variable :=
Value_Of Value_Of (Name_Source_Dirs, Project.Decl.Attributes, Shared);
(Name_Source_Dirs,
Project.Decl.Attributes,
Shared);
if Variable = Nil_Variable_Value if Variable = Nil_Variable_Value
or else Variable.Default or else Variable.Default
or else Variable.Values /= Nil_String or else Variable.Values /= Nil_String
then then
Variable := Variable :=
Value_Of Value_Of (Name_Source_Files, Project.Decl.Attributes, Shared);
(Name_Source_Files,
Project.Decl.Attributes,
Shared);
return Variable = Nil_Variable_Value return Variable = Nil_Variable_Value
or else Variable.Default or else Variable.Default
or else Variable.Values /= Nil_String; or else Variable.Values /= Nil_String;
...@@ -1373,9 +1369,13 @@ package body Prj.Conf is ...@@ -1373,9 +1369,13 @@ package body Prj.Conf is
end if; end if;
end Might_Have_Sources; end Might_Have_Sources;
-- Local Variables
Success : Boolean; Success : Boolean;
Config_Project_Node : Project_Node_Id := Empty_Node; Config_Project_Node : Project_Node_Id := Empty_Node;
-- Start of processing for Get_Or_Create_Configuration_File
begin begin
pragma Assert (Prj.Env.Is_Initialized (Env.Project_Path)); pragma Assert (Prj.Env.Is_Initialized (Env.Project_Path));
...@@ -1472,9 +1472,7 @@ package body Prj.Conf is ...@@ -1472,9 +1472,7 @@ package body Prj.Conf is
On_New_Tree_Loaded => null); On_New_Tree_Loaded => null);
end if; end if;
if Config_Project_Node = Empty_Node if Config_Project_Node = Empty_Node or else Config = No_Project then
or else Config = No_Project
then
Raise_Invalid_Config Raise_Invalid_Config
("processing of configuration project """ ("processing of configuration project """
& Config_File_Path.all & """ failed"); & Config_File_Path.all & """ failed");
...@@ -1606,7 +1604,6 @@ package body Prj.Conf is ...@@ -1606,7 +1604,6 @@ package body Prj.Conf is
Implicit_Project => Implicit_Project); Implicit_Project => Implicit_Project);
if User_Project_Node = Empty_Node then if User_Project_Node = Empty_Node then
User_Project_Node := Empty_Node;
return; return;
end if; end if;
......
...@@ -11021,7 +11021,6 @@ package body Sem_Attr is ...@@ -11021,7 +11021,6 @@ package body Sem_Attr is
else else
Assoc := First (Component_Associations (Aggr)); Assoc := First (Component_Associations (Aggr));
while Present (Assoc) loop while Present (Assoc) loop
Comp := First (Choices (Assoc)); Comp := First (Choices (Assoc));
Expr := Expression (Assoc); Expr := Expression (Assoc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment