summaryrefslogtreecommitdiff
path: root/gcc/ada/gnatls.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-08 11:25:51 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-08 11:25:51 +0000
commit9080eb6bba3613f90aa8b0444a4eb07a4eda3a9d (patch)
tree5f264e895f21f42a7c2b643a609e2b267faf6e7e /gcc/ada/gnatls.adb
parentabc1c7367f2daa619b80129dd927520829f81364 (diff)
downloadgcc-9080eb6bba3613f90aa8b0444a4eb07a4eda3a9d.tar.gz
* make.adb (Check_Mains, Switches_Of): Adapt to name changes in
package Prj (Current_Spec_Suffix => Ada_Spec_Suffix, Current_Body_Suffix => Ada_Body_Suffix). Take into account Externally_Built attribute. * clean.adb (In_Extension_Chain): Always return False when one of the parameter is No_Project. (Clean_Project): Adapt to changes in package Prj (Lang_Ada => Ada_Language_Index). (Gnatclean): Adapt to change in package Prj.Pars (no parameter Process_Languages for procedure Parse). * gnatcmd.adb (Carg_Switches): New table. (GNATCmd): Put all switches following -cargs in the Carg_Switches table. Adapt to name changes in package Prj (Current_Spec_Suffix => Ada_Spec_Suffix, Current_Body_Suffix => Ada_Body_Suffix). * mlib-prj.adb: Adapt to changes in packages Prj and Prj.Com: type Header_Num and function Hash are now declared in package Prj, not Prj.Com. * prj.adb (Suffix_Of): New function. (Set (Suffix)): New procedure. (Hash): One function moved from Prj.Com (Is_Present, Language_Processing_Data_Of): New functions (Set): Two new procedures (Add_Language_Name, Display_Language_Name): New procedures * prj.ads: (Suffix_Of): New function (Set (Suffix)): New procedure Add several types and tables for multi-language support. (Header_Num): Type moved from Prj.Com (Hash): Two functions moved from Prj.Com (Is_Present, Language_Processing_Data_Of): New functions (Set): Two new procedures (Add_Language_Name, Display_Language_Name): New procedures (Naming): Component name changes: Current_Spec_Suffix => Ada_Spec_Suffix, Current_Body_Suffix => Ada_Body_Suffix. Add new components: Impl_Suffixes, Supp_Suffixes. (Project_Data): New components: Externally_Built, Supp_Languages, First_Language_Processing, Supp_Language_Processing, Default_Linker, Default_Linker_Path. * prj-attr.adb: Add new attributes Ada_Roots and Externally_Built and new package Language_Processing with its attributes (Compiler_Driver, Compiler_Kind, Dependency_Option, Compute_Dependency, Include_Option, Binder_Driver, Default_Linker). * prj-com.ads, prj-com.adb (Hash): Function moved to package Prj. (Header_Num): Type moved to package Prj * prj-env.adb: Adapt to name changes in package Prj (Current_Spec_Suffix => Ada_Spec_Suffix, Current_Body_Suffix => Ada_Body_Suffix). * prj-ext.adb: Add the default project dir (<prefix>/log/gnat) by default to the project path, except the "-" is one of the directories in env var ADA_PROJECT_PATH. (Current_Project_Path): Global variable, replacing Project_Path that was in the body of Prj.Part. (Project_Path): New function (Set_Project_Path): New procedure Initialize Current_Project_Path during elaboration of the package Remove dependency on Prj.Com, no longer needed * prj-ext.ads (Project_Path): New function (Set_Project_Path): New procedure * prj-nmsc.adb (Body_Suffix_Of): New function. Returns .<lang> when no suffix is defined for language <lang>. (Find_Sources, Record_Other_Sources): Use Body_Suffix_Of, instead of accessing directly the components of Naming. (Look_For_Sources): Use Set (Suffix) to set the suffix of a language. Reorganise of this package. Break procedure Check in several procedures. * prj-nmsc.ads: Replace all procedures (Ada_Check, Other_Languages_Check and Language_Independent_Check) with a single procedure Check. * prj-pars.ads, prj-pars.adb (Parse): Remove parameter Process_Languages, no longer needed. * prj-part.adb (Project_Path): Move to the body of Prj.Ext as Current_Project_Path. Remove elaboration code, moved to the body of Prj.Ext Use new function Prj.Ext.Project_Path instead of old variable Project_Path. (Post_Parse_Context_Clause): Get Resolved_Path as a case-sensitive path. When comparing with project paths on the stack, first put the resolved path in canonical case. (Parse_Single_Project): Set the path name of the project file in the tree to the normalized path. * prj-proc.ads, prj-proc.adb (Check, Recursive_Check, Process): Remove parameter Process_Languages, no longer needed. (Recursive_Check): Call Prj.Nmsc.Check, instead of Ada_Check and Other_Languages_Check. * prj-tree.ads (Project_Name_And_Node): New component Canonical_Path to store the resolved canonical path of the project file. Remove dependency to Prj.Com, no longer needed * prj-util.adb: Adapt to name changes in package Prj (Current_Spec_Suffix => Ada_Spec_Suffix, Current_Body_Suffix => Ada_Body_Suffix). * snames.ads, snames.adb: New standard names: Ada_Roots, Binder_Driver, Compiler_Driver, Compiler_Kind, Compute_Dependency, Default_Linker, Externally_Built, Include_Option, Language_Processing. * makegpr.adb: Numerous changes due to changes in packages Prj and Prj.Nmsc. * gnatls.adb: Add the default project dir (<prefix>/log/gnat) by default to the project path, except whe "-" is one of the directories in env var ADA_PROJECT_PATH. (Gnatls): In verbose mode, add the new section "Project Search Path:" git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91877 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatls.adb')
-rw-r--r--gcc/ada/gnatls.adb112
1 files changed, 112 insertions, 0 deletions
diff --git a/gcc/ada/gnatls.adb b/gcc/ada/gnatls.adb
index a2dd0a1ac49..f8fec48d0e4 100644
--- a/gcc/ada/gnatls.adb
+++ b/gcc/ada/gnatls.adb
@@ -38,6 +38,7 @@ with Osint; use Osint;
with Osint.L; use Osint.L;
with Output; use Output;
with Rident; use Rident;
+with Sdefault;
with Snames;
with Targparm; use Targparm;
with Types; use Types;
@@ -47,6 +48,18 @@ with GNAT.Case_Util; use GNAT.Case_Util;
procedure Gnatls is
pragma Ident (Gnat_Static_Version_String);
+ Ada_Project_Path : constant String := "ADA_PROJECT_PATH";
+ -- Name of the env. variable that contains path name(s) of directories
+ -- where project files may reside.
+
+ Project_Search_Path : constant String := "Project Search Path:";
+ -- Label displayed in verbose mode before the directories in the project
+ -- search path.
+ -- NOTE: This string may be used by other tools, such as GPS; so, it
+ -- should not be modified inconsiderately.
+
+ No_Project_Default_Dir : constant String := "-";
+
Max_Column : constant := 80;
No_Obj : aliased String := "<no_obj>";
@@ -1523,6 +1536,105 @@ begin
end loop;
Write_Eol;
+ Write_Eol;
+ Write_Str (Project_Search_Path);
+ Write_Eol;
+ Write_Str (" <Current_Directory>");
+ Write_Eol;
+
+ declare
+ Project_Path : constant String_Access := Getenv (Ada_Project_Path);
+
+ Lib : constant String :=
+ Directory_Separator & "lib" & Directory_Separator;
+
+ First : Natural;
+ Last : Natural;
+
+ Add_Default_Dir : Boolean := True;
+
+ begin
+ -- If there is a project path, display each directory in the path
+
+ if Project_Path.all /= "" then
+ First := Project_Path'First;
+
+ loop
+ while First <= Project_Path'Last
+ and then (Project_Path (First) = Path_Separator)
+ loop
+ First := First + 1;
+ end loop;
+
+ exit when First > Project_Path'Last;
+
+ Last := First;
+
+ while Last < Project_Path'Last
+ and then Project_Path (Last + 1) /= Path_Separator
+ loop
+ Last := Last + 1;
+ end loop;
+
+ -- If the directory is No_Default_Project_Dir, set
+ -- Add_Default_Dir to False
+
+ if Project_Path (First .. Last) = No_Project_Default_Dir then
+ Add_Default_Dir := False;
+
+ elsif First /= Last or else Project_Path (First) /= '.' then
+ -- If the directory is ".", skip it as it is the current
+ -- directory and it is already the first directory in the
+ -- project path.
+
+ Write_Str (" ");
+ Write_Str (Project_Path (First .. Last));
+ Write_Eol;
+ end if;
+
+ First := Last + 1;
+ end loop;
+ end if;
+
+ -- Add the default dir, except if "-" was one of the "directories"
+ -- specified in ADA_PROJECT_DIR.
+
+ if Add_Default_Dir then
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (Sdefault.Search_Dir_Prefix.all);
+
+ -- On Windows, make sure that all directory separators are '\'
+
+ if Directory_Separator /= '/' then
+ for J in 1 .. Name_Len loop
+ if Name_Buffer (J) = '/' then
+ Name_Buffer (J) := Directory_Separator;
+ end if;
+ end loop;
+ end if;
+
+ -- Find the sequence "/lib/"
+
+ while Name_Len >= Lib'Length
+ and then Name_Buffer (Name_Len - 4 .. Name_Len) /= Lib
+ loop
+ Name_Len := Name_Len - 1;
+ end loop;
+
+ -- If the sequence "/lib"/ was found, display the default
+ -- directory <prefix>/lib/gnat/.
+
+ if Name_Len >= 5 then
+ Write_Str (" ");
+ Write_Str (Name_Buffer (1 .. Name_Len));
+ Write_Str ("gnat");
+ Write_Char (Directory_Separator);
+ Write_Eol;
+ end if;
+ end if;
+ end;
+
+ Write_Eol;
end if;
-- Output usage information when requested