]> gcc.gnu.org Git - gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 23 Jun 2009 09:57:45 +0000 (11:57 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 23 Jun 2009 09:57:45 +0000 (11:57 +0200)
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.

From-SVN: r148839

gcc/ada/ChangeLog
gcc/ada/prj-conf.adb
gcc/ada/prj-conf.ads
gcc/ada/prj-nmsc.adb
gcc/ada/prj-nmsc.ads
gcc/ada/prj-proc.adb
gcc/ada/prj-proc.ads
gcc/ada/sem_ch10.adb

index 2e143ceb4180d5da7e1889795b35086adfe20b8d..6418c11c8a7da7369bfe30789401d5049945cf8a 100644 (file)
@@ -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
index 2591e6d0853910db990393b8e3055b101172d880..7c60f531884d49ec64a2f8ae7c87570e080a77aa 100644 (file)
@@ -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
index 51cb8b3734026bce97d063e2a804044135c1cdf4..a3a499f09bb067576f4f16ad1b347d04ee901529 100644 (file)
@@ -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.
index 04f8ec5b476ff6e1c67f2416a79e96e54db57df4..6c38cf3e04465cc5612a342b2a286a8eb96be0e8 100644 (file)
@@ -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,
index 4c0db4edf71aade0b24801d1b6ec8d5e7ba6aaa3..8ab78afd7e4d80db3b6ddb423e467a98064d6c0e 100644 (file)
@@ -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
index 31efd8199a2d72e80e99e2aab71ec2bd96fbaace..c65a286a4648a1f983112743c820a796524641c0 100644 (file)
@@ -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;
 
index e15c8efd283e4de42e8a291b99a141cc9e3f4b42..72b4213c550581899b73b18386f596c448f645e1 100644 (file)
@@ -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
index 04f6f99536c01e4bdccde4ef78780fa138f08982..efb0ca7d9f604eac70d0d61065819af0e852adfc 100644 (file)
@@ -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
This page took 0.076819 seconds and 5 git commands to generate.