+2009-06-23 Emmanuel Briot <briot@adacore.com>
+
+ * prj-proc.adb, prj-proc.ads, prj-nmsc.adb, prj-nmsc.ads, prj-conf.adb,
+ prj-conf.ads (Check_Configuration): New parameter
+ Compiler_Driver_Mandatory.
+
+2009-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch10.adb (Analyze_With_Clause): If a subprogram instance in the
+ context of the current unit has an inline pragma, the instance is not
+ rewritten as the declaration of the package wrapper. Handle both
+ possibilities when retrieving the visible subprogram that renames the
+ instantiation itself.
+
2009-06-23 Javier Miranda <miranda@adacore.com>
* exp_ch4.adb (Displace_Allocator_Pointer, Expand_N_Allocator): Handle
begin
Free (Config_File_Path);
+ Config := No_Project;
if Config_File_Name /= "" then
Config_File_Path := Locate_Config_File (Config_File_Name);
-- Parse the configuration file
- if Verbose_Mode then
+ if Verbose_Mode and then Config_File_Path /= null then
Write_Str ("Checking configuration ");
Write_Line (Config_File_Path.all);
end if;
- Prj.Part.Parse
- (In_Tree => Project_Node_Tree,
- Project => Config_Project_Node,
- Project_File_Name => Config_File_Path.all,
- Always_Errout_Finalize => False,
- Packages_To_Check => Packages_To_Check,
- Current_Directory => Current_Directory,
- Is_Config_File => True);
-
- if Config_Project_Node /= Empty_Node then
+ if Config_File_Path /= null then
+ Prj.Part.Parse
+ (In_Tree => Project_Node_Tree,
+ Project => Config_Project_Node,
+ Project_File_Name => Config_File_Path.all,
+ Always_Errout_Finalize => False,
+ Packages_To_Check => Packages_To_Check,
+ Current_Directory => Current_Directory,
+ Is_Config_File => True);
+ else
+ -- Maybe the user will want to create his own configuration file
+ Config_Project_Node := Empty_Node;
+ end if;
- if On_Load_Config /= null then
- On_Load_Config
- (Config_File => Config_Project_Node,
- Project_Node_Tree => Project_Node_Tree);
- end if;
+ if On_Load_Config /= null then
+ On_Load_Config
+ (Config_File => Config_Project_Node,
+ Project_Node_Tree => Project_Node_Tree);
+ end if;
+ if Config_Project_Node /= Empty_Node then
Prj.Proc.Process_Project_Tree_Phase_1
(In_Tree => Project_Tree,
Project => Config,
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
- On_Load_Config : Config_File_Hook := null)
+ On_Load_Config : Config_File_Hook := null;
+ Compiler_Driver_Mandatory : Boolean := True)
is
Main_Config_Project : Project_Id;
Success : Boolean;
Report_Error => Report_Error,
Current_Dir => Current_Directory,
When_No_Sources => Warning,
+ Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
Is_Config_File => False);
if not Success then
package Prj.Conf is
type Config_File_Hook is access procedure
- (Config_File : Prj.Tree.Project_Node_Id;
+ (Config_File : in out Prj.Tree.Project_Node_Id;
Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref);
-- Hook called after the config file has been parsed. This lets the
-- application do last minute changes to it (GPS uses this to add the
-- default naming schemes for instance).
-- At that point, the config file has not been applied to the project yet.
+ -- When no config file was found, and automatic generation is disabled, it
+ -- is possible that Config_File is set to Empty_Node when this procedure is
+ -- called. You can then decide to create a new config file if you need.
procedure Parse_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id;
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
- On_Load_Config : Config_File_Hook := null);
+ On_Load_Config : Config_File_Hook := null;
+ Compiler_Driver_Mandatory : Boolean := True);
-- Same as above, except the project must already have been parsed through
-- Prj.Part.Parse, and only the processing of the project and the
-- configuration is done at this level.
procedure Check_Configuration
(Project : Project_Id;
- In_Tree : Project_Tree_Ref);
+ In_Tree : Project_Tree_Ref;
+ Compiler_Driver_Mandatory : Boolean);
-- Check the configuration attributes for the project
+ -- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
+ -- for each language must be defined, or we will not look for its source
+ -- files.
procedure Check_If_Externally_Built
(Project : Project_Id;
When_No_Sources : Error_Warning;
Current_Dir : String;
Proc_Data : in out Processing_Data;
- Is_Config_File : Boolean)
+ Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean)
is
Extending : Boolean := False;
-- Check configuration in multi language mode
if Must_Check_Configuration then
- Check_Configuration (Project, In_Tree);
+ Check_Configuration
+ (Project, In_Tree,
+ Compiler_Driver_Mandatory => Compiler_Driver_Mandatory);
end if;
-- Library attributes
procedure Check_Configuration
(Project : Project_Id;
- In_Tree : Project_Tree_Ref)
+ In_Tree : Project_Tree_Ref;
+ Compiler_Driver_Mandatory : Boolean)
is
Dot_Replacement : File_Name_Type := No_File;
Casing : Casing_Type := All_Lower_Case;
while Lang_Index /= No_Language_Index loop
Current_Language := Lang_Index.Display_Name;
- -- For all languages, Compiler_Driver needs to be specified
+ -- For all languages, Compiler_Driver needs to be specified. This is
+ -- only necessary if we do intend to compiler (not in GPS for
+ -- instance)
- if Lang_Index.Config.Compiler_Driver = No_File then
+ if Compiler_Driver_Mandatory
+ and then Lang_Index.Config.Compiler_Driver = No_File
+ then
Error_Msg_Name_1 := Current_Language;
Error_Msg
(Project,
When_No_Sources : Error_Warning;
Current_Dir : String;
Proc_Data : in out Processing_Data;
- Is_Config_File : Boolean);
+ Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean);
-- Perform consistency and semantic checks on a project, starting from the
-- project tree parsed from the .gpr file. This procedure interprets the
-- various case statements in the project based on the current environment
-- language are found in a project where this language is declared.
--
-- Is_Config_File should be True if Project is config file (.cgpr)
+ --
+ -- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
+ -- for each language must be defined, or we will not look for its source
+ -- files.
private
type Processing_Data is record
Project : Project_Id;
Current_Dir : String;
When_No_Sources : Error_Warning;
- Is_Config_File : Boolean);
+ Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean);
-- Set all projects to not checked, then call Recursive_Check for the
-- main project Project. Project is set to No_Project if errors occurred.
-- Current_Dir is for optimization purposes, avoiding extra system calls.
When_No_Sources : Error_Warning;
Proc_Data : Processing_Data;
Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean;
end record;
-- Data passed to Recursive_Check
-- Current_Dir is for optimization purposes, avoiding extra system calls.
Project : Project_Id;
Current_Dir : String;
When_No_Sources : Error_Warning;
- Is_Config_File : Boolean)
+ Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean)
is
Dir : aliased String := Current_Dir;
Data.Current_Dir := Dir'Unchecked_Access;
Data.When_No_Sources := When_No_Sources;
Data.Is_Config_File := Is_Config_File;
+ Data.Compiler_Driver_Mandatory := Compiler_Driver_Mandatory;
Initialize (Data.Proc_Data);
Check_All_Projects (Project, Data, Imported_First => True);
Report_Error => Report_Error,
When_No_Sources => When_No_Sources,
Current_Dir => Current_Dir,
+ Compiler_Driver_Mandatory => True,
Is_Config_File => Is_Config_File);
end if;
end Process;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
Current_Dir : String;
- Is_Config_File : Boolean)
+ Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean)
is
Obj_Dir : Path_Name_Type;
Extending : Project_Id;
if Project /= No_Project then
Check (In_Tree, Project, Current_Dir, When_No_Sources,
- Is_Config_File => Is_Config_File);
+ Is_Config_File => Is_Config_File,
+ Compiler_Driver_Mandatory => Compiler_Driver_Mandatory);
end if;
-- If main project is an extending all project, set the object
Prj.Nmsc.Check
(Project, Data.In_Tree, Error_Report, Data.When_No_Sources,
Data.Current_Dir.all, Data.Proc_Data,
+ Compiler_Driver_Mandatory => Data.Compiler_Driver_Mandatory,
Is_Config_File => Data.Is_Config_File);
end Recursive_Check;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
Current_Dir : String;
- Is_Config_File : Boolean);
+ Is_Config_File : Boolean;
+ Compiler_Driver_Mandatory : Boolean);
-- Perform the second phase of the processing, filling the rest of the
-- project with the information extracted from the project tree. This phase
-- requires that the configuration file has already been parsed (in fact
elsif Unit_Kind in N_Subprogram_Instantiation then
- -- Instantiation node is replaced with a wrapper package. Retrieve
- -- the visible subprogram created by the instance from corresponding
- -- attribute of the wrapper.
-
- E_Name := Related_Instance (Defining_Entity (U));
+ -- The visible subprogram is created during instantiation, and is
+ -- an attribute of the wrapper package. We retrieve the wrapper
+ -- package directly from the instantiation node. If the instance
+ -- is inlined the unit is still an instantiation. Otherwise it has
+ -- been rewritten as the declaration of the wrapper itself.
+
+ if Nkind (U) in N_Subprogram_Instantiation then
+ E_Name :=
+ Related_Instance
+ (Defining_Entity (Specification (Instance_Spec (U))));
+ else
+ E_Name := Related_Instance (Defining_Entity (U));
+ end if;
elsif Unit_Kind = N_Package_Renaming_Declaration
or else Unit_Kind in N_Generic_Renaming_Declaration