OSDN Git Service

Minor reformatting.
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-ext.adb
index 37c8fc1..8098a3a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2000-2007, Free Software Foundation, Inc.         --
+--          Copyright (C) 2000-2009, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -25,7 +25,6 @@
 
 with Hostparm;
 with Makeutl;  use Makeutl;
-with Output;   use Output;
 with Osint;    use Osint;
 with Sdefault;
 with Table;
@@ -66,7 +65,6 @@ package body Prj.Ext is
    --  first for external reference in this table, before checking the
    --  environment. Htable is emptied (reset) by procedure Reset.
 
-   ---------
    package Search_Directories is new Table.Table
      (Table_Component_Type => Name_Id,
       Table_Index_Type     => Natural,
@@ -76,6 +74,7 @@ package body Prj.Ext is
       Table_Name           => "Prj.Ext.Search_Directories");
    --  The table for the directories specified with -aP switches
 
+   ---------
    -- Add --
    ---------
 
@@ -139,25 +138,8 @@ package body Prj.Ext is
       Last            : Positive;
       New_Len         : Positive;
       New_Last        : Positive;
-      Prj_Path        : String_Access := Gpr_Prj_Path;
 
    begin
-      if Get_Mode = Ada_Only then
-         if Gpr_Prj_Path.all /= "" then
-
-            --  Warn if both environment variables are defined
-
-            if Ada_Prj_Path.all /= "" then
-               Write_Line
-                 ("Warning: ADA_PROJECT_PATH is not taken into account");
-               Write_Line ("         when GPR_PROJECT_PATH is defined");
-            end if;
-
-         else
-            Prj_Path := Ada_Prj_Path;
-         end if;
-      end if;
-
       --  The current directory is always first
 
       Name_Len := 1;
@@ -174,15 +156,20 @@ package body Prj.Ext is
 
       --  If environment variable is defined and not empty, add its content
 
-      if Prj_Path.all /= "" then
+      if Gpr_Prj_Path.all /= "" then
          Name_Len := Name_Len + 1;
          Name_Buffer (Name_Len) := Path_Separator;
+         Add_Str_To_Name_Buffer (Gpr_Prj_Path.all);
+      end if;
 
-         Add_Str_To_Name_Buffer (Prj_Path.all);
+      if Ada_Prj_Path.all /= "" then
+         Name_Len := Name_Len + 1;
+         Name_Buffer (Name_Len) := Path_Separator;
+         Add_Str_To_Name_Buffer (Ada_Prj_Path.all);
       end if;
 
       --  Scan the directory path to see if "-" is one of the directories.
-      --  Remove each occurence of "-" and set Add_Default_Dir to False.
+      --  Remove each occurrence of "-" and set Add_Default_Dir to False.
       --  Also resolve relative paths and symbolic links.
 
       First := 3;
@@ -257,24 +244,19 @@ package body Prj.Ext is
       if Add_Default_Dir then
          declare
             Prefix : String_Ptr := Sdefault.Search_Dir_Prefix;
+
          begin
             if Prefix = null then
                Prefix := new String'(Executable_Prefix_Path);
 
                if Prefix.all /= "" then
-                  if Get_Mode = Ada_Only then
-                     Current_Project_Path :=
-                       new String'(Name_Buffer (1 .. Name_Len) &
-                                   Path_Separator &
-                                   Prefix.all & Directory_Separator & "gnat");
-
-                  else
-                     Current_Project_Path :=
-                       new String'(Name_Buffer (1 .. Name_Len) &
-                                   Path_Separator &
-                                   Prefix.all & Directory_Separator &
-                                   "share" & Directory_Separator & "gpr");
-                  end if;
+                  Add_Str_To_Name_Buffer
+                    (Path_Separator & Prefix.all &
+                     "share" & Directory_Separator & "gpr");
+                  Add_Str_To_Name_Buffer
+                    (Path_Separator & Prefix.all &
+                     Directory_Separator & "lib" &
+                     Directory_Separator & "gnat");
                end if;
 
             else
@@ -285,6 +267,8 @@ package body Prj.Ext is
                              ".." & Directory_Separator &
                              ".." & Directory_Separator & "gnat");
             end if;
+
+            Free (Prefix);
          end;
       end if;