summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/prj-conf.adb41
-rw-r--r--gcc/ada/prj-conf.ads8
-rw-r--r--gcc/ada/prj-nmsc.adb24
-rw-r--r--gcc/ada/prj-nmsc.ads7
-rw-r--r--gcc/ada/prj-proc.adb16
-rw-r--r--gcc/ada/prj-proc.ads3
-rw-r--r--gcc/ada/sem_ch10.adb18
8 files changed, 95 insertions, 36 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2e143ceb418..6418c11c8a7 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+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
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index 2591e6d0853..7c60f531884 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -801,6 +801,7 @@ package body Prj.Conf is
begin
Free (Config_File_Path);
+ Config := No_Project;
if Config_File_Name /= "" then
Config_File_Path := Locate_Config_File (Config_File_Name);
@@ -830,28 +831,32 @@ package body Prj.Conf is
-- 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,
@@ -901,7 +906,8 @@ package body Prj.Conf is
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;
@@ -955,6 +961,7 @@ package body Prj.Conf is
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
diff --git a/gcc/ada/prj-conf.ads b/gcc/ada/prj-conf.ads
index 51cb8b37340..a3a499f09bb 100644
--- a/gcc/ada/prj-conf.ads
+++ b/gcc/ada/prj-conf.ads
@@ -31,12 +31,15 @@ with Prj.Tree;
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;
@@ -94,7 +97,8 @@ package Prj.Conf is
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.
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index 04f8ec5b476..6c38cf3e044 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -281,8 +281,12 @@ package body Prj.Nmsc is
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;
@@ -791,7 +795,8 @@ package body Prj.Nmsc is
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;
@@ -824,7 +829,9 @@ package body Prj.Nmsc is
-- 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
@@ -1132,7 +1139,8 @@ package body Prj.Nmsc is
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;
@@ -2364,9 +2372,13 @@ package body Prj.Nmsc is
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,
diff --git a/gcc/ada/prj-nmsc.ads b/gcc/ada/prj-nmsc.ads
index 4c0db4edf71..8ab78afd7e4 100644
--- a/gcc/ada/prj-nmsc.ads
+++ b/gcc/ada/prj-nmsc.ads
@@ -47,7 +47,8 @@ private package Prj.Nmsc is
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
@@ -69,6 +70,10 @@ private package Prj.Nmsc is
-- 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
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb
index 31efd8199a2..c65a286a464 100644
--- a/gcc/ada/prj-proc.adb
+++ b/gcc/ada/prj-proc.adb
@@ -83,7 +83,8 @@ package body Prj.Proc is
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.
@@ -152,6 +153,7 @@ package body Prj.Proc is
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.
@@ -283,7 +285,8 @@ package body Prj.Proc is
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;
@@ -297,6 +300,7 @@ package body Prj.Proc is
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);
@@ -1259,6 +1263,7 @@ package body Prj.Proc is
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;
@@ -2313,7 +2318,8 @@ package body Prj.Proc is
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;
@@ -2328,7 +2334,8 @@ package body Prj.Proc is
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
@@ -2452,6 +2459,7 @@ package body Prj.Proc is
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;
diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads
index e15c8efd283..72b4213c550 100644
--- a/gcc/ada/prj-proc.ads
+++ b/gcc/ada/prj-proc.ads
@@ -66,7 +66,8 @@ package Prj.Proc is
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
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 04f6f99536c..efb0ca7d9f6 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -2375,11 +2375,19 @@ package body Sem_Ch10 is
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