Commit 44e1918a by Arnaud Charlet

make.adb (Check_Mains, [...]): Adapt to name changes in package Prj…

make.adb (Check_Mains, [...]): Adapt to name changes in package Prj (Current_Spec_Suffix => Ada_Spec_Suffix...

	* 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:"

From-SVN: r91877
parent a7e5b6df
...@@ -30,7 +30,7 @@ with ALI; use ALI; ...@@ -30,7 +30,7 @@ with ALI; use ALI;
with Csets; with Csets;
with Gnatvsn; with Gnatvsn;
with Hostparm; with Hostparm;
with Makeutl; use Makeutl; with Makeutl;
with MLib.Tgt; use MLib.Tgt; with MLib.Tgt; use MLib.Tgt;
with Namet; use Namet; with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
...@@ -593,7 +593,7 @@ package body Clean is ...@@ -593,7 +593,7 @@ package body Clean is
Put_Line (""""); Put_Line ("""");
end if; end if;
-- Add project to the list of proceesed projects -- Add project to the list of processed projects
Processed_Projects.Increment_Last; Processed_Projects.Increment_Last;
Processed_Projects.Table (Processed_Projects.Last) := Project; Processed_Projects.Table (Processed_Projects.Last) := Project;
...@@ -611,7 +611,7 @@ package body Clean is ...@@ -611,7 +611,7 @@ package body Clean is
-- Look through the units to find those that are either immediate -- Look through the units to find those that are either immediate
-- sources or inherited sources of the project. -- sources or inherited sources of the project.
if Data.Languages (Lang_Ada) then if Data.Languages (Ada_Language_Index) then
for Unit in 1 .. Prj.Com.Units.Last loop for Unit in 1 .. Prj.Com.Units.Last loop
U_Data := Prj.Com.Units.Table (Unit); U_Data := Prj.Com.Units.Table (Unit);
File_Name1 := No_Name; File_Name1 := No_Name;
...@@ -787,7 +787,9 @@ package body Clean is ...@@ -787,7 +787,9 @@ package body Clean is
-- If it is a library with only non Ada sources, delete -- If it is a library with only non Ada sources, delete
-- the fake archive and the dependency file, if they exist. -- the fake archive and the dependency file, if they exist.
if Data.Library and then not Data.Languages (Lang_Ada) then if Data.Library
and then not Data.Languages (Ada_Language_Index)
then
Clean_Archive (Project); Clean_Archive (Project);
end if; end if;
end if; end if;
...@@ -1105,8 +1107,7 @@ package body Clean is ...@@ -1105,8 +1107,7 @@ package body Clean is
Prj.Pars.Parse Prj.Pars.Parse
(Project => Main_Project, (Project => Main_Project,
Project_File_Name => Project_File_Name.all, Project_File_Name => Project_File_Name.all,
Packages_To_Check => Packages_To_Check_By_Gnatmake, Packages_To_Check => Packages_To_Check_By_Gnatmake);
Process_Languages => All_Languages);
if Main_Project = No_Project then if Main_Project = No_Project then
Fail ("""" & Project_File_Name.all & """ processing failed"); Fail ("""" & Project_File_Name.all & """ processing failed");
...@@ -1202,6 +1203,10 @@ package body Clean is ...@@ -1202,6 +1203,10 @@ package body Clean is
Data : Project_Data; Data : Project_Data;
begin begin
if Prj = No_Project or else Of_Project = No_Project then
return False;
end if;
if Of_Project = Prj then if Of_Project = Prj then
return True; return True;
end if; end if;
...@@ -1276,13 +1281,13 @@ package body Clean is ...@@ -1276,13 +1281,13 @@ package body Clean is
begin begin
-- Do not insert an empty name or an already marked source -- Do not insert an empty name or an already marked source
if Lib_File /= No_Name and then not Is_Marked (Lib_File) then if Lib_File /= No_Name and then not Makeutl.Is_Marked (Lib_File) then
Q.Table (Q.Last) := Lib_File; Q.Table (Q.Last) := Lib_File;
Q.Increment_Last; Q.Increment_Last;
-- Mark the source that has been just added to the Q -- Mark the source that has been just added to the Q
Mark (Lib_File); Makeutl.Mark (Lib_File);
end if; end if;
end Insert_Q; end Insert_Q;
......
...@@ -74,8 +74,6 @@ procedure GNATCmd is ...@@ -74,8 +74,6 @@ procedure GNATCmd is
-- files to pass to a tool, when there are more than -- files to pass to a tool, when there are more than
-- Max_Files_On_The_Command_Line files. -- Max_Files_On_The_Command_Line files.
-- A table to keep the switches from the project file
package First_Switches is new Table.Table package First_Switches is new Table.Table
(Table_Component_Type => String_Access, (Table_Component_Type => String_Access,
Table_Index_Type => Integer, Table_Index_Type => Integer,
...@@ -83,6 +81,16 @@ procedure GNATCmd is ...@@ -83,6 +81,16 @@ procedure GNATCmd is
Table_Initial => 20, Table_Initial => 20,
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Gnatcmd.First_Switches"); Table_Name => "Gnatcmd.First_Switches");
-- A table to keep the switches from the project file
package Carg_Switches is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 100,
Table_Name => "Gnatcmd.Carg_Switches");
-- A table to keep the switches following -cargs for ASIS tools
package Library_Paths is new Table.Table ( package Library_Paths is new Table.Table (
Table_Component_Type => String_Access, Table_Component_Type => String_Access,
...@@ -152,6 +160,10 @@ procedure GNATCmd is ...@@ -152,6 +160,10 @@ procedure GNATCmd is
-- Local Subprograms -- -- Local Subprograms --
----------------------- -----------------------
procedure Add_To_Carg_Switches (Switch : String_Access);
-- Add a switch to the Carg_Switches table. If it is the first one,
-- put the switch "-cargs" at the beginning of the table.
procedure Check_Files; procedure Check_Files;
-- For GNAT LIST, GNAT PRETTY and GNAT METRIC, check if a project -- For GNAT LIST, GNAT PRETTY and GNAT METRIC, check if a project
-- file is specified, without any file arguments. If it is the case, -- file is specified, without any file arguments. If it is the case,
...@@ -209,6 +221,23 @@ procedure GNATCmd is ...@@ -209,6 +221,23 @@ procedure GNATCmd is
-- If it is and it includes directory information, prepend the path with -- If it is and it includes directory information, prepend the path with
-- Parent.This subprogram is only called when using project files. -- Parent.This subprogram is only called when using project files.
--------------------------
-- Add_To_Carg_Switches --
--------------------------
procedure Add_To_Carg_Switches (Switch : String_Access) is
begin
-- If the Carg_Switches table is empty, put "-cargs" at the beginning
if Carg_Switches.Last = 0 then
Carg_Switches.Increment_Last;
Carg_Switches.Table (Carg_Switches.Last) := new String'("-cargs");
end if;
Carg_Switches.Increment_Last;
Carg_Switches.Table (Carg_Switches.Last) := Switch;
end Add_To_Carg_Switches;
----------------- -----------------
-- Check_Files -- -- Check_Files --
----------------- -----------------
...@@ -966,6 +995,8 @@ begin ...@@ -966,6 +995,8 @@ begin
First_Switches.Init; First_Switches.Init;
First_Switches.Set_Last (0); First_Switches.Set_Last (0);
Carg_Switches.Init;
Carg_Switches.Set_Last (0);
VMS_Conv.Initialize; VMS_Conv.Initialize;
...@@ -1626,20 +1657,40 @@ begin ...@@ -1626,20 +1657,40 @@ begin
or else The_Command = Stub or else The_Command = Stub
or else The_Command = Elim or else The_Command = Elim
then then
-- If -cargs is one of the switches, move the following
-- switches to the Carg_Switches table.
for J in 1 .. First_Switches.Last loop
if First_Switches.Table (J).all = "-cargs" then
for K in J + 1 .. First_Switches.Last loop
Add_To_Carg_Switches (First_Switches.Table (K));
end loop;
First_Switches.Set_Last (J - 1);
exit;
end if;
end loop;
for J in 1 .. Last_Switches.Last loop
if Last_Switches.Table (J).all = "-cargs" then
for K in J + 1 .. Last_Switches.Last loop
Add_To_Carg_Switches (Last_Switches.Table (K));
end loop;
Last_Switches.Set_Last (J - 1);
exit;
end if;
end loop;
declare declare
CP_File : constant Name_Id := Configuration_Pragmas_File; CP_File : constant Name_Id := Configuration_Pragmas_File;
begin begin
if CP_File /= No_Name then if CP_File /= No_Name then
First_Switches.Increment_Last;
if The_Command = Elim then if The_Command = Elim then
First_Switches.Increment_Last;
First_Switches.Table (First_Switches.Last) := First_Switches.Table (First_Switches.Last) :=
new String'("-C" & Get_Name_String (CP_File)); new String'("-C" & Get_Name_String (CP_File));
else else
First_Switches.Table (First_Switches.Last) := Add_To_Carg_Switches
new String'("-gnatec=" & Get_Name_String (CP_File)); (new String'("-gnatec=" & Get_Name_String (CP_File)));
end if; end if;
end if; end if;
end; end;
...@@ -1698,7 +1749,7 @@ begin ...@@ -1698,7 +1749,7 @@ begin
-- indicate to gnatstub the name of the body file with -- indicate to gnatstub the name of the body file with
-- a -o switch. -- a -o switch.
if Data.Naming.Current_Spec_Suffix /= if Data.Naming.Ada_Spec_Suffix /=
Prj.Default_Ada_Spec_Suffix Prj.Default_Ada_Spec_Suffix
then then
if File_Index /= 0 then if File_Index /= 0 then
...@@ -1708,14 +1759,14 @@ begin ...@@ -1708,14 +1759,14 @@ begin
Last : Natural := Spec'Last; Last : Natural := Spec'Last;
begin begin
Get_Name_String (Data.Naming.Current_Spec_Suffix); Get_Name_String (Data.Naming.Ada_Spec_Suffix);
if Spec'Length > Name_Len if Spec'Length > Name_Len
and then Spec (Last - Name_Len + 1 .. Last) = and then Spec (Last - Name_Len + 1 .. Last) =
Name_Buffer (1 .. Name_Len) Name_Buffer (1 .. Name_Len)
then then
Last := Last - Name_Len; Last := Last - Name_Len;
Get_Name_String (Data.Naming.Current_Body_Suffix); Get_Name_String (Data.Naming.Ada_Body_Suffix);
Last_Switches.Increment_Last; Last_Switches.Increment_Last;
Last_Switches.Table (Last_Switches.Last) := Last_Switches.Table (Last_Switches.Last) :=
new String'("-o"); new String'("-o");
...@@ -1753,7 +1804,7 @@ begin ...@@ -1753,7 +1804,7 @@ begin
end if; end if;
-- For gnatmetric, the generated files should be put in the -- For gnatmetric, the generated files should be put in the
-- object directory. This must be the first dwitch, because it may -- object directory. This must be the first switch, because it may
-- be overriden by a switch in package Metrics in the project file -- be overriden by a switch in package Metrics in the project file
-- or by a command line option. -- or by a command line option.
...@@ -1783,7 +1834,9 @@ begin ...@@ -1783,7 +1834,9 @@ begin
declare declare
The_Args : Argument_List The_Args : Argument_List
(1 .. First_Switches.Last + Last_Switches.Last); (1 .. First_Switches.Last +
Last_Switches.Last +
Carg_Switches.Last);
Arg_Num : Natural := 0; Arg_Num : Natural := 0;
begin begin
...@@ -1797,6 +1850,11 @@ begin ...@@ -1797,6 +1850,11 @@ begin
The_Args (Arg_Num) := Last_Switches.Table (J); The_Args (Arg_Num) := Last_Switches.Table (J);
end loop; end loop;
for J in 1 .. Carg_Switches.Last loop
Arg_Num := Arg_Num + 1;
The_Args (Arg_Num) := Carg_Switches.Table (J);
end loop;
-- If Display_Command is on, only display the generated command -- If Display_Command is on, only display the generated command
if Display_Command then if Display_Command then
......
...@@ -38,6 +38,7 @@ with Osint; use Osint; ...@@ -38,6 +38,7 @@ with Osint; use Osint;
with Osint.L; use Osint.L; with Osint.L; use Osint.L;
with Output; use Output; with Output; use Output;
with Rident; use Rident; with Rident; use Rident;
with Sdefault;
with Snames; with Snames;
with Targparm; use Targparm; with Targparm; use Targparm;
with Types; use Types; with Types; use Types;
...@@ -47,6 +48,18 @@ with GNAT.Case_Util; use GNAT.Case_Util; ...@@ -47,6 +48,18 @@ with GNAT.Case_Util; use GNAT.Case_Util;
procedure Gnatls is procedure Gnatls is
pragma Ident (Gnat_Static_Version_String); 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; Max_Column : constant := 80;
No_Obj : aliased String := "<no_obj>"; No_Obj : aliased String := "<no_obj>";
...@@ -1523,6 +1536,105 @@ begin ...@@ -1523,6 +1536,105 @@ begin
end loop; end loop;
Write_Eol; 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; end if;
-- Output usage information when requested -- Output usage information when requested
......
...@@ -43,7 +43,6 @@ with Namet; use Namet; ...@@ -43,7 +43,6 @@ with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Osint.M; use Osint.M; with Osint.M; use Osint.M;
with Osint; use Osint; with Osint; use Osint;
with Gnatvsn;
with Output; use Output; with Output; use Output;
with Prj; use Prj; with Prj; use Prj;
with Prj.Com; with Prj.Com;
...@@ -120,7 +119,7 @@ package body Make is ...@@ -120,7 +119,7 @@ package body Make is
-- reinitialized, the elements between Q.First and Q.Last - 1 are unmarked. -- reinitialized, the elements between Q.First and Q.Last - 1 are unmarked.
procedure Init_Q; procedure Init_Q;
-- Must be called to (re)initialize the Q. -- Must be called to (re)initialize the Q
procedure Insert_Q procedure Insert_Q
(Source_File : File_Name_Type; (Source_File : File_Name_Type;
...@@ -130,13 +129,13 @@ package body Make is ...@@ -130,13 +129,13 @@ package body Make is
-- for external use (gnatdist). Provide index for multi-unit sources. -- for external use (gnatdist). Provide index for multi-unit sources.
function Empty_Q return Boolean; function Empty_Q return Boolean;
-- Returns True if Q is empty. -- Returns True if Q is empty
procedure Extract_From_Q procedure Extract_From_Q
(Source_File : out File_Name_Type; (Source_File : out File_Name_Type;
Source_Unit : out Unit_Name_Type; Source_Unit : out Unit_Name_Type;
Source_Index : out Int); Source_Index : out Int);
-- Extracts the first element from the Q. -- Extracts the first element from the Q
procedure Insert_Project_Sources procedure Insert_Project_Sources
(The_Project : Project_Id; (The_Project : Project_Id;
...@@ -151,10 +150,10 @@ package body Make is ...@@ -151,10 +150,10 @@ package body Make is
-- from projects being extended. -- from projects being extended.
First_Q_Initialization : Boolean := True; First_Q_Initialization : Boolean := True;
-- Will be set to false after Init_Q has been called once. -- Will be set to false after Init_Q has been called once
Q_Front : Natural; Q_Front : Natural;
-- Points to the first valid element in the Q. -- Points to the first valid element in the Q
Unique_Compile : Boolean := False; Unique_Compile : Boolean := False;
-- Set to True if -u or -U or a project file with no main is used -- Set to True if -u or -U or a project file with no main is used
...@@ -182,7 +181,7 @@ package body Make is ...@@ -182,7 +181,7 @@ package body Make is
Table_Initial => 4000, Table_Initial => 4000,
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Make.Q"); Table_Name => "Make.Q");
-- This is the actual Q. -- This is the actual Q
-- The following instantiations and variables are necessary to save what -- The following instantiations and variables are necessary to save what
-- is found on the command line, in case there is a project file specified. -- is found on the command line, in case there is a project file specified.
...@@ -284,7 +283,7 @@ package body Make is ...@@ -284,7 +283,7 @@ package body Make is
-- Avoid calling Change_Dir if the current working directory is already -- Avoid calling Change_Dir if the current working directory is already
-- this directory -- this directory
-- Packages of project files where unknown attributes are errors. -- Packages of project files where unknown attributes are errors
Naming_String : aliased String := "naming"; Naming_String : aliased String := "naming";
Builder_String : aliased String := "builder"; Builder_String : aliased String := "builder";
...@@ -338,7 +337,7 @@ package body Make is ...@@ -338,7 +337,7 @@ package body Make is
Table_Initial => 20, Table_Initial => 20,
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Make.Bad_Compilation"); Table_Name => "Make.Bad_Compilation");
-- Full name of all the source files for which compilation fails. -- Full name of all the source files for which compilation fails
Do_Compile_Step : Boolean := True; Do_Compile_Step : Boolean := True;
Do_Bind_Step : Boolean := True; Do_Bind_Step : Boolean := True;
...@@ -411,7 +410,7 @@ package body Make is ...@@ -411,7 +410,7 @@ package body Make is
This : Name_Id; This : Name_Id;
Depends_On : Name_Id; Depends_On : Name_Id;
end record; end record;
-- Components of table Dependencies below. -- Components of table Dependencies below
package Dependencies is new Table.Table ( package Dependencies is new Table.Table (
Table_Component_Type => Dependency, Table_Component_Type => Dependency,
...@@ -473,10 +472,10 @@ package body Make is ...@@ -473,10 +472,10 @@ package body Make is
-- between the call to Compile_Sources and List_Depend.) -- between the call to Compile_Sources and List_Depend.)
procedure Inform (N : Name_Id := No_Name; Msg : String); procedure Inform (N : Name_Id := No_Name; Msg : String);
-- Prints out the program name followed by a colon, N and S. -- Prints out the program name followed by a colon, N and S
procedure List_Bad_Compilations; procedure List_Bad_Compilations;
-- Prints out the list of all files for which the compilation failed. -- Prints out the list of all files for which the compilation failed
procedure Verbose_Msg procedure Verbose_Msg
(N1 : Name_Id; (N1 : Name_Id;
...@@ -485,9 +484,8 @@ package body Make is ...@@ -485,9 +484,8 @@ package body Make is
S2 : String := ""; S2 : String := "";
Prefix : String := " -> "); Prefix : String := " -> ");
-- If the verbose flag (Verbose_Mode) is set then print Prefix to standard -- If the verbose flag (Verbose_Mode) is set then print Prefix to standard
-- output followed by N1 and S1. If N2 /= No_Name then N2 is then printed -- output followed by N1 and S1. If N2 /= No_Name then N2 is printed after
-- after S1. S2 is printed last. Both N1 and N2 are printed in quotation -- S1. S2 is printed last. Both N1 and N2 are printed in quotation marks.
-- marks.
Usage_Needed : Boolean := True; Usage_Needed : Boolean := True;
-- Flag used to make sure Makeusg is call at most once -- Flag used to make sure Makeusg is call at most once
...@@ -497,7 +495,7 @@ package body Make is ...@@ -497,7 +495,7 @@ package body Make is
-- Set Usage_Needed to False. -- Set Usage_Needed to False.
procedure Debug_Msg (S : String; N : Name_Id); procedure Debug_Msg (S : String; N : Name_Id);
-- If Debug.Debug_Flag_W is set outputs string S followed by name N. -- If Debug.Debug_Flag_W is set outputs string S followed by name N
procedure Recursive_Compute_Depth procedure Recursive_Compute_Depth
(Project : Project_Id; (Project : Project_Id;
...@@ -587,7 +585,7 @@ package body Make is ...@@ -587,7 +585,7 @@ package body Make is
Saved_Gcc : String_Access := null; Saved_Gcc : String_Access := null;
Saved_Gnatbind : String_Access := null; Saved_Gnatbind : String_Access := null;
Saved_Gnatlink : String_Access := null; Saved_Gnatlink : String_Access := null;
-- Given by the command line. Will be used, if non null. -- Given by the command line. Will be used, if non null
Gcc_Path : String_Access := Gcc_Path : String_Access :=
GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all); GNAT.OS_Lib.Locate_Exec_On_Path (Gcc.all);
...@@ -613,7 +611,7 @@ package body Make is ...@@ -613,7 +611,7 @@ package body Make is
-- Set to True when compiling with -gnats -- Set to True when compiling with -gnats
Display_Executed_Programs : Boolean := True; Display_Executed_Programs : Boolean := True;
-- Set to True if name of commands should be output on stderr. -- Set to True if name of commands should be output on stderr
Output_File_Name_Seen : Boolean := False; Output_File_Name_Seen : Boolean := False;
-- Set to True after having scanned the file_name for -- Set to True after having scanned the file_name for
...@@ -624,14 +622,14 @@ package body Make is ...@@ -624,14 +622,14 @@ package body Make is
-- switch "-D obj_dir". -- switch "-D obj_dir".
Object_Directory_Path : String_Access := null; Object_Directory_Path : String_Access := null;
-- The path name of the object directory, set with switch -D. -- The path name of the object directory, set with switch -D
type Make_Program_Type is (None, Compiler, Binder, Linker); type Make_Program_Type is (None, Compiler, Binder, Linker);
Program_Args : Make_Program_Type := None; Program_Args : Make_Program_Type := None;
-- Used to indicate if we are scanning gnatmake, gcc, gnatbind, or gnatbind -- Used to indicate if we are scanning gnatmake, gcc, gnatbind, or gnatbind
-- options within the gnatmake command line. -- options within the gnatmake command line. Used in Scan_Make_Arg only,
-- Used in Scan_Make_Arg only, but must be a global variable. -- but must be global since value preserved from one call to another.
Temporary_Config_File : Boolean := False; Temporary_Config_File : Boolean := False;
-- Set to True when there is a temporary config file used for a project -- Set to True when there is a temporary config file used for a project
...@@ -1209,13 +1207,13 @@ package body Make is ...@@ -1209,13 +1207,13 @@ package body Make is
-- Full name of current library file -- Full name of current library file
Full_Obj_File : File_Name_Type; Full_Obj_File : File_Name_Type;
-- Full name of the object file corresponding to Lib_File. -- Full name of the object file corresponding to Lib_File
Lib_Stamp : Time_Stamp_Type; Lib_Stamp : Time_Stamp_Type;
-- Time stamp of the current ada library file. -- Time stamp of the current ada library file
Obj_Stamp : Time_Stamp_Type; Obj_Stamp : Time_Stamp_Type;
-- Time stamp of the current object file. -- Time stamp of the current object file
Modified_Source : File_Name_Type; Modified_Source : File_Name_Type;
-- The first source in Lib_File whose current time stamp differs -- The first source in Lib_File whose current time stamp differs
...@@ -1640,13 +1638,13 @@ package body Make is ...@@ -1640,13 +1638,13 @@ package body Make is
O_File := No_File; O_File := No_File;
O_Stamp := (others => ' '); O_Stamp := (others => ' ');
-- Process linker options from the ALI files. -- Process linker options from the ALI files
for Opt in 1 .. Linker_Options.Last loop for Opt in 1 .. Linker_Options.Last loop
Check_File (Linker_Options.Table (Opt).Name); Check_File (Linker_Options.Table (Opt).Name);
end loop; end loop;
-- Process options given on the command line. -- Process options given on the command line
for Opt in Linker_Switches.First .. Linker_Switches.Last loop for Opt in Linker_Switches.First .. Linker_Switches.Last loop
...@@ -1907,7 +1905,7 @@ package body Make is ...@@ -1907,7 +1905,7 @@ package body Make is
end record; end record;
Running_Compile : array (1 .. Max_Process) of Compilation_Data; Running_Compile : array (1 .. Max_Process) of Compilation_Data;
-- Used to save information about outstanding compilations. -- Used to save information about outstanding compilations
Outstanding_Compiles : Natural := 0; Outstanding_Compiles : Natural := 0;
-- Current number of outstanding compiles -- Current number of outstanding compiles
...@@ -1928,10 +1926,10 @@ package body Make is ...@@ -1928,10 +1926,10 @@ package body Make is
-- Full name of the current library file -- Full name of the current library file
Obj_File : File_Name_Type; Obj_File : File_Name_Type;
-- Full name of the object file corresponding to Lib_File. -- Full name of the object file corresponding to Lib_File
Obj_Stamp : Time_Stamp_Type; Obj_Stamp : Time_Stamp_Type;
-- Time stamp of the current object file. -- Time stamp of the current object file
Sfile : File_Name_Type; Sfile : File_Name_Type;
-- Contains the source file of the units withed by Source_File -- Contains the source file of the units withed by Source_File
...@@ -1939,6 +1937,8 @@ package body Make is ...@@ -1939,6 +1937,8 @@ package body Make is
ALI : ALI_Id; ALI : ALI_Id;
-- ALI Id of the current ALI file -- ALI Id of the current ALI file
-- Comment following declarations ???
Read_Only : Boolean := False; Read_Only : Boolean := False;
Compilation_OK : Boolean; Compilation_OK : Boolean;
...@@ -1950,10 +1950,13 @@ package body Make is ...@@ -1950,10 +1950,13 @@ package body Make is
Mfile : Natural := No_Mapping_File; Mfile : Natural := No_Mapping_File;
Need_To_Check_Standard_Library : Boolean := Need_To_Check_Standard_Library : Boolean :=
Check_Readonly_Files and not Unique_Compile; Check_Readonly_Files
and not Unique_Compile;
Mapping_File_Arg : String_Access; Mapping_File_Arg : String_Access;
Process_Created : Boolean := False;
procedure Add_Process procedure Add_Process
(Pid : Process_Id; (Pid : Process_Id;
Sfile : File_Name_Type; Sfile : File_Name_Type;
...@@ -1982,7 +1985,7 @@ package body Make is ...@@ -1982,7 +1985,7 @@ package body Make is
-- to wait for. -- to wait for.
function Bad_Compilation_Count return Natural; function Bad_Compilation_Count return Natural;
-- Returns the number of compilation failures. -- Returns the number of compilation failures
procedure Check_Standard_Library; procedure Check_Standard_Library;
-- Check if s-stalib.adb needs to be compiled -- Check if s-stalib.adb needs to be compiled
...@@ -2008,17 +2011,17 @@ package body Make is ...@@ -2008,17 +2011,17 @@ package body Make is
Table_Initial => 50, Table_Initial => 50,
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Make.Good_ALI"); Table_Name => "Make.Good_ALI");
-- Contains the set of valid ALI files that have not yet been scanned. -- Contains the set of valid ALI files that have not yet been scanned
function Good_ALI_Present return Boolean; function Good_ALI_Present return Boolean;
-- Returns True if any ALI file was recorded in the previous set. -- Returns True if any ALI file was recorded in the previous set
procedure Get_Mapping_File (Project : Project_Id); procedure Get_Mapping_File (Project : Project_Id);
-- Get a mapping file name. If there is one to be reused, reuse it. -- Get a mapping file name. If there is one to be reused, reuse it.
-- Otherwise, create a new mapping file. -- Otherwise, create a new mapping file.
function Get_Next_Good_ALI return ALI_Id; function Get_Next_Good_ALI return ALI_Id;
-- Returns the next good ALI_Id record; -- Returns the next good ALI_Id record
procedure Record_Failure procedure Record_Failure
(File : File_Name_Type; (File : File_Name_Type;
...@@ -2029,7 +2032,7 @@ package body Make is ...@@ -2029,7 +2032,7 @@ package body Make is
-- could not find it. Records also Unit when possible. -- could not find it. Records also Unit when possible.
procedure Record_Good_ALI (A : ALI_Id); procedure Record_Good_ALI (A : ALI_Id);
-- Records in the previous set the Id of an ALI file. -- Records in the previous set the Id of an ALI file
----------------- -----------------
-- Add_Process -- -- Add_Process --
...@@ -2197,9 +2200,12 @@ package body Make is ...@@ -2197,9 +2200,12 @@ package body Make is
(Source_File : File_Name_Type; Source_Index : Int) (Source_File : File_Name_Type; Source_Index : Int)
is is
begin begin
-- Process_Created will be set True if an attempt is made to compile
-- the source, that is if it is not in an externally built project.
-- If arguments have not yet been collected (in Check), collect them Process_Created := False;
-- now.
-- If arguments not yet collected (in Check), collect them now
if not Arguments_Collected then if not Arguments_Collected then
Collect_Arguments (Source_File, Source_Index, Args); Collect_Arguments (Source_File, Source_Index, Args);
...@@ -2215,12 +2221,14 @@ package body Make is ...@@ -2215,12 +2221,14 @@ package body Make is
-- check for an eventual library project, and use the full path. -- check for an eventual library project, and use the full path.
if Arguments_Project /= No_Project then if Arguments_Project /= No_Project then
if not Projects.Table (Arguments_Project).Externally_Built then
Prj.Env.Set_Ada_Paths (Arguments_Project, True); Prj.Env.Set_Ada_Paths (Arguments_Project, True);
if MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None then if MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None then
declare declare
The_Data : Project_Data := The_Data : Project_Data :=
Projects.Table (Arguments_Project); Projects.Table (Arguments_Project);
Prj : Project_Id := Arguments_Project; Prj : Project_Id := Arguments_Project;
begin begin
...@@ -2254,11 +2262,12 @@ package body Make is ...@@ -2254,11 +2262,12 @@ package body Make is
Pid := Compile (Arguments_Path_Name, Lib_File, Source_Index, Pid := Compile (Arguments_Path_Name, Lib_File, Source_Index,
Arguments (1 .. Last_Argument)); Arguments (1 .. Last_Argument));
Process_Created := True;
end if;
else else
-- If this is a source outside of any project file, make sure -- If this is a source outside of any project file, make sure it
-- it will be compiled in the object directory of the main project -- will be compiled in object directory of the main project file.
-- file.
if Main_Project /= No_Project then if Main_Project /= No_Project then
Change_To_Object_Directory (Arguments_Project); Change_To_Object_Directory (Arguments_Project);
...@@ -2266,6 +2275,7 @@ package body Make is ...@@ -2266,6 +2275,7 @@ package body Make is
Pid := Compile (Full_Source_File, Lib_File, Source_Index, Pid := Compile (Full_Source_File, Lib_File, Source_Index,
Arguments (1 .. Last_Argument)); Arguments (1 .. Last_Argument));
Process_Created := True;
end if; end if;
end Collect_Arguments_And_Compile; end Collect_Arguments_And_Compile;
...@@ -2403,8 +2413,7 @@ package body Make is ...@@ -2403,8 +2413,7 @@ package body Make is
L /= Strip_Directory (L) or else L /= Strip_Directory (L) or else
Object_Directory_Path /= null Object_Directory_Path /= null
then then
-- Build -o argument
-- Build -o argument.
Get_Name_String (L); Get_Name_String (L);
...@@ -2542,7 +2551,7 @@ package body Make is ...@@ -2542,7 +2551,7 @@ package body Make is
begin begin
pragma Assert (Args'First = 1); pragma Assert (Args'First = 1);
-- Package and Queue initializations. -- Package and Queue initializations
Good_ALI.Init; Good_ALI.Init;
Output.Set_Standard_Error; Output.Set_Standard_Error;
...@@ -2690,7 +2699,7 @@ package body Make is ...@@ -2690,7 +2699,7 @@ package body Make is
if not Need_To_Compile then if not Need_To_Compile then
-- The ALI file is up-to-date. Record its Id. -- The ALI file is up-to-date. Record its Id
Record_Good_ALI (ALI); Record_Good_ALI (ALI);
...@@ -2742,6 +2751,7 @@ package body Make is ...@@ -2742,6 +2751,7 @@ package body Make is
-- Make sure we could successfully start the compilation -- Make sure we could successfully start the compilation
if Process_Created then
if Pid = Invalid_Pid then if Pid = Invalid_Pid then
Record_Failure (Full_Source_File, Source_Unit); Record_Failure (Full_Source_File, Source_Unit);
else else
...@@ -2754,6 +2764,7 @@ package body Make is ...@@ -2754,6 +2764,7 @@ package body Make is
end if; end if;
end if; end if;
end if; end if;
end if;
end; end;
end if; end if;
...@@ -2970,7 +2981,7 @@ package body Make is ...@@ -2970,7 +2981,7 @@ package body Make is
function Absolute_Path function Absolute_Path
(Path : Name_Id; (Path : Name_Id;
Project : Project_Id) return String; Project : Project_Id) return String;
-- Returns an absolute path for a configuration pragmas file. -- Returns an absolute path for a configuration pragmas file
------------------- -------------------
-- Absolute_Path -- -- Absolute_Path --
...@@ -3455,14 +3466,14 @@ package body Make is ...@@ -3455,14 +3466,14 @@ package body Make is
Locate_Regular_File Locate_Regular_File
(Main & (Main &
Get_Name_String Get_Name_String
(Data.Naming.Current_Body_Suffix), (Data.Naming.Ada_Body_Suffix),
""); "");
if Real_Path = null then if Real_Path = null then
Real_Path := Real_Path :=
Locate_Regular_File Locate_Regular_File
(Main & (Main &
Get_Name_String Get_Name_String
(Data.Naming.Current_Spec_Suffix), (Data.Naming.Ada_Spec_Suffix),
""); "");
end if; end if;
...@@ -3970,6 +3981,13 @@ package body Make is ...@@ -3970,6 +3981,13 @@ package body Make is
Write_Eol; Write_Eol;
end if; end if;
if Main_Project /= No_Project
and then Projects.Table (Main_Project).Externally_Built
then
Make_Failed
("nothing to do for a main project that is externally built");
end if;
if Osint.Number_Of_Files = 0 then if Osint.Number_Of_Files = 0 then
if Main_Project /= No_Project if Main_Project /= No_Project
and then Projects.Table (Main_Project).Library and then Projects.Table (Main_Project).Library
...@@ -4338,12 +4356,13 @@ package body Make is ...@@ -4338,12 +4356,13 @@ package body Make is
for Proj in Projects.First .. Projects.Last loop for Proj in Projects.First .. Projects.Last loop
if Projects.Table (Proj).Library then if Projects.Table (Proj).Library then
Projects.Table (Proj).Need_To_Build_Lib := Projects.Table (Proj).Need_To_Build_Lib :=
not MLib.Tgt.Library_Exists_For (Proj); (not MLib.Tgt.Library_Exists_For (Proj))
and then (not Projects.Table (Proj).Externally_Built);
if Projects.Table (Proj).Need_To_Build_Lib then if Projects.Table (Proj).Need_To_Build_Lib then
-- If there is no object directory, then it will be -- If there is no object directory, then it will be
-- impossible to build the library. So, we fail -- impossible to build the library. So fail immediately.
-- immediately.
if Projects.Table (Proj).Object_Directory = No_Name then if Projects.Table (Proj).Object_Directory = No_Name then
Make_Failed Make_Failed
...@@ -4641,12 +4660,12 @@ package body Make is ...@@ -4641,12 +4660,12 @@ package body Make is
Name_Buffer (Name_Len + 1 .. Name_Buffer (Name_Len + 1 ..
Name_Len + Exec_File_Name'Length) := Name_Len + Exec_File_Name'Length) :=
Exec_File_Name; Exec_File_Name;
Name_Len := Name_Len + Exec_File_Name'Length; Name_Len := Name_Len + Exec_File_Name'Length;
Executable := Name_Find; Executable := Name_Find;
Non_Std_Executable := True; Non_Std_Executable := True;
end if; end if;
end; end;
end if; end if;
if Do_Compile_Step then if Do_Compile_Step then
...@@ -4658,7 +4677,7 @@ package body Make is ...@@ -4658,7 +4677,7 @@ package body Make is
Youngest_Obj_Stamp : Time_Stamp_Type; Youngest_Obj_Stamp : Time_Stamp_Type;
Executable_Stamp : Time_Stamp_Type; Executable_Stamp : Time_Stamp_Type;
-- Executable is the final executable program. -- Executable is the final executable program
Library_Rebuilt : Boolean := False; Library_Rebuilt : Boolean := False;
...@@ -4701,7 +4720,6 @@ package body Make is ...@@ -4701,7 +4720,6 @@ package body Make is
if Total_Compilation_Failures /= 0 then if Total_Compilation_Failures /= 0 then
if Keep_Going then if Keep_Going then
goto Next_Main; goto Next_Main;
else else
List_Bad_Compilations; List_Bad_Compilations;
raise Compilation_Failed; raise Compilation_Failed;
...@@ -4736,6 +4754,7 @@ package body Make is ...@@ -4736,6 +4754,7 @@ package body Make is
if Projects.Table (Proj1).Library if Projects.Table (Proj1).Library
and then not Projects.Table (Proj1).Need_To_Build_Lib and then not Projects.Table (Proj1).Need_To_Build_Lib
and then not Projects.Table (Proj1).Externally_Built
then then
MLib.Prj.Check_Library (Proj1); MLib.Prj.Check_Library (Proj1);
end if; end if;
...@@ -5289,7 +5308,7 @@ package body Make is ...@@ -5289,7 +5308,7 @@ package body Make is
end Link_Step; end Link_Step;
end if; end if;
-- We go to here when we skip the bind and link steps. -- We go to here when we skip the bind and link steps
<<Next_Main>> <<Next_Main>>
...@@ -5631,7 +5650,7 @@ package body Make is ...@@ -5631,7 +5650,7 @@ package body Make is
Check_Object_Consistency := True; Check_Object_Consistency := True;
-- Package initializations. The order of calls is important here. -- Package initializations. The order of calls is important here
Output.Set_Standard_Error; Output.Set_Standard_Error;
...@@ -6270,7 +6289,7 @@ package body Make is ...@@ -6270,7 +6289,7 @@ package body Make is
B : Byte; B : Byte;
begin begin
-- Dir last character is supposed to be a directory separator. -- Dir last character is supposed to be a directory separator
Name_Len := Dir'Length; Name_Len := Dir'Length;
Name_Buffer (1 .. Name_Len) := Dir; Name_Buffer (1 .. Name_Len) := Dir;
...@@ -6971,9 +6990,9 @@ package body Make is ...@@ -6971,9 +6990,9 @@ package body Make is
Name : String (1 .. Source_File_Name'Length + 3); Name : String (1 .. Source_File_Name'Length + 3);
Last : Positive := Source_File_Name'Length; Last : Positive := Source_File_Name'Length;
Spec_Suffix : constant String := Spec_Suffix : constant String :=
Get_Name_String (Naming.Current_Spec_Suffix); Get_Name_String (Naming.Ada_Spec_Suffix);
Body_Suffix : constant String := Body_Suffix : constant String :=
Get_Name_String (Naming.Current_Body_Suffix); Get_Name_String (Naming.Ada_Body_Suffix);
Truncated : Boolean := False; Truncated : Boolean := False;
begin begin
......
...@@ -105,15 +105,27 @@ package body Makegpr is ...@@ -105,15 +105,27 @@ package body Makegpr is
Last_Source : Natural := 0; Last_Source : Natural := 0;
-- The index of the last valid component of Source_Indexes -- The index of the last valid component of Source_Indexes
Compiler_Names : array (Programming_Language) of String_Access; Compiler_Names : array (First_Language_Indexes) of String_Access;
-- The names of the compilers to be used. Set up by Get_Compiler. -- The names of the compilers to be used. Set up by Get_Compiler.
-- Used to display the commands spawned. -- Used to display the commands spawned.
Compiler_Paths : array (Programming_Language) of String_Access; Gnatmake_String : constant String_Access := new String'("gnatmake");
GCC_String : constant String_Access := new String'("gcc");
G_Plus_Plus_String : constant String_Access := new String'("g++");
Default_Compiler_Names : constant array
(First_Language_Indexes range
Ada_Language_Index .. C_Plus_Plus_Language_Index)
of String_Access :=
(Ada_Language_Index => Gnatmake_String,
C_Language_Index => GCC_String,
C_Plus_Plus_Language_Index => G_Plus_Plus_String);
Compiler_Paths : array (First_Language_Indexes) of String_Access;
-- The path names of the compiler to be used. Set up by Get_Compiler. -- The path names of the compiler to be used. Set up by Get_Compiler.
-- Used to spawn compiling/linking processes. -- Used to spawn compiling/linking processes.
Compiler_Is_Gcc : array (Programming_Language) of Boolean; Compiler_Is_Gcc : array (First_Language_Indexes) of Boolean;
-- An indication that a compiler is a GCC compiler, to be able to use -- An indication that a compiler is a GCC compiler, to be able to use
-- specific GCC switches. -- specific GCC switches.
...@@ -163,7 +175,7 @@ package body Makegpr is ...@@ -163,7 +175,7 @@ package body Makegpr is
Current_Processor : Processor := None; Current_Processor : Processor := None;
-- This variable changes when switches -*args are used -- This variable changes when switches -*args are used
Current_Language : Programming_Language := Lang_Ada; Current_Language : Language_Index := Ada_Language_Index;
-- The compiler language to consider when Processor is Compiler -- The compiler language to consider when Processor is Compiler
package Comp_Opts is new GNAT.Dynamic_Tables package Comp_Opts is new GNAT.Dynamic_Tables
...@@ -172,7 +184,7 @@ package body Makegpr is ...@@ -172,7 +184,7 @@ package body Makegpr is
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 20, Table_Initial => 20,
Table_Increment => 100); Table_Increment => 100);
Options : array (Programming_Language) of Comp_Opts.Instance; Options : array (First_Language_Indexes) of Comp_Opts.Instance;
-- Tables to store compiling options for the different compilers -- Tables to store compiling options for the different compilers
package Linker_Options is new Table.Table package Linker_Options is new Table.Table
...@@ -300,7 +312,7 @@ package body Makegpr is ...@@ -300,7 +312,7 @@ package body Makegpr is
-- The environment variable to set when compiler is a GCC compiler -- The environment variable to set when compiler is a GCC compiler
-- to indicate the include directory path. -- to indicate the include directory path.
Current_Include_Paths : array (Programming_Language) of String_Access; Current_Include_Paths : array (First_Language_Indexes) of String_Access;
-- A cache for the paths of included directories, to avoid setting -- A cache for the paths of included directories, to avoid setting
-- env var CPATH unnecessarily. -- env var CPATH unnecessarily.
...@@ -357,7 +369,7 @@ package body Makegpr is ...@@ -357,7 +369,7 @@ package body Makegpr is
procedure Add_Search_Directories procedure Add_Search_Directories
(Data : Project_Data; (Data : Project_Data;
Language : Programming_Language); Language : First_Language_Indexes);
-- Either add to the Arguments the necessary -I switches needed to -- Either add to the Arguments the necessary -I switches needed to
-- compile, or, when compiler is gcc/g++, set up the C*INCLUDE_PATH -- compile, or, when compiler is gcc/g++, set up the C*INCLUDE_PATH
-- environment variable, if necessary. -- environment variable, if necessary.
...@@ -368,7 +380,7 @@ package body Makegpr is ...@@ -368,7 +380,7 @@ package body Makegpr is
procedure Add_Switches procedure Add_Switches
(Data : Project_Data; (Data : Project_Data;
Proc : Processor; Proc : Processor;
Language : Other_Programming_Language; Language : Language_Index;
File_Name : Name_Id); File_Name : Name_Id);
-- Add to Arguments the switches, if any, for a source (attribute Switches) -- Add to Arguments the switches, if any, for a source (attribute Switches)
-- or language (attribute Default_Switches), coming from package Compiler -- or language (attribute Default_Switches), coming from package Compiler
...@@ -435,7 +447,7 @@ package body Makegpr is ...@@ -435,7 +447,7 @@ package body Makegpr is
-- Display the command for a spawned process, if in Verbose_Mode or -- Display the command for a spawned process, if in Verbose_Mode or
-- not in Quiet_Output. -- not in Quiet_Output.
procedure Get_Compiler (For_Language : Programming_Language); procedure Get_Compiler (For_Language : First_Language_Indexes);
-- Find the compiler name and path name for a specified programming -- Find the compiler name and path name for a specified programming
-- language, if not already done. Results are in the corresponding -- language, if not already done. Results are in the corresponding
-- elements of arrays Compiler_Names and Compiler_Paths. Name of compiler -- elements of arrays Compiler_Names and Compiler_Paths. Name of compiler
...@@ -877,7 +889,7 @@ package body Makegpr is ...@@ -877,7 +889,7 @@ package body Makegpr is
procedure Add_Search_Directories procedure Add_Search_Directories
(Data : Project_Data; (Data : Project_Data;
Language : Programming_Language) Language : First_Language_Indexes)
is is
begin begin
-- If a GNU compiler is used, set the CPATH environment variable, -- If a GNU compiler is used, set the CPATH environment variable,
...@@ -901,7 +913,7 @@ package body Makegpr is ...@@ -901,7 +913,7 @@ package body Makegpr is
procedure Add_Switches procedure Add_Switches
(Data : Project_Data; (Data : Project_Data;
Proc : Processor; Proc : Processor;
Language : Other_Programming_Language; Language : Language_Index;
File_Name : Name_Id) File_Name : Name_Id)
is is
Switches : Variable_Value; Switches : Variable_Value;
...@@ -953,7 +965,7 @@ package body Makegpr is ...@@ -953,7 +965,7 @@ package body Makegpr is
(Name => Name_Default_Switches, (Name => Name_Default_Switches,
In_Arrays => Packages.Table (Pkg).Decl.Arrays); In_Arrays => Packages.Table (Pkg).Decl.Arrays);
Switches := Prj.Util.Value_Of Switches := Prj.Util.Value_Of
(Index => Lang_Name_Ids (Language), (Index => Language_Names.Table (Language),
Src_Index => 0, Src_Index => 0,
In_Array => Defaults); In_Array => Defaults);
end if; end if;
...@@ -1546,7 +1558,7 @@ package body Makegpr is ...@@ -1546,7 +1558,7 @@ package body Makegpr is
-- If there are sources in Ada, then gnatmake will build the -- If there are sources in Ada, then gnatmake will build the
-- library, so nothing to do. -- library, so nothing to do.
if not Data.Languages (Lang_Ada) then if not Data.Languages (Ada_Language_Index) then
-- Get all the object files of the project -- Get all the object files of the project
...@@ -1574,14 +1586,14 @@ package body Makegpr is ...@@ -1574,14 +1586,14 @@ package body Makegpr is
-- building the library may fail with unresolved symbols. -- building the library may fail with unresolved symbols.
if C_Plus_Plus_Is_Used then if C_Plus_Plus_Is_Used then
if Compiler_Names (Lang_C_Plus_Plus) = null then if Compiler_Names (C_Plus_Plus_Language_Index) = null then
Get_Compiler (Lang_C_Plus_Plus); Get_Compiler (C_Plus_Plus_Language_Index);
end if; end if;
if Compiler_Is_Gcc (Lang_C_Plus_Plus) then if Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then
Name_Len := 0; Name_Len := 0;
Add_Str_To_Name_Buffer Add_Str_To_Name_Buffer
(Compiler_Names (Lang_C_Plus_Plus).all); (Compiler_Names (C_Plus_Plus_Language_Index).all);
Driver_Name := Name_Find; Driver_Name := Name_Find;
end if; end if;
end if; end if;
...@@ -2022,7 +2034,9 @@ package body Makegpr is ...@@ -2022,7 +2034,9 @@ package body Makegpr is
C_Plus_Plus_Is_Used := False; C_Plus_Plus_Is_Used := False;
for Project in 1 .. Projects.Last loop for Project in 1 .. Projects.Last loop
if Projects.Table (Project).Languages (Lang_C_Plus_Plus) then if
Projects.Table (Project).Languages (C_Plus_Plus_Language_Index)
then
C_Plus_Plus_Is_Used := True; C_Plus_Plus_Is_Used := True;
exit; exit;
end if; end if;
...@@ -2171,7 +2185,8 @@ package body Makegpr is ...@@ -2171,7 +2185,8 @@ package body Makegpr is
if Compiler_Is_Gcc (Source.Language) then if Compiler_Is_Gcc (Source.Language) then
Add_Argument (Dash_x, Verbose_Mode); Add_Argument (Dash_x, Verbose_Mode);
Add_Argument Add_Argument
(Lang_Names (Source.Language), Verbose_Mode); (Get_Name_String (Language_Names.Table (Source.Language)),
Verbose_Mode);
end if; end if;
Add_Argument (Dash_c, True); Add_Argument (Dash_c, True);
...@@ -2293,7 +2308,8 @@ package body Makegpr is ...@@ -2293,7 +2308,8 @@ package body Makegpr is
Project_Name : String := Get_Name_String (Data.Name); Project_Name : String := Get_Name_String (Data.Name);
Dummy : Boolean := False; Dummy : Boolean := False;
Ada_Is_A_Language : constant Boolean := Data.Languages (Lang_Ada); Ada_Is_A_Language : constant Boolean :=
Data.Languages (Ada_Language_Index);
begin begin
Ada_Mains.Init; Ada_Mains.Init;
...@@ -2398,7 +2414,7 @@ package body Makegpr is ...@@ -2398,7 +2414,7 @@ package body Makegpr is
-- Get the gnatmake to invoke -- Get the gnatmake to invoke
Get_Compiler (Lang_Ada); Get_Compiler (Ada_Language_Index);
-- Specify the project file -- Specify the project file
...@@ -2480,11 +2496,11 @@ package body Makegpr is ...@@ -2480,11 +2496,11 @@ package body Makegpr is
-- If there are compiling options for Ada, transmit them to gnatmake -- If there are compiling options for Ada, transmit them to gnatmake
if Comp_Opts.Last (Options (Lang_Ada)) /= 0 then if Comp_Opts.Last (Options (Ada_Language_Index)) /= 0 then
Add_Argument (Dash_cargs, True); Add_Argument (Dash_cargs, True);
for Arg in 1 .. Comp_Opts.Last (Options (Lang_Ada)) loop for Arg in 1 .. Comp_Opts.Last (Options (Ada_Language_Index)) loop
Add_Argument (Options (Lang_Ada).Table (Arg), True); Add_Argument (Options (Ada_Language_Index).Table (Arg), True);
end loop; end loop;
end if; end if;
...@@ -2513,10 +2529,11 @@ package body Makegpr is ...@@ -2513,10 +2529,11 @@ package body Makegpr is
-- And invoke gnatmake -- And invoke gnatmake
Display_Command Display_Command
(Compiler_Names (Lang_Ada).all, Compiler_Paths (Lang_Ada)); (Compiler_Names (Ada_Language_Index).all,
Compiler_Paths (Ada_Language_Index));
Spawn Spawn
(Compiler_Paths (Lang_Ada).all, (Compiler_Paths (Ada_Language_Index).all,
Arguments (1 .. Last_Argument), Arguments (1 .. Last_Argument),
Success); Success);
...@@ -2524,7 +2541,9 @@ package body Makegpr is ...@@ -2524,7 +2541,9 @@ package body Makegpr is
if not Success then if not Success then
Report_Error Report_Error
("invocation of ", Compiler_Names (Lang_Ada).all, " failed"); ("invocation of ",
Compiler_Names (Ada_Language_Index).all,
" failed");
end if; end if;
end Compile_Link_With_Gnatmake; end Compile_Link_With_Gnatmake;
...@@ -2612,7 +2631,7 @@ package body Makegpr is ...@@ -2612,7 +2631,7 @@ package body Makegpr is
if not Local_Errors if not Local_Errors
and then Data.Library and then Data.Library
and then not Data.Languages (Lang_Ada) and then not Data.Languages (Ada_Language_Index)
and then not Compile_Only and then not Compile_Only
then then
Build_Library (Project, Need_To_Rebuild_Archive); Build_Library (Project, Need_To_Rebuild_Archive);
...@@ -2770,7 +2789,7 @@ package body Makegpr is ...@@ -2770,7 +2789,7 @@ package body Makegpr is
-- Get_Compiler -- -- Get_Compiler --
------------------ ------------------
procedure Get_Compiler (For_Language : Programming_Language) is procedure Get_Compiler (For_Language : First_Language_Indexes) is
Data : constant Project_Data := Projects.Table (Main_Project); Data : constant Project_Data := Projects.Table (Main_Project);
Ide : constant Package_Id := Ide : constant Package_Id :=
...@@ -2779,7 +2798,7 @@ package body Makegpr is ...@@ -2779,7 +2798,7 @@ package body Makegpr is
Compiler : constant Variable_Value := Compiler : constant Variable_Value :=
Value_Of Value_Of
(Name => Lang_Name_Ids (For_Language), (Name => Language_Names.Table (For_Language),
Index => 0, Index => 0,
Attribute_Or_Array_Name => Name_Compiler_Command, Attribute_Or_Array_Name => Name_Compiler_Command,
In_Package => Ide); In_Package => Ide);
...@@ -2794,10 +2813,18 @@ package body Makegpr is ...@@ -2794,10 +2813,18 @@ package body Makegpr is
-- IDE, use the default compiler for this language. -- IDE, use the default compiler for this language.
if Compiler = Nil_Variable_Value then if Compiler = Nil_Variable_Value then
if For_Language in Default_Compiler_Names'Range then
Compiler_Names (For_Language) := Compiler_Names (For_Language) :=
Default_Compiler_Names (For_Language); Default_Compiler_Names (For_Language);
else else
Osint.Fail
("unknow compiler name for language """,
Get_Name_String (Language_Names.Table (For_Language)),
"""");
end if;
else
Compiler_Names (For_Language) := Compiler_Names (For_Language) :=
new String'(Get_Name_String (Compiler.Value)); new String'(Get_Name_String (Compiler.Value));
end if; end if;
...@@ -2825,7 +2852,7 @@ package body Makegpr is ...@@ -2825,7 +2852,7 @@ package body Makegpr is
-- Fail if compiler cannot be found -- Fail if compiler cannot be found
if Compiler_Paths (For_Language) = null then if Compiler_Paths (For_Language) = null then
if For_Language = Lang_Ada then if For_Language = Ada_Language_Index then
Osint.Fail Osint.Fail
("unable to locate """, ("unable to locate """,
Compiler_Names (For_Language).all, Compiler_Names (For_Language).all,
...@@ -2833,7 +2860,8 @@ package body Makegpr is ...@@ -2833,7 +2860,8 @@ package body Makegpr is
else else
Osint.Fail Osint.Fail
("unable to locate " & Lang_Display_Names (For_Language).all, ("unable to locate " &
Get_Name_String (Language_Names.Table (For_Language)),
" compiler """, Compiler_Names (For_Language).all & '"'); " compiler """, Compiler_Names (For_Language).all & '"');
end if; end if;
end if; end if;
...@@ -3031,8 +3059,7 @@ package body Makegpr is ...@@ -3031,8 +3059,7 @@ package body Makegpr is
Prj.Pars.Parse Prj.Pars.Parse
(Project => Main_Project, (Project => Main_Project,
Project_File_Name => Project_File_Name.all, Project_File_Name => Project_File_Name.all,
Packages_To_Check => Packages_To_Check, Packages_To_Check => Packages_To_Check);
Process_Languages => Other_Languages);
-- Fail if parsing/processing was unsuccessful -- Fail if parsing/processing was unsuccessful
...@@ -3238,9 +3265,9 @@ package body Makegpr is ...@@ -3238,9 +3265,9 @@ package body Makegpr is
procedure Add_C_Plus_Plus_Link_For_Gnatmake is procedure Add_C_Plus_Plus_Link_For_Gnatmake is
begin begin
if Compiler_Is_Gcc (Lang_C_Plus_Plus) then if Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then
Add_Argument Add_Argument
("--LINK=" & Compiler_Names (Lang_C_Plus_Plus).all, ("--LINK=" & Compiler_Names (C_Plus_Plus_Language_Index).all,
Verbose_Mode); Verbose_Mode);
else else
...@@ -3313,11 +3340,11 @@ package body Makegpr is ...@@ -3313,11 +3340,11 @@ package body Makegpr is
procedure Choose_C_Plus_Plus_Link_Process is procedure Choose_C_Plus_Plus_Link_Process is
begin begin
if Compiler_Names (Lang_C_Plus_Plus) = null then if Compiler_Names (C_Plus_Plus_Language_Index) = null then
Get_Compiler (Lang_C_Plus_Plus); Get_Compiler (C_Plus_Plus_Language_Index);
end if; end if;
if not Compiler_Is_Gcc (Lang_C_Plus_Plus) then if not Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then
Change_Dir (Object_Dir); Change_Dir (Object_Dir);
declare declare
...@@ -3332,7 +3359,7 @@ package body Makegpr is ...@@ -3332,7 +3359,7 @@ package body Makegpr is
Put_Line (File, "LIBGCC=`gcc -print-libgcc-file-name`"); Put_Line (File, "LIBGCC=`gcc -print-libgcc-file-name`");
Put_Line Put_Line
(File, (File,
Compiler_Names (Lang_C_Plus_Plus).all & Compiler_Names (C_Plus_Plus_Language_Index).all &
" $* ${LIBGCC}"); " $* ${LIBGCC}");
Close (File); Close (File);
...@@ -3538,7 +3565,7 @@ package body Makegpr is ...@@ -3538,7 +3565,7 @@ package body Makegpr is
-- Only Ada sources in the main project, and even maybe not -- Only Ada sources in the main project, and even maybe not
if not Data.Languages (Lang_Ada) then if not Data.Languages (Ada_Language_Index) then
-- Fail if the main project has no source of any language -- Fail if the main project has no source of any language
...@@ -3568,7 +3595,7 @@ package body Makegpr is ...@@ -3568,7 +3595,7 @@ package body Makegpr is
-- There are other language sources. First check if there are also -- There are other language sources. First check if there are also
-- sources in Ada. -- sources in Ada.
if Data.Languages (Lang_Ada) then if Data.Languages (Ada_Language_Index) then
-- There is a mix of Ada and other language sources in the main -- There is a mix of Ada and other language sources in the main
-- project. Any main that is not a source of the other languages -- project. Any main that is not a source of the other languages
...@@ -3694,7 +3721,7 @@ package body Makegpr is ...@@ -3694,7 +3721,7 @@ package body Makegpr is
-- If C++ is one of the languages, add the --LINK switch to -- If C++ is one of the languages, add the --LINK switch to
-- the linking switches. -- the linking switches.
if Data.Languages (Lang_C_Plus_Plus) then if Data.Languages (C_Plus_Plus_Language_Index) then
Add_Argument (Dash_largs, Verbose_Mode); Add_Argument (Dash_largs, Verbose_Mode);
Add_C_Plus_Plus_Link_For_Gnatmake; Add_C_Plus_Plus_Link_For_Gnatmake;
Add_Argument (Dash_margs, Verbose_Mode); Add_Argument (Dash_margs, Verbose_Mode);
...@@ -3710,15 +3737,15 @@ package body Makegpr is ...@@ -3710,15 +3737,15 @@ package body Makegpr is
-- First, get the linker to invoke -- First, get the linker to invoke
if Data.Languages (Lang_C_Plus_Plus) then if Data.Languages (C_Plus_Plus_Language_Index) then
Get_Compiler (Lang_C_Plus_Plus); Get_Compiler (C_Plus_Plus_Language_Index);
Linker_Name := Compiler_Names (Lang_C_Plus_Plus); Linker_Name := Compiler_Names (C_Plus_Plus_Language_Index);
Linker_Path := Compiler_Paths (Lang_C_Plus_Plus); Linker_Path := Compiler_Paths (C_Plus_Plus_Language_Index);
else else
Get_Compiler (Lang_C); Get_Compiler (C_Language_Index);
Linker_Name := Compiler_Names (Lang_C); Linker_Name := Compiler_Names (C_Language_Index);
Linker_Path := Compiler_Paths (Lang_C); Linker_Path := Compiler_Paths (C_Language_Index);
end if; end if;
Link_Done := False; Link_Done := False;
...@@ -3883,31 +3910,28 @@ package body Makegpr is ...@@ -3883,31 +3910,28 @@ package body Makegpr is
-- Set the processor/language for the following switches -- Set the processor/language for the following switches
-- -c???args: Compiler arguments -- -cargs: Ada compiler arguments
elsif Arg'Length >= 6 elsif Arg = "-cargs" then
and then Arg (Arg'First .. Arg'First + 1) = "-c" Current_Language := Ada_Language_Index;
and then Arg (Arg'Last - 3 .. Arg'Last) = "args" Current_Processor := Compiler;
then
declare elsif Arg'Length > 7 and then Arg (1 .. 7) = "-cargs:" then
OK : Boolean := False; Name_Len := 0;
Args_String : constant String := Add_Str_To_Name_Buffer (Arg (8 .. Arg'Last));
Arg (Arg'First + 2 .. Arg'Last - 4); To_Lower (Name_Buffer (1 .. Name_Len));
declare
Lang : constant Name_Id := Name_Find;
begin begin
for Lang in Programming_Language loop Current_Language := Language_Indexes.Get (Lang);
if Args_String = Lang_Args (Lang).all then
OK := True; if Current_Language = No_Language_Index then
Current_Language := Lang; Add_Language_Name (Lang);
exit; Current_Language := Last_Language_Index;
end if; end if;
end loop;
if OK then
Current_Processor := Compiler; Current_Processor := Compiler;
else
Osint.Fail ("illegal option """, Arg, """");
end if;
end; end;
elsif Arg = "-largs" then elsif Arg = "-largs" then
...@@ -4045,10 +4069,8 @@ package body Makegpr is ...@@ -4045,10 +4069,8 @@ package body Makegpr is
Osint.Write_Program_Name; Osint.Write_Program_Name;
Write_Str (" -P<project file> [opts] [name] {"); Write_Str (" -P<project file> [opts] [name] {");
for Lang in Programming_Language loop for Lang in First_Language_Indexes loop
Write_Str ("[-c"); Write_Str ("[-cargs:lang opts] ");
Write_Str (Lang_Args (Lang).all);
Write_Str ("args opts] ");
end loop; end loop;
Write_Str ("[-largs opts] [-gargs opts]}"); Write_Str ("[-largs opts] [-gargs opts]}");
...@@ -4116,30 +4138,15 @@ package body Makegpr is ...@@ -4116,30 +4138,15 @@ package body Makegpr is
Write_Eol; Write_Eol;
Write_Eol; Write_Eol;
-- Lines for -c*args -- Line for -cargs
for Lang in Programming_Language loop Write_Line (" -cargs opts opts are passed to the Ada compiler");
declare
Column : Positive := 13 + Lang_Args (Lang)'Length;
-- " -cargs opts" is the minimum and is 13 character long
begin -- Line for -cargs:lang
Write_Str (" -c");
Write_Str (Lang_Args (Lang).all);
Write_Str ("args opts");
loop Write_Line (" -cargs:<lang> opts");
Write_Char (' '); Write_Line (" opts are passed to the compiler " &
Column := Column + 1; "for language < lang > ");
exit when Column >= 17;
end loop;
Write_Str ("opts are passed to the ");
Write_Str (Lang_Display_Names (Lang).all);
Write_Str (" compiler");
Write_Eol;
end;
end loop;
-- Line for -largs -- Line for -largs
......
...@@ -109,11 +109,11 @@ package body MLib.Prj is ...@@ -109,11 +109,11 @@ package body MLib.Prj is
Table_Increment => 100); Table_Increment => 100);
package Objects_Htable is new GNAT.HTable.Simple_HTable package Objects_Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Com.Header_Num, (Header_Num => Header_Num,
Element => Boolean, Element => Boolean,
No_Element => False, No_Element => False,
Key => Name_Id, Key => Name_Id,
Hash => Com.Hash, Hash => Hash,
Equal => "="); Equal => "=");
-- List of non-Ada object files -- List of non-Ada object files
...@@ -155,42 +155,42 @@ package body MLib.Prj is ...@@ -155,42 +155,42 @@ package body MLib.Prj is
-- All the ALI file in the library -- All the ALI file in the library
package Library_ALIs is new GNAT.HTable.Simple_HTable package Library_ALIs is new GNAT.HTable.Simple_HTable
(Header_Num => Com.Header_Num, (Header_Num => Header_Num,
Element => Boolean, Element => Boolean,
No_Element => False, No_Element => False,
Key => Name_Id, Key => Name_Id,
Hash => Com.Hash, Hash => Hash,
Equal => "="); Equal => "=");
-- The ALI files in the interface sets -- The ALI files in the interface sets
package Interface_ALIs is new GNAT.HTable.Simple_HTable package Interface_ALIs is new GNAT.HTable.Simple_HTable
(Header_Num => Com.Header_Num, (Header_Num => Header_Num,
Element => Boolean, Element => Boolean,
No_Element => False, No_Element => False,
Key => Name_Id, Key => Name_Id,
Hash => Com.Hash, Hash => Hash,
Equal => "="); Equal => "=");
-- The ALI files that have been processed to check if the corresponding -- The ALI files that have been processed to check if the corresponding
-- library unit is in the interface set. -- library unit is in the interface set.
package Processed_ALIs is new GNAT.HTable.Simple_HTable package Processed_ALIs is new GNAT.HTable.Simple_HTable
(Header_Num => Com.Header_Num, (Header_Num => Header_Num,
Element => Boolean, Element => Boolean,
No_Element => False, No_Element => False,
Key => Name_Id, Key => Name_Id,
Hash => Com.Hash, Hash => Hash,
Equal => "="); Equal => "=");
-- The projects imported directly or indirectly. -- The projects imported directly or indirectly.
package Processed_Projects is new GNAT.HTable.Simple_HTable package Processed_Projects is new GNAT.HTable.Simple_HTable
(Header_Num => Com.Header_Num, (Header_Num => Header_Num,
Element => Boolean, Element => Boolean,
No_Element => False, No_Element => False,
Key => Name_Id, Key => Name_Id,
Hash => Com.Hash, Hash => Hash,
Equal => "="); Equal => "=");
-- The library projects imported directly or indirectly. -- The library projects imported directly or indirectly.
......
...@@ -82,6 +82,8 @@ package body Prj.Attr is ...@@ -82,6 +82,8 @@ package body Prj.Attr is
"lVmain#" & "lVmain#" &
"LVlanguages#" & "LVlanguages#" &
"SVmain_language#" & "SVmain_language#" &
"LVada_roots#" &
"SVexternally_built#" &
-- package Naming -- package Naming
...@@ -184,6 +186,17 @@ package body Prj.Attr is ...@@ -184,6 +186,17 @@ package body Prj.Attr is
"SVvcs_file_check#" & "SVvcs_file_check#" &
"SVvcs_log_check#" & "SVvcs_log_check#" &
-- package Language_Processing
"Planguage_processing#" &
"Lacompiler_driver#" &
"Sacompiler_kind#" &
"Ladependency_option#" &
"Lacompute_dependency#" &
"Lainclude_option#" &
"Sabinder_driver#" &
"SVdefault_linker#" &
"#"; "#";
Initialized : Boolean := False; Initialized : Boolean := False;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2000-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -33,11 +33,6 @@ package body Prj.Com is ...@@ -33,11 +33,6 @@ package body Prj.Com is
-- Hash -- -- Hash --
---------- ----------
function Hash (Name : Name_Id) return Header_Num is
begin
return Hash (Get_Name_String (Name));
end Hash;
function Hash (Name : String_Id) return Header_Num is function Hash (Name : String_Id) return Header_Num is
begin begin
String_To_Name_Buffer (Name); String_To_Name_Buffer (Name);
......
...@@ -84,12 +84,6 @@ package Prj.Com is ...@@ -84,12 +84,6 @@ package Prj.Com is
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Prj.Com.Units"); Table_Name => "Prj.Com.Units");
type Header_Num is range 0 .. 2047;
function Hash is new GNAT.HTable.Hash (Header_Num => Header_Num);
function Hash (Name : Name_Id) return Header_Num;
function Hash (Name : String_Id) return Header_Num; function Hash (Name : String_Id) return Header_Num;
package Units_Htable is new GNAT.HTable.Simple_HTable package Units_Htable is new GNAT.HTable.Simple_HTable
......
...@@ -703,7 +703,7 @@ package body Prj.Env is ...@@ -703,7 +703,7 @@ package body Prj.Env is
(File, "pragma Source_File_Name_Project"); (File, "pragma Source_File_Name_Project");
Put_Line Put_Line
(File, " (Spec_File_Name => ""*" & (File, " (Spec_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Current_Spec_Suffix) & Namet.Get_Name_String (Data.Naming.Ada_Spec_Suffix) &
""","); """,");
Put_Line Put_Line
(File, " Casing => " & (File, " Casing => " &
...@@ -719,7 +719,7 @@ package body Prj.Env is ...@@ -719,7 +719,7 @@ package body Prj.Env is
(File, "pragma Source_File_Name_Project"); (File, "pragma Source_File_Name_Project");
Put_Line Put_Line
(File, " (Body_File_Name => ""*" & (File, " (Body_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Current_Body_Suffix) & Namet.Get_Name_String (Data.Naming.Ada_Body_Suffix) &
""","); """,");
Put_Line Put_Line
(File, " Casing => " & (File, " Casing => " &
...@@ -732,7 +732,7 @@ package body Prj.Env is ...@@ -732,7 +732,7 @@ package body Prj.Env is
-- and maybe separate -- and maybe separate
if if
Data.Naming.Current_Body_Suffix /= Data.Naming.Separate_Suffix Data.Naming.Ada_Body_Suffix /= Data.Naming.Separate_Suffix
then then
Put_Line Put_Line
(File, "pragma Source_File_Name_Project"); (File, "pragma Source_File_Name_Project");
...@@ -1186,10 +1186,10 @@ package body Prj.Env is ...@@ -1186,10 +1186,10 @@ package body Prj.Env is
Extended_Spec_Name : String := Extended_Spec_Name : String :=
Name & Namet.Get_Name_String Name & Namet.Get_Name_String
(Data.Naming.Current_Spec_Suffix); (Data.Naming.Ada_Spec_Suffix);
Extended_Body_Name : String := Extended_Body_Name : String :=
Name & Namet.Get_Name_String Name & Namet.Get_Name_String
(Data.Naming.Current_Body_Suffix); (Data.Naming.Ada_Body_Suffix);
Unit : Unit_Data; Unit : Unit_Data;
...@@ -1674,10 +1674,10 @@ package body Prj.Env is ...@@ -1674,10 +1674,10 @@ package body Prj.Env is
Extended_Spec_Name : String := Extended_Spec_Name : String :=
Name & Namet.Get_Name_String Name & Namet.Get_Name_String
(Data.Naming.Current_Spec_Suffix); (Data.Naming.Ada_Spec_Suffix);
Extended_Body_Name : String := Extended_Body_Name : String :=
Name & Namet.Get_Name_String Name & Namet.Get_Name_String
(Data.Naming.Current_Body_Suffix); (Data.Naming.Ada_Body_Suffix);
First : Unit_Id := Units.First; First : Unit_Id := Units.First;
Current : Unit_Id; Current : Unit_Id;
...@@ -1862,10 +1862,10 @@ package body Prj.Env is ...@@ -1862,10 +1862,10 @@ package body Prj.Env is
Extended_Spec_Name : String := Extended_Spec_Name : String :=
Name & Namet.Get_Name_String Name & Namet.Get_Name_String
(Data.Naming.Current_Spec_Suffix); (Data.Naming.Ada_Spec_Suffix);
Extended_Body_Name : String := Extended_Body_Name : String :=
Name & Namet.Get_Name_String Name & Namet.Get_Name_String
(Data.Naming.Current_Body_Suffix); (Data.Naming.Ada_Body_Suffix);
Unit : Unit_Data; Unit : Unit_Data;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2000-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
with Namet; use Namet; with Namet; use Namet;
with Osint; use Osint; with Osint; use Osint;
with Prj.Com; use Prj.Com; with Sdefault;
with Types; use Types; with Types; use Types;
with GNAT.HTable; with GNAT.HTable;
...@@ -34,6 +34,20 @@ with GNAT.OS_Lib; use GNAT.OS_Lib; ...@@ -34,6 +34,20 @@ with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Prj.Ext is package body Prj.Ext is
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.
Prj_Path : constant String_Access := Getenv (Ada_Project_Path);
-- The path name(s) of directories where project files may reside.
-- May be empty.
No_Project_Default_Dir : constant String := "-";
Current_Project_Path : String_Access;
-- The project path; initialized during elaboration of package
-- Contains at least the current working directory.
package Htable is new GNAT.HTable.Simple_HTable package Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num, (Header_Num => Header_Num,
Element => Name_Id, Element => Name_Id,
...@@ -91,6 +105,15 @@ package body Prj.Ext is ...@@ -91,6 +105,15 @@ package body Prj.Ext is
return False; return False;
end Check; end Check;
------------------
-- Project_Path --
------------------
function Project_Path return String is
begin
return Current_Project_Path.all;
end Project_Path;
----------- -----------
-- Reset -- -- Reset --
----------- -----------
...@@ -100,6 +123,16 @@ package body Prj.Ext is ...@@ -100,6 +123,16 @@ package body Prj.Ext is
Htable.Reset; Htable.Reset;
end Reset; end Reset;
----------------------
-- Set_Project_Path --
----------------------
procedure Set_Project_Path (New_Path : String) is
begin
Free (Current_Project_Path);
Current_Project_Path := new String'(New_Path);
end Set_Project_Path;
-------------- --------------
-- Value_Of -- -- Value_Of --
-------------- --------------
...@@ -144,4 +177,77 @@ package body Prj.Ext is ...@@ -144,4 +177,77 @@ package body Prj.Ext is
end; end;
end Value_Of; end Value_Of;
begin
-- Initialize Current_Project_Path during package elaboration
declare
Add_Default_Dir : Boolean := True;
First : Positive;
Last : Positive;
begin
-- The current directory is always first
Name_Len := 1;
Name_Buffer (Name_Len) := '.';
-- If env. var. is defined and not empty, add its content
if Prj_Path.all /= "" then
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Path_Separator;
Add_Str_To_Name_Buffer (Prj_Path.all);
-- Scan the directory path to see if "-" is one of the directories.
-- Remove each occurence of "-" and set Add_Default_Dir to False.
First := 3;
loop
while First <= Name_Len
and then (Name_Buffer (First) = Path_Separator)
loop
First := First + 1;
end loop;
exit when First > Name_Len;
Last := First;
while Last < Name_Len
and then Name_Buffer (Last + 1) /= Path_Separator
loop
Last := Last + 1;
end loop;
-- If the directory is "-", set Add_Default_Dir to False and
-- remove from path.
if Name_Buffer (First .. Last) = No_Project_Default_Dir then
Add_Default_Dir := False;
for J in Last + 1 .. Name_Len loop
Name_Buffer (J - No_Project_Default_Dir'Length - 1) :=
Name_Buffer (J);
end loop;
Name_Len := Name_Len - No_Project_Default_Dir'Length - 1;
end if;
First := Last + 1;
end loop;
end if;
-- Set the initial value of Current_Project_Path
if Add_Default_Dir then
Current_Project_Path :=
new String'(Name_Buffer (1 .. Name_Len) & Path_Separator &
Sdefault.Search_Dir_Prefix.all & ".." &
Directory_Separator & ".." & Directory_Separator &
".." & Directory_Separator & "gnat");
else
Current_Project_Path := new String'(Name_Buffer (1 .. Name_Len));
end if;
end;
end Prj.Ext; end Prj.Ext;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,6 +31,16 @@ with Types; use Types; ...@@ -31,6 +31,16 @@ with Types; use Types;
package Prj.Ext is package Prj.Ext is
function Project_Path return String;
-- Return the current value of the project path, either the value set
-- during elaboration of the package or, if procedure Set_Project_Path has
-- been called, the value set by the last call to Set_Project_Path.
procedure Set_Project_Path (New_Path : String);
-- Give a new value to the project path. The new value New_Path should
-- always start with the current directory (".") and the path separators
-- should be the correct ones for the platform.
procedure Add procedure Add
(External_Name : String; (External_Name : String;
Value : String); Value : String);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -32,27 +32,23 @@ private package Prj.Nmsc is ...@@ -32,27 +32,23 @@ private package Prj.Nmsc is
-- procedures do (related to their names), rather than just an english -- procedures do (related to their names), rather than just an english
-- language summary of the implementation ??? -- language summary of the implementation ???
procedure Other_Languages_Check procedure Check
(Project : Project_Id;
Report_Error : Put_Line_Access);
-- Call Language_Independent_Check
--
-- Check the naming scheme for the supported languages (c, c++, ...) other
-- than Ada. Find the source files if any.
--
-- If Report_Error is null, use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
procedure Ada_Check
(Project : Project_Id; (Project : Project_Id;
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
Follow_Links : Boolean); Follow_Links : Boolean);
-- Call Language_Independent_Check -- Check the object directory and the source directories
--
-- Check the library attributes, including the library directory if any
--
-- Get the set of specification and implementation suffixes, if any
-- --
-- Check the naming scheme for Ada -- Check the naming scheme for Ada
-- --
-- Find the Ada source files if any -- Find the Ada source files if any
-- --
-- Check the naming scheme for the supported languages (c, c++, ...) other
-- than Ada. Find the source files if any.
--
-- If Report_Error is null , use the standard error reporting mechanism -- If Report_Error is null , use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error. -- (Errout). Otherwise, report errors using Report_Error.
-- --
...@@ -61,16 +57,4 @@ private package Prj.Nmsc is ...@@ -61,16 +57,4 @@ private package Prj.Nmsc is
-- still valid if they point to a file which is outside of the project), -- still valid if they point to a file which is outside of the project),
-- and that no directory has a name which is a valid source name. -- and that no directory has a name which is a valid source name.
procedure Language_Independent_Check
(Project : Project_Id;
Report_Error : Put_Line_Access);
-- Check the object directory and the source directories
--
-- Check the library attributes, including the library directory if any
--
-- Get the set of specification and implementation suffixes, if any
--
-- If Report_Error is null , use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
end Prj.Nmsc; end Prj.Nmsc;
...@@ -43,8 +43,7 @@ package body Prj.Pars is ...@@ -43,8 +43,7 @@ package body Prj.Pars is
procedure Parse procedure Parse
(Project : out Project_Id; (Project : out Project_Id;
Project_File_Name : String; Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages; Packages_To_Check : String_List_Access := All_Packages)
Process_Languages : Languages_Processed := Ada_Language)
is is
Project_Tree : Project_Node_Id := Empty_Node; Project_Tree : Project_Node_Id := Empty_Node;
The_Project : Project_Id := No_Project; The_Project : Project_Id := No_Project;
...@@ -67,7 +66,6 @@ package body Prj.Pars is ...@@ -67,7 +66,6 @@ package body Prj.Pars is
Success => Success, Success => Success,
From_Project_Node => Project_Tree, From_Project_Node => Project_Tree,
Report_Error => null, Report_Error => null,
Process_Languages => Process_Languages,
Follow_Links => Opt.Follow_Links); Follow_Links => Opt.Follow_Links);
Prj.Err.Finalize; Prj.Err.Finalize;
......
...@@ -24,24 +24,25 @@ ...@@ -24,24 +24,25 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Implements the parsing of project files. -- Implements the parsing of project files
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
package Prj.Pars is package Prj.Pars is
procedure Set_Verbosity (To : Verbosity); procedure Set_Verbosity (To : Verbosity);
-- Set the verbosity when parsing the project files. -- Set the verbosity when parsing the project files
procedure Parse procedure Parse
(Project : out Project_Id; (Project : out Project_Id;
Project_File_Name : String; Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages; Packages_To_Check : String_List_Access := All_Packages);
Process_Languages : Languages_Processed := Ada_Language);
-- Parse a project files and all its imported project files. -- Parse a project files and all its imported project files.
--
-- If parsing is successful, Project_Id is the project ID -- If parsing is successful, Project_Id is the project ID
-- of the main project file; otherwise, Project_Id is set -- of the main project file; otherwise, Project_Id is set
-- to No_Project. -- to No_Project.
--
-- Packages_To_Check indicates the packages where any unknown attribute -- Packages_To_Check indicates the packages where any unknown attribute
-- produces an error. For other packages, an unknown attribute produces -- produces an error. For other packages, an unknown attribute produces
-- a warning. -- a warning.
......
...@@ -32,8 +32,8 @@ with Output; use Output; ...@@ -32,8 +32,8 @@ with Output; use Output;
with Prj.Com; use Prj.Com; with Prj.Com; use Prj.Com;
with Prj.Dect; with Prj.Dect;
with Prj.Err; use Prj.Err; with Prj.Err; use Prj.Err;
with Prj.Ext; use Prj.Ext;
with Scans; use Scans; with Scans; use Scans;
with Sdefault;
with Sinput; use Sinput; with Sinput; use Sinput;
with Sinput.P; use Sinput.P; with Sinput.P; use Sinput.P;
with Snames; with Snames;
...@@ -54,18 +54,6 @@ package body Prj.Part is ...@@ -54,18 +54,6 @@ package body Prj.Part is
Dir_Sep : Character renames GNAT.OS_Lib.Directory_Separator; Dir_Sep : Character renames GNAT.OS_Lib.Directory_Separator;
Project_Path : String_Access;
-- The project path; initialized during package elaboration.
-- Contains at least the current working directory.
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.
Prj_Path : constant String_Access := Getenv (Ada_Project_Path);
-- The path name(s) of directories where project files may reside.
-- May be empty.
type Extension_Origin is (None, Extending_Simple, Extending_All); type Extension_Origin is (None, Extending_Simple, Extending_All);
-- Type of parameter From_Extended for procedures Parse_Single_Project and -- Type of parameter From_Extended for procedures Parse_Single_Project and
-- Post_Parse_Context_Clause. Extending_All means that we are parsing the -- Post_Parse_Context_Clause. Extending_All means that we are parsing the
...@@ -449,7 +437,7 @@ package body Prj.Part is ...@@ -449,7 +437,7 @@ package body Prj.Part is
if Current_Verbosity >= Medium then if Current_Verbosity >= Medium then
Write_Str ("ADA_PROJECT_PATH="""); Write_Str ("ADA_PROJECT_PATH=""");
Write_Str (Project_Path.all); Write_Str (Project_Path);
Write_Line (""""); Write_Line ("""");
end if; end if;
...@@ -707,7 +695,7 @@ package body Prj.Part is ...@@ -707,7 +695,7 @@ package body Prj.Part is
Normalize_Pathname Normalize_Pathname
(Imported_Path_Name, (Imported_Path_Name,
Resolve_Links => True, Resolve_Links => True,
Case_Sensitive => False); Case_Sensitive => True);
Withed_Project : Project_Node_Id := Empty_Node; Withed_Project : Project_Node_Id := Empty_Node;
...@@ -763,6 +751,7 @@ package body Prj.Part is ...@@ -763,6 +751,7 @@ package body Prj.Part is
begin begin
Name_Len := Resolved_Path'Length; Name_Len := Resolved_Path'Length;
Name_Buffer (1 .. Name_Len) := Resolved_Path; Name_Buffer (1 .. Name_Len) := Resolved_Path;
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Canonical_Path_Name := Name_Find; Canonical_Path_Name := Name_Find;
for Index in 1 .. Project_Stack.Last loop for Index in 1 .. Project_Stack.Last loop
...@@ -922,29 +911,18 @@ package body Prj.Part is ...@@ -922,29 +911,18 @@ package body Prj.Part is
Project_Stack.Table (Project_Stack.Last).Canonical_Path_Name := Project_Stack.Table (Project_Stack.Last).Canonical_Path_Name :=
Canonical_Path_Name; Canonical_Path_Name;
-- Check if the project file has already been parsed. -- Check if the project file has already been parsed
while while
A_Project_Name_And_Node /= Tree_Private_Part.No_Project_Name_And_Node A_Project_Name_And_Node /= Tree_Private_Part.No_Project_Name_And_Node
loop loop
declare if A_Project_Name_And_Node.Canonical_Path = Canonical_Path_Name then
Path_Id : Name_Id := Path_Name_Of (A_Project_Name_And_Node.Node);
begin
if Path_Id /= No_Name then
Get_Name_String (Path_Id);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Path_Id := Name_Find;
end if;
if Path_Id = Canonical_Path_Name then
if Extended then if Extended then
if A_Project_Name_And_Node.Extended then if A_Project_Name_And_Node.Extended then
Error_Msg Error_Msg
("cannot extend the same project file several times", ("cannot extend the same project file several times",
Token_Ptr); Token_Ptr);
else else
Error_Msg Error_Msg
("cannot extend an already imported project file", ("cannot extend an already imported project file",
...@@ -965,8 +943,7 @@ package body Prj.Part is ...@@ -965,8 +943,7 @@ package body Prj.Part is
Project_Declaration_Of Project_Declaration_Of
(A_Project_Name_And_Node.Node); (A_Project_Name_And_Node.Node);
Prj : Project_Node_Id := Prj : Project_Node_Id := Extending_Project_Of (Decl);
Extending_Project_Of (Decl);
begin begin
loop loop
...@@ -988,7 +965,6 @@ package body Prj.Part is ...@@ -988,7 +965,6 @@ package body Prj.Part is
Project_Stack.Decrement_Last; Project_Stack.Decrement_Last;
return; return;
end if; end if;
end;
A_Project_Name_And_Node := Tree_Private_Part.Projects_Htable.Get_Next; A_Project_Name_And_Node := Tree_Private_Part.Projects_Htable.Get_Next;
end loop; end loop;
...@@ -1037,7 +1013,7 @@ package body Prj.Part is ...@@ -1037,7 +1013,7 @@ package body Prj.Part is
Project := Default_Project_Node (Of_Kind => N_Project); Project := Default_Project_Node (Of_Kind => N_Project);
Project_Stack.Table (Project_Stack.Last).Id := Project; Project_Stack.Table (Project_Stack.Last).Id := Project;
Set_Directory_Of (Project, Project_Directory); Set_Directory_Of (Project, Project_Directory);
Set_Path_Name_Of (Project, Canonical_Path_Name); Set_Path_Name_Of (Project, Normed_Path_Name);
Set_Location_Of (Project, Token_Ptr); Set_Location_Of (Project, Token_Ptr);
Expect (Tok_Project, "PROJECT"); Expect (Tok_Project, "PROJECT");
...@@ -1052,7 +1028,6 @@ package body Prj.Part is ...@@ -1052,7 +1028,6 @@ package body Prj.Part is
-- Clear the Buffer -- Clear the Buffer
Buffer_Last := 0; Buffer_Last := 0;
loop loop
Expect (Tok_Identifier, "identifier"); Expect (Tok_Identifier, "identifier");
...@@ -1203,6 +1178,7 @@ package body Prj.Part is ...@@ -1203,6 +1178,7 @@ package body Prj.Part is
(K => Name_Of_Project, (K => Name_Of_Project,
E => (Name => Name_Of_Project, E => (Name => Name_Of_Project,
Node => Project, Node => Project,
Canonical_Path => Canonical_Path_Name,
Extended => Extended)); Extended => Extended));
end if; end if;
end; end;
...@@ -1370,7 +1346,7 @@ package body Prj.Part is ...@@ -1370,7 +1346,7 @@ package body Prj.Part is
Project_Declaration : Project_Node_Id := Empty_Node; Project_Declaration : Project_Node_Id := Empty_Node;
begin begin
-- No need to Scan past "is", Prj.Dect.Parse will do it. -- No need to Scan past "is", Prj.Dect.Parse will do it
Prj.Dect.Parse Prj.Dect.Parse
(Declarations => Project_Declaration, (Declarations => Project_Declaration,
...@@ -1630,7 +1606,7 @@ package body Prj.Part is ...@@ -1630,7 +1606,7 @@ package body Prj.Part is
Locate_Regular_File Locate_Regular_File
(File_Name => Directory & Directory_Separator & (File_Name => Directory & Directory_Separator &
Project_File_Name & Project_File_Extension, Project_File_Name & Project_File_Extension,
Path => Project_Path.all); Path => Project_Path);
-- Then we try <directory>/<file_name> -- Then we try <directory>/<file_name>
...@@ -1646,7 +1622,7 @@ package body Prj.Part is ...@@ -1646,7 +1622,7 @@ package body Prj.Part is
Locate_Regular_File Locate_Regular_File
(File_Name => Directory & Directory_Separator & (File_Name => Directory & Directory_Separator &
Project_File_Name, Project_File_Name,
Path => Project_Path.all); Path => Project_Path);
end if; end if;
end if; end if;
...@@ -1663,7 +1639,7 @@ package body Prj.Part is ...@@ -1663,7 +1639,7 @@ package body Prj.Part is
Result := Result :=
Locate_Regular_File Locate_Regular_File
(File_Name => Project_File_Name & Project_File_Extension, (File_Name => Project_File_Name & Project_File_Extension,
Path => Project_Path.all); Path => Project_Path);
end if; end if;
if Result = null then if Result = null then
...@@ -1678,7 +1654,7 @@ package body Prj.Part is ...@@ -1678,7 +1654,7 @@ package body Prj.Part is
Result := Result :=
Locate_Regular_File Locate_Regular_File
(File_Name => Project_File_Name, (File_Name => Project_File_Name,
Path => Project_Path.all); Path => Project_Path);
end if; end if;
-- If we cannot find the project file, we return an empty string -- If we cannot find the project file, we return an empty string
...@@ -1700,15 +1676,4 @@ package body Prj.Part is ...@@ -1700,15 +1676,4 @@ package body Prj.Part is
end if; end if;
end Project_Path_Name_Of; end Project_Path_Name_Of;
begin
-- Initialize Project_Path during package elaboration
if Prj_Path.all = "" then
Project_Path :=
new String'("." & Path_Separator & Sdefault.Search_Dir_Prefix.all &
".." & Directory_Separator & ".." & Directory_Separator &
".." & Directory_Separator & "gnat");
else
Project_Path := new String'("." & Path_Separator & Prj_Path.all);
end if;
end Prj.Part; end Prj.Part;
...@@ -30,7 +30,6 @@ with Opt; ...@@ -30,7 +30,6 @@ with Opt;
with Osint; use Osint; with Osint; use Osint;
with Output; use Output; with Output; use Output;
with Prj.Attr; use Prj.Attr; with Prj.Attr; use Prj.Attr;
with Prj.Com; use Prj.Com;
with Prj.Err; use Prj.Err; with Prj.Err; use Prj.Err;
with Prj.Ext; use Prj.Ext; with Prj.Ext; use Prj.Ext;
with Prj.Nmsc; use Prj.Nmsc; with Prj.Nmsc; use Prj.Nmsc;
...@@ -65,11 +64,9 @@ package body Prj.Proc is ...@@ -65,11 +64,9 @@ package body Prj.Proc is
procedure Check procedure Check
(Project : in out Project_Id; (Project : in out Project_Id;
Process_Languages : Languages_Processed;
Follow_Links : Boolean); Follow_Links : Boolean);
-- Set all projects to not checked, then call Recursive_Check for the -- Set all projects to not checked, then call Recursive_Check for the
-- main project Project. Project is set to No_Project if errors occurred. -- main project Project. Project is set to No_Project if errors occurred.
-- See Prj.Nmsc.Ada_Check for information on Follow_Links.
function Expression function Expression
(Project : Project_Id; (Project : Project_Id;
...@@ -112,12 +109,10 @@ package body Prj.Proc is ...@@ -112,12 +109,10 @@ package body Prj.Proc is
procedure Recursive_Check procedure Recursive_Check
(Project : Project_Id; (Project : Project_Id;
Process_Languages : Languages_Processed;
Follow_Links : Boolean); Follow_Links : Boolean);
-- If Project is not marked as checked, mark it as checked, call -- If Project is not marked as checked, mark it as checked, call
-- Check_Naming_Scheme for the project, then call itself for a -- Check_Naming_Scheme for the project, then call itself for a
-- possible extended project and all the imported projects of Project. -- possible extended project and all the imported projects of Project.
-- See Prj.Nmsc.Ada_Check for information on Follow_Links
--------- ---------
-- Add -- -- Add --
...@@ -127,7 +122,7 @@ package body Prj.Proc is ...@@ -127,7 +122,7 @@ package body Prj.Proc is
begin begin
if To_Exp = Types.No_Name or else To_Exp = Empty_String then if To_Exp = Types.No_Name or else To_Exp = Empty_String then
-- To_Exp is nil or empty. The result is Str. -- To_Exp is nil or empty. The result is Str
To_Exp := Str; To_Exp := Str;
...@@ -214,8 +209,8 @@ package body Prj.Proc is ...@@ -214,8 +209,8 @@ package body Prj.Proc is
procedure Check procedure Check
(Project : in out Project_Id; (Project : in out Project_Id;
Process_Languages : Languages_Processed; Follow_Links : Boolean)
Follow_Links : Boolean) is is
begin begin
-- Make sure that all projects are marked as not checked -- Make sure that all projects are marked as not checked
...@@ -223,8 +218,7 @@ package body Prj.Proc is ...@@ -223,8 +218,7 @@ package body Prj.Proc is
Projects.Table (Index).Checked := False; Projects.Table (Index).Checked := False;
end loop; end loop;
Recursive_Check (Project, Process_Languages, Follow_Links); Recursive_Check (Project, Follow_Links);
end Check; end Check;
---------------- ----------------
...@@ -248,7 +242,7 @@ package body Prj.Proc is ...@@ -248,7 +242,7 @@ package body Prj.Proc is
-- The returned result -- The returned result
Last : String_List_Id := Nil_String; Last : String_List_Id := Nil_String;
-- Reference to the last string elements in Result, when Kind is List. -- Reference to the last string elements in Result, when Kind is List
begin begin
Result.Project := Project; Result.Project := Project;
...@@ -282,8 +276,7 @@ package body Prj.Proc is ...@@ -282,8 +276,7 @@ package body Prj.Proc is
if Last = Nil_String then if Last = Nil_String then
-- This can happen in an expression such as -- This can happen in an expression like () & "toto"
-- () & "toto"
Result.Values := String_Elements.Last; Result.Values := String_Elements.Last;
...@@ -300,7 +293,6 @@ package body Prj.Proc is ...@@ -300,7 +293,6 @@ package body Prj.Proc is
Location => Location_Of (The_Current_Term), Location => Location_Of (The_Current_Term),
Flag => False, Flag => False,
Next => Nil_String); Next => Nil_String);
end case; end case;
when N_Literal_String_List => when N_Literal_String_List =>
...@@ -856,7 +848,6 @@ package body Prj.Proc is ...@@ -856,7 +848,6 @@ package body Prj.Proc is
Success : out Boolean; Success : out Boolean;
From_Project_Node : Project_Node_Id; From_Project_Node : Project_Node_Id;
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
Process_Languages : Languages_Processed := Ada_Language;
Follow_Links : Boolean := True) Follow_Links : Boolean := True)
is is
Obj_Dir : Name_Id; Obj_Dir : Name_Id;
...@@ -881,7 +872,7 @@ package body Prj.Proc is ...@@ -881,7 +872,7 @@ package body Prj.Proc is
Extended_By => No_Project); Extended_By => No_Project);
if Project /= No_Project then if Project /= No_Project then
Check (Project, Process_Languages, Follow_Links); Check (Project, Follow_Links);
end if; end if;
-- If main project is an extending all project, set the object -- If main project is an extending all project, set the object
...@@ -922,13 +913,18 @@ package body Prj.Proc is ...@@ -922,13 +913,18 @@ package body Prj.Proc is
Extending2 := Extending; Extending2 := Extending;
while Extending2 /= No_Project loop while Extending2 /= No_Project loop
if ((Process_Languages = Ada_Language
and then -- why is this code commented out ???
Projects.Table (Extending2).Ada_Sources_Present)
or else -- if ((Process_Languages = Ada_Language
(Process_Languages = Other_Languages -- and then
and then -- Projects.Table (Extending2).Ada_Sources_Present)
Projects.Table (Extending2).Other_Sources_Present)) -- or else
-- (Process_Languages = Other_Languages
-- and then
-- Projects.Table (Extending2).Other_Sources_Present))
if Projects.Table (Extending2).Ada_Sources_Present
and then and then
Projects.Table (Extending2).Object_Directory = Obj_Dir Projects.Table (Extending2).Object_Directory = Obj_Dir
then then
...@@ -1267,9 +1263,11 @@ package body Prj.Proc is ...@@ -1267,9 +1263,11 @@ package body Prj.Proc is
-- Copy each array element -- Copy each array element
while Orig_Element /= No_Array_Element loop while Orig_Element /= No_Array_Element loop
-- If it is the first element ...
-- Case of first element
if Prev_Element = No_Array_Element then if Prev_Element = No_Array_Element then
-- And there is no array element declared yet, -- And there is no array element declared yet,
-- create a new first array element. -- create a new first array element.
...@@ -1324,6 +1322,7 @@ package body Prj.Proc is ...@@ -1324,6 +1322,7 @@ package body Prj.Proc is
Prev_Element := New_Element; Prev_Element := New_Element;
-- Go to the next element in the original array -- Go to the next element in the original array
Orig_Element := Orig_Element :=
Array_Elements.Table (Orig_Element).Next; Array_Elements.Table (Orig_Element).Next;
end loop; end loop;
...@@ -1804,7 +1803,6 @@ package body Prj.Proc is ...@@ -1804,7 +1803,6 @@ package body Prj.Proc is
procedure Recursive_Check procedure Recursive_Check
(Project : Project_Id; (Project : Project_Id;
Process_Languages : Languages_Processed;
Follow_Links : Boolean) Follow_Links : Boolean)
is is
Data : Project_Data; Data : Project_Data;
...@@ -1827,7 +1825,7 @@ package body Prj.Proc is ...@@ -1827,7 +1825,7 @@ package body Prj.Proc is
-- Call itself for a possible extended project. -- Call itself for a possible extended project.
-- (if there is no extended project, then nothing happens). -- (if there is no extended project, then nothing happens).
Recursive_Check (Data.Extends, Process_Languages, Follow_Links); Recursive_Check (Data.Extends, Follow_Links);
-- Call itself for all imported projects -- Call itself for all imported projects
...@@ -1835,7 +1833,7 @@ package body Prj.Proc is ...@@ -1835,7 +1833,7 @@ package body Prj.Proc is
while Imported_Project_List /= Empty_Project_List loop while Imported_Project_List /= Empty_Project_List loop
Recursive_Check Recursive_Check
(Project_Lists.Table (Imported_Project_List).Project, (Project_Lists.Table (Imported_Project_List).Project,
Process_Languages, Follow_Links); Follow_Links);
Imported_Project_List := Imported_Project_List :=
Project_Lists.Table (Imported_Project_List).Next; Project_Lists.Table (Imported_Project_List).Next;
end loop; end loop;
...@@ -1846,18 +1844,7 @@ package body Prj.Proc is ...@@ -1846,18 +1844,7 @@ package body Prj.Proc is
Write_Line (""""); Write_Line ("""");
end if; end if;
case Process_Languages is Prj.Nmsc.Check (Project, Error_Report, Follow_Links);
when Ada_Language =>
Prj.Nmsc.Ada_Check (Project, Error_Report, Follow_Links);
when Other_Languages =>
Prj.Nmsc.Other_Languages_Check (Project, Error_Report);
when All_Languages =>
Prj.Nmsc.Ada_Check (Project, Error_Report, Follow_Links);
Prj.Nmsc.Other_Languages_Check (Project, Error_Report);
end case;
end if; end if;
end Recursive_Check; end Recursive_Check;
......
...@@ -37,7 +37,6 @@ package Prj.Proc is ...@@ -37,7 +37,6 @@ package Prj.Proc is
Success : out Boolean; Success : out Boolean;
From_Project_Node : Project_Node_Id; From_Project_Node : Project_Node_Id;
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
Process_Languages : Languages_Processed := Ada_Language;
Follow_Links : Boolean := True); Follow_Links : Boolean := True);
-- Process a project file tree into project file data structures. -- Process a project file tree into project file data structures.
-- If Report_Error is null, use the error reporting mechanism. -- If Report_Error is null, use the error reporting mechanism.
......
...@@ -24,12 +24,11 @@ ...@@ -24,12 +24,11 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package defines the structure of the Project File tree. -- This package defines the structure of the Project File tree
with GNAT.HTable; with GNAT.HTable;
with Prj.Attr; use Prj.Attr; with Prj.Attr; use Prj.Attr;
with Prj.Com; use Prj.Com;
with Table; use Table; with Table; use Table;
with Types; use Types; with Types; use Types;
...@@ -150,7 +149,7 @@ package Prj.Tree is ...@@ -150,7 +149,7 @@ package Prj.Tree is
-- this node. -- this node.
procedure Remove_Next_End_Node; procedure Remove_Next_End_Node;
-- Remove the top of the end node stack. -- Remove the top of the end node stack
------------------------ ------------------------
-- Comment Processing -- -- Comment Processing --
...@@ -172,13 +171,13 @@ package Prj.Tree is ...@@ -172,13 +171,13 @@ package Prj.Tree is
-- A table to store the comments that may be stored is the tree -- A table to store the comments that may be stored is the tree
procedure Scan; procedure Scan;
-- Scan the tokens and accumulate comments. -- Scan the tokens and accumulate comments
type Comment_Location is type Comment_Location is
(Before, After, Before_End, After_End, End_Of_Line); (Before, After, Before_End, After_End, End_Of_Line);
procedure Add_Comments (To : Project_Node_Id; Where : Comment_Location); procedure Add_Comments (To : Project_Node_Id; Where : Comment_Location);
-- Add comments to this node. -- Add comments to this node
---------------------- ----------------------
-- Access Functions -- -- Access Functions --
...@@ -235,7 +234,7 @@ package Prj.Tree is ...@@ -235,7 +234,7 @@ package Prj.Tree is
function Directory_Of (Node : Project_Node_Id) return Name_Id; function Directory_Of (Node : Project_Node_Id) return Name_Id;
pragma Inline (Directory_Of); pragma Inline (Directory_Of);
-- Only valid for N_Project nodes. -- Only valid for N_Project nodes
function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind; function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind;
pragma Inline (Expression_Kind_Of); pragma Inline (Expression_Kind_Of);
...@@ -263,7 +262,7 @@ package Prj.Tree is ...@@ -263,7 +262,7 @@ package Prj.Tree is
function Path_Name_Of (Node : Project_Node_Id) return Name_Id; function Path_Name_Of (Node : Project_Node_Id) return Name_Id;
pragma Inline (Path_Name_Of); pragma Inline (Path_Name_Of);
-- Only valid for N_Project and N_With_Clause nodes. -- Only valid for N_Project and N_With_Clause nodes
function String_Value_Of (Node : Project_Node_Id) return Name_Id; function String_Value_Of (Node : Project_Node_Id) return Name_Id;
pragma Inline (String_Value_Of); pragma Inline (String_Value_Of);
...@@ -1046,12 +1045,18 @@ package Prj.Tree is ...@@ -1046,12 +1045,18 @@ package Prj.Tree is
Node : Project_Node_Id; Node : Project_Node_Id;
-- Node of the project in table Project_Nodes -- Node of the project in table Project_Nodes
Canonical_Path : Name_Id;
-- Resolved and canonical path of the project file
Extended : Boolean; Extended : Boolean;
-- True when the project is being extended by another project -- True when the project is being extended by another project
end record; end record;
No_Project_Name_And_Node : constant Project_Name_And_Node := No_Project_Name_And_Node : constant Project_Name_And_Node :=
(Name => No_Name, Node => Empty_Node, Extended => True); (Name => No_Name,
Node => Empty_Node,
Canonical_Path => No_Name,
Extended => True);
package Projects_Htable is new GNAT.HTable.Simple_HTable package Projects_Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num, (Header_Num => Header_Num,
......
...@@ -107,12 +107,12 @@ package body Prj.Util is ...@@ -107,12 +107,12 @@ package body Prj.Util is
Body_Append : constant String := Get_Name_String Body_Append : constant String := Get_Name_String
(Projects.Table (Projects.Table
(Project). (Project).
Naming.Current_Body_Suffix); Naming.Ada_Body_Suffix);
Spec_Append : constant String := Get_Name_String Spec_Append : constant String := Get_Name_String
(Projects.Table (Projects.Table
(Project). (Project).
Naming.Current_Spec_Suffix); Naming.Ada_Spec_Suffix);
begin begin
if Builder_Package /= No_Package then if Builder_Package /= No_Package then
...@@ -131,9 +131,9 @@ package body Prj.Util is ...@@ -131,9 +131,9 @@ package body Prj.Util is
Projects.Table (Project).Naming; Projects.Table (Project).Naming;
Spec_Suffix : constant String := Spec_Suffix : constant String :=
Get_Name_String (Naming.Current_Spec_Suffix); Get_Name_String (Naming.Ada_Spec_Suffix);
Body_Suffix : constant String := Body_Suffix : constant String :=
Get_Name_String (Naming.Current_Body_Suffix); Get_Name_String (Naming.Ada_Body_Suffix);
Truncated : Boolean := False; Truncated : Boolean := False;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Characters.Handling; use Ada.Characters.Handling;
with Namet; use Namet; with Namet; use Namet;
with Output; use Output;
with Osint; use Osint; with Osint; use Osint;
with Prj.Attr; with Prj.Attr;
with Prj.Com; with Prj.Com;
...@@ -36,12 +37,15 @@ with Scans; use Scans; ...@@ -36,12 +37,15 @@ with Scans; use Scans;
with Snames; use Snames; with Snames; use Snames;
with Uintp; use Uintp; with Uintp; use Uintp;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Prj is package body Prj is
The_Empty_String : Name_Id; The_Empty_String : Name_Id;
Name_C_Plus_Plus : Name_Id;
subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case; subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case;
The_Casing_Images : constant array (Known_Casing) of String_Access := The_Casing_Images : constant array (Known_Casing) of String_Access :=
...@@ -55,15 +59,16 @@ package body Prj is ...@@ -55,15 +59,16 @@ package body Prj is
First_Name_Id + Character'Pos ('-'); First_Name_Id + Character'Pos ('-');
Std_Naming_Data : Naming_Data := Std_Naming_Data : Naming_Data :=
(Current_Language => No_Name, (Dot_Replacement => Standard_Dot_Replacement,
Dot_Replacement => Standard_Dot_Replacement,
Dot_Repl_Loc => No_Location, Dot_Repl_Loc => No_Location,
Casing => All_Lower_Case, Casing => All_Lower_Case,
Spec_Suffix => No_Array_Element, Spec_Suffix => No_Array_Element,
Current_Spec_Suffix => No_Name, Ada_Spec_Suffix => No_Name,
Spec_Suffix_Loc => No_Location, Spec_Suffix_Loc => No_Location,
Impl_Suffixes => No_Impl_Suffixes,
Supp_Suffixes => No_Supp_Language_Index,
Body_Suffix => No_Array_Element, Body_Suffix => No_Array_Element,
Current_Body_Suffix => No_Name, Ada_Body_Suffix => No_Name,
Body_Suffix_Loc => No_Location, Body_Suffix_Loc => No_Location,
Separate_Suffix => No_Name, Separate_Suffix => No_Name,
Sep_Suffix_Loc => No_Location, Sep_Suffix_Loc => No_Location,
...@@ -73,8 +78,9 @@ package body Prj is ...@@ -73,8 +78,9 @@ package body Prj is
Implementation_Exceptions => No_Array_Element); Implementation_Exceptions => No_Array_Element);
Project_Empty : constant Project_Data := Project_Empty : constant Project_Data :=
(Languages => No_Languages, (Externally_Built => False,
Impl_Suffixes => No_Impl_Suffixes, Languages => No_Languages,
Supp_Languages => No_Supp_Language_Index,
First_Referred_By => No_Project, First_Referred_By => No_Project,
Name => No_Name, Name => No_Name,
Path_Name => No_Name, Path_Name => No_Name,
...@@ -114,6 +120,10 @@ package body Prj is ...@@ -114,6 +120,10 @@ package body Prj is
Extends => No_Project, Extends => No_Project,
Extended_By => No_Project, Extended_By => No_Project,
Naming => Std_Naming_Data, Naming => Std_Naming_Data,
First_Language_Processing => Default_First_Language_Processing_Data,
Supp_Language_Processing => No_Supp_Language_Index,
Default_Linker => No_Name,
Default_Linker_Path => No_Name,
Decl => No_Declarations, Decl => No_Declarations,
Imported_Projects => Empty_Project_List, Imported_Projects => Empty_Project_List,
Ada_Include_Path => null, Ada_Include_Path => null,
...@@ -131,6 +141,18 @@ package body Prj is ...@@ -131,6 +141,18 @@ package body Prj is
Depth => 0, Depth => 0,
Unkept_Comments => False); Unkept_Comments => False);
-----------------------
-- Add_Language_Name --
-----------------------
procedure Add_Language_Name (Name : Name_Id) is
begin
Last_Language_Index := Last_Language_Index + 1;
Language_Indexes.Set (Name, Last_Language_Index);
Language_Names.Increment_Last;
Language_Names.Table (Last_Language_Index) := Name;
end Add_Language_Name;
------------------- -------------------
-- Add_To_Buffer -- -- Add_To_Buffer --
------------------- -------------------
...@@ -155,6 +177,17 @@ package body Prj is ...@@ -155,6 +177,17 @@ package body Prj is
Buffer_Last := Buffer_Last + S'Length; Buffer_Last := Buffer_Last + S'Length;
end Add_To_Buffer; end Add_To_Buffer;
---------------------------
-- Display_Language_Name --
---------------------------
procedure Display_Language_Name (Language : Language_Index) is
begin
Get_Name_String (Language_Names.Table (Language));
To_Upper (Name_Buffer (1 .. 1));
Write_Str (Name_Buffer (1 .. Name_Len));
end Display_Language_Name;
------------------- -------------------
-- Empty_Project -- -- Empty_Project --
------------------- -------------------
...@@ -195,9 +228,12 @@ package body Prj is ...@@ -195,9 +228,12 @@ package body Prj is
is is
procedure Check (Project : Project_Id); procedure Check (Project : Project_Id);
-- Check if a project has already been seen. -- Check if a project has already been seen. If not seen, mark it as
-- If not seen, mark it as seen, call Action, -- Seen, Call Action, and check all its imported projects.
-- and check all its imported projects.
-----------
-- Check --
-----------
procedure Check (Project : Project_Id) is procedure Check (Project : Project_Id) is
List : Project_List; List : Project_List;
...@@ -215,6 +251,8 @@ package body Prj is ...@@ -215,6 +251,8 @@ package body Prj is
end if; end if;
end Check; end Check;
-- Start of procecessing for For_Every_Project_Imported
begin begin
for Project in Projects.First .. Projects.Last loop for Project in Projects.First .. Projects.Last loop
Projects.Table (Project).Seen := False; Projects.Table (Project).Seen := False;
...@@ -223,6 +261,15 @@ package body Prj is ...@@ -223,6 +261,15 @@ package body Prj is
Check (Project => By); Check (Project => By);
end For_Every_Project_Imported; end For_Every_Project_Imported;
----------
-- Hash --
----------
function Hash (Name : Name_Id) return Header_Num is
begin
return Hash (Get_Name_String (Name));
end Hash;
----------- -----------
-- Image -- -- Image --
----------- -----------
...@@ -253,18 +300,12 @@ package body Prj is ...@@ -253,18 +300,12 @@ package body Prj is
Name_Len := 1; Name_Len := 1;
Name_Buffer (1) := '/'; Name_Buffer (1) := '/';
Slash := Name_Find; Slash := Name_Find;
Name_Len := 3;
Name_Buffer (1 .. 3) := "c++";
Name_C_Plus_Plus := Name_Find;
for Lang in Programming_Language loop Std_Naming_Data.Ada_Spec_Suffix := Default_Ada_Spec_Suffix;
Name_Len := Lang_Names (Lang)'Length; Std_Naming_Data.Ada_Body_Suffix := Default_Ada_Body_Suffix;
Name_Buffer (1 .. Name_Len) := Lang_Names (Lang).all;
Lang_Name_Ids (Lang) := Name_Find;
Name_Len := Lang_Suffixes (Lang)'Length;
Name_Buffer (1 .. Name_Len) := Lang_Suffixes (Lang).all;
Lang_Suffix_Ids (Lang) := Name_Find;
end loop;
Std_Naming_Data.Current_Spec_Suffix := Default_Ada_Spec_Suffix;
Std_Naming_Data.Current_Body_Suffix := Default_Ada_Body_Suffix;
Std_Naming_Data.Separate_Suffix := Default_Ada_Body_Suffix; Std_Naming_Data.Separate_Suffix := Default_Ada_Body_Suffix;
Register_Default_Naming_Scheme Register_Default_Naming_Scheme
(Language => Name_Ada, (Language => Name_Ada,
...@@ -275,9 +316,91 @@ package body Prj is ...@@ -275,9 +316,91 @@ package body Prj is
Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project)); Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project));
Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends)); Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends));
Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External)); Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External));
Language_Indexes.Reset;
Last_Language_Index := No_Language_Index;
Language_Names.Init;
Add_Language_Name (Name_Ada);
Add_Language_Name (Name_C);
Add_Language_Name (Name_C_Plus_Plus);
end if; end if;
end Initialize; end Initialize;
----------------
-- Is_Present --
----------------
function Is_Present
(Language : Language_Index;
In_Project : Project_Data) return Boolean
is
begin
case Language is
when No_Language_Index =>
return False;
when First_Language_Indexes =>
return In_Project.Languages (Language);
when others =>
declare
Supp : Supp_Language;
Supp_Index : Supp_Language_Index := In_Project.Supp_Languages;
begin
while Supp_Index /= No_Supp_Language_Index loop
Supp := Present_Languages.Table (Supp_Index);
if Supp.Index = Language then
return Supp.Present;
end if;
Supp_Index := Supp.Next;
end loop;
return False;
end;
end case;
end Is_Present;
---------------------------------
-- Language_Processing_Data_Of --
---------------------------------
function Language_Processing_Data_Of
(Language : Language_Index;
In_Project : Project_Data) return Language_Processing_Data
is
begin
case Language is
when No_Language_Index =>
return Default_Language_Processing_Data;
when First_Language_Indexes =>
return In_Project.First_Language_Processing (Language);
when others =>
declare
Supp : Supp_Language_Data;
Supp_Index : Supp_Language_Index :=
In_Project.Supp_Language_Processing;
begin
while Supp_Index /= No_Supp_Language_Index loop
Supp := Supp_Languages.Table (Supp_Index);
if Supp.Index = Language then
return Supp.Data;
end if;
Supp_Index := Supp.Next;
end loop;
return Default_Language_Processing_Data;
end;
end case;
end Language_Processing_Data_Of;
------------------------------------ ------------------------------------
-- Register_Default_Naming_Scheme -- -- Register_Default_Naming_Scheme --
------------------------------------ ------------------------------------
...@@ -398,17 +521,145 @@ package body Prj is ...@@ -398,17 +521,145 @@ package body Prj is
------------------------ ------------------------
function Same_Naming_Scheme function Same_Naming_Scheme
(Left, Right : Naming_Data) (Left, Right : Naming_Data) return Boolean
return Boolean
is is
begin begin
return Left.Dot_Replacement = Right.Dot_Replacement return Left.Dot_Replacement = Right.Dot_Replacement
and then Left.Casing = Right.Casing and then Left.Casing = Right.Casing
and then Left.Current_Spec_Suffix = Right.Current_Spec_Suffix and then Left.Ada_Spec_Suffix = Right.Ada_Spec_Suffix
and then Left.Current_Body_Suffix = Right.Current_Body_Suffix and then Left.Ada_Body_Suffix = Right.Ada_Body_Suffix
and then Left.Separate_Suffix = Right.Separate_Suffix; and then Left.Separate_Suffix = Right.Separate_Suffix;
end Same_Naming_Scheme; end Same_Naming_Scheme;
---------
-- Set --
---------
procedure Set
(Language : Language_Index;
Present : Boolean;
In_Project : in out Project_Data)
is
begin
case Language is
when No_Language_Index =>
null;
when First_Language_Indexes =>
In_Project.Languages (Language) := Present;
when others =>
declare
Supp : Supp_Language;
Supp_Index : Supp_Language_Index := In_Project.Supp_Languages;
begin
while Supp_Index /= No_Supp_Language_Index loop
Supp := Present_Languages.Table (Supp_Index);
if Supp.Index = Language then
Present_Languages.Table (Supp_Index).Present := Present;
return;
end if;
Supp_Index := Supp.Next;
end loop;
Supp := (Index => Language, Present => Present,
Next => In_Project.Supp_Languages);
Present_Languages.Increment_Last;
Supp_Index := Present_Languages.Last;
Present_Languages.Table (Supp_Index) := Supp;
In_Project.Supp_Languages := Supp_Index;
end;
end case;
end Set;
procedure Set
(Language_Processing : in Language_Processing_Data;
For_Language : Language_Index;
In_Project : in out Project_Data)
is
begin
case For_Language is
when No_Language_Index =>
null;
when First_Language_Indexes =>
In_Project.First_Language_Processing (For_Language) :=
Language_Processing;
when others =>
declare
Supp : Supp_Language_Data;
Supp_Index : Supp_Language_Index :=
In_Project.Supp_Language_Processing;
begin
while Supp_Index /= No_Supp_Language_Index loop
Supp := Supp_Languages.Table (Supp_Index);
if Supp.Index = For_Language then
Supp_Languages.Table (Supp_Index).Data :=
Language_Processing;
return;
end if;
Supp_Index := Supp.Next;
end loop;
Supp := (Index => For_Language, Data => Language_Processing,
Next => In_Project.Supp_Language_Processing);
Supp_Languages.Increment_Last;
Supp_Index := Supp_Languages.Last;
Supp_Languages.Table (Supp_Index) := Supp;
In_Project.Supp_Language_Processing := Supp_Index;
end;
end case;
end Set;
procedure Set
(Suffix : Name_Id;
For_Language : Language_Index;
In_Project : in out Project_Data)
is
begin
case For_Language is
when No_Language_Index =>
null;
when First_Language_Indexes =>
In_Project.Naming.Impl_Suffixes (For_Language) := Suffix;
when others =>
declare
Supp : Supp_Suffix;
Supp_Index : Supp_Language_Index :=
In_Project.Naming.Supp_Suffixes;
begin
while Supp_Index /= No_Supp_Language_Index loop
Supp := Supp_Suffix_Table.Table (Supp_Index);
if Supp.Index = For_Language then
Supp_Suffix_Table.Table (Supp_Index).Suffix := Suffix;
return;
end if;
Supp_Index := Supp.Next;
end loop;
Supp := (Index => For_Language, Suffix => Suffix,
Next => In_Project.Naming.Supp_Suffixes);
Supp_Suffix_Table.Increment_Last;
Supp_Index := Supp_Suffix_Table.Last;
Supp_Suffix_Table.Table (Supp_Index) := Supp;
In_Project.Naming.Supp_Suffixes := Supp_Index;
end;
end case;
end Set;
-------------------------- --------------------------
-- Standard_Naming_Data -- -- Standard_Naming_Data --
-------------------------- --------------------------
...@@ -419,6 +670,44 @@ package body Prj is ...@@ -419,6 +670,44 @@ package body Prj is
return Std_Naming_Data; return Std_Naming_Data;
end Standard_Naming_Data; end Standard_Naming_Data;
---------------
-- Suffix_Of --
---------------
function Suffix_Of
(Language : Language_Index;
In_Project : Project_Data) return Name_Id
is
begin
case Language is
when No_Language_Index =>
return No_Name;
when First_Language_Indexes =>
return In_Project.Naming.Impl_Suffixes (Language);
when others =>
declare
Supp : Supp_Suffix;
Supp_Index : Supp_Language_Index :=
In_Project.Naming.Supp_Suffixes;
begin
while Supp_Index /= No_Supp_Language_Index loop
Supp := Supp_Suffix_Table.Table (Supp_Index);
if Supp.Index = Language then
return Supp.Suffix;
end if;
Supp_Index := Supp.Next;
end loop;
return No_Name;
end;
end case;
end Suffix_Of;
----------- -----------
-- Value -- -- Value --
----------- -----------
......
...@@ -37,6 +37,8 @@ with Types; use Types; ...@@ -37,6 +37,8 @@ with Types; use Types;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
with System.HTable; use System.HTable;
package Prj is package Prj is
Empty_Name : Name_Id; Empty_Name : Name_Id;
...@@ -66,96 +68,167 @@ package Prj is ...@@ -66,96 +68,167 @@ package Prj is
Slash : Name_Id; Slash : Name_Id;
-- "/", used as the path of locally removed files -- "/", used as the path of locally removed files
type Languages_Processed is (Ada_Language, Other_Languages, All_Languages); type Language_Index is new Nat;
-- To specify how to process project files
No_Language_Index : constant Language_Index := 0;
First_Language_Index : constant Language_Index := 1;
First_Language_Indexes_Last : constant Language_Index := 5;
Ada_Language_Index : constant Language_Index :=
First_Language_Index;
C_Language_Index : constant Language_Index :=
Ada_Language_Index + 1;
C_Plus_Plus_Language_Index : constant Language_Index :=
C_Language_Index + 1;
Last_Language_Index : Language_Index := No_Language_Index;
subtype First_Language_Indexes is Language_Index
range First_Language_Index .. First_Language_Indexes_Last;
type Header_Num is range 0 .. 2047;
function Hash is new System.HTable.Hash (Header_Num => Header_Num);
function Hash (Name : Name_Id) return Header_Num;
package Language_Indexes is new System.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Language_Index,
No_Element => No_Language_Index,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Mapping of language names to language indexes
package Language_Names is new Table.Table
(Table_Component_Type => Name_Id,
Table_Index_Type => Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100,
Table_Name => "Prj.Language_Names");
-- The table for the name of programming languages
type Programming_Language is procedure Add_Language_Name (Name : Name_Id);
(Lang_Ada, Lang_C, Lang_C_Plus_Plus);
-- The set of languages supported
subtype Other_Programming_Language is procedure Display_Language_Name (Language : Language_Index);
Programming_Language range Lang_C .. Programming_Language'Last;
-- The set of non-Ada languages supported
type Languages_In_Project is array (Programming_Language) of Boolean; type Languages_In_Project is array (First_Language_Indexes) of Boolean;
-- Set of supported languages used in a project -- Set of supported languages used in a project
No_Languages : constant Languages_In_Project := (others => False); No_Languages : constant Languages_In_Project := (others => False);
-- No supported languages are used -- No supported languages are used
type Impl_Suffix_Array is array (Programming_Language) of Name_Id; type Supp_Language_Index is new Nat;
No_Supp_Language_Index : constant Supp_Language_Index := 0;
type Supp_Language is record
Index : Language_Index := No_Language_Index;
Present : Boolean := False;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Present_Languages is new Table.Table
(Table_Component_Type => Supp_Language,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100,
Table_Name => "Prj.Present_Languages");
-- The table for the presence of languages with an index that is outside
-- of First_Language_Indexes.
type Impl_Suffix_Array is array (First_Language_Indexes) of Name_Id;
-- Suffixes for the non spec sources of the different supported languages -- Suffixes for the non spec sources of the different supported languages
-- in a project. -- in a project.
No_Impl_Suffixes : constant Impl_Suffix_Array := (others => No_Name); No_Impl_Suffixes : constant Impl_Suffix_Array := (others => No_Name);
-- A default value for the non spec source suffixes -- A default value for the non spec source suffixes
Lang_Ada_Name : aliased String := "ada"; type Supp_Suffix is record
Lang_C_Name : aliased String := "c"; Index : Language_Index := No_Language_Index;
Lang_C_Plus_Plus_Name : aliased String := "c++"; Suffix : Name_Id := No_Name;
Lang_Names : constant array (Programming_Language) of String_Access := Next : Supp_Language_Index := No_Supp_Language_Index;
(Lang_Ada => Lang_Ada_Name 'Access, end record;
Lang_C => Lang_C_Name 'Access,
Lang_C_Plus_Plus => Lang_C_Plus_Plus_Name'Access); package Supp_Suffix_Table is new Table.Table
-- Names of the supported programming languages, to be used after switch (Table_Component_Type => Supp_Suffix,
-- -x when using a GCC compiler. Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Lang_Name_Ids : array (Programming_Language) of Name_Id; Table_Initial => 4,
-- Same as Lang_Names, but using Name_Id, instead of String_Access. Table_Increment => 100,
-- Initialized by Prj.Initialize. Table_Name => "Prj.Supp_Suffix_Table");
-- The table for the presence of languages with an index that is outside
Lang_Ada_Display_Name : aliased String := "Ada"; -- of First_Language_Indexes.
Lang_C_Display_Name : aliased String := "C";
Lang_C_Plus_Plus_Display_Name : aliased String := "C++"; type Language_Kind is (GNU, other);
Lang_Display_Names :
constant array (Programming_Language) of String_Access := type Name_List_Index is new Nat;
(Lang_Ada => Lang_Ada_Display_Name 'Access, No_Name_List : constant Name_List_Index := 0;
Lang_C => Lang_C_Display_Name 'Access,
Lang_C_Plus_Plus => Lang_C_Plus_Plus_Display_Name'Access); type Name_Node is record
-- Names of the supported programming languages, to be used for display Name : Name_Id := No_Name;
-- purposes. Next : Name_List_Index := No_Name_List;
end record;
Ada_Impl_Suffix : aliased String := ".adb";
C_Impl_Suffix : aliased String := ".c"; package Name_Lists is new Table.Table
C_Plus_Plus_Impl_Suffix : aliased String := ".cc"; (Table_Component_Type => Name_Node,
Lang_Suffixes : constant array (Programming_Language) of String_Access := Table_Index_Type => Name_List_Index,
(Lang_Ada => Ada_Impl_Suffix 'Access, Table_Low_Bound => 1,
Lang_C => C_Impl_Suffix 'Access, Table_Initial => 10,
Lang_C_Plus_Plus => C_Plus_Plus_Impl_Suffix'Access); Table_Increment => 100,
-- Default extension of the sources of the different languages. Table_Name => "Prj.Name_Lists");
-- The table for lists of names used in package Language_Processing
Lang_Suffix_Ids : array (Programming_Language) of Name_Id;
-- Same as Lang_Suffixes, but using Name_Id, instead of String_Access. type Language_Processing_Data is record
-- Initialized by Prj.Initialize. Compiler_Drivers : Name_List_Index := No_Name_List;
Compiler_Paths : Name_Id := No_Name;
Gnatmake_String : aliased String := "gnatmake"; Compiler_Kinds : Language_Kind := GNU;
Gcc_String : aliased String := "gcc"; Dependency_Options : Name_List_Index := No_Name_List;
G_Plus_Plus_String : aliased String := "g++"; Compute_Dependencies : Name_List_Index := No_Name_List;
Default_Compiler_Names : Include_Options : Name_List_Index := No_Name_List;
constant array (Programming_Language) of String_Access := Binder_Drivers : Name_Id := No_Name;
(Lang_Ada => Gnatmake_String 'Access, Binder_Driver_Paths : Name_Id := No_Name;
Lang_C => Gcc_String 'Access, end record;
Lang_C_Plus_Plus => G_Plus_Plus_String'Access);
-- Default names of the compilers for the supported languages. Default_Language_Processing_Data :
-- Used when no IDE'Compiler_Command is specified for a language. constant Language_Processing_Data :=
-- For Ada, specify the gnatmake executable. (Compiler_Drivers => No_Name_List,
Compiler_Paths => No_Name,
Ada_Args_Strings : aliased String := ""; Compiler_Kinds => GNU,
C_Args_String : aliased String := "c"; Dependency_Options => No_Name_List,
C_Plus_Plus_Args_String : aliased String := "xx"; Compute_Dependencies => No_Name_List,
Lang_Args : constant array (Programming_Language) of String_Access := Include_Options => No_Name_List,
(Lang_Ada => Ada_Args_Strings 'Access, Binder_Drivers => No_Name,
Lang_C => C_Args_String 'Access, Binder_Driver_Paths => No_Name);
Lang_C_Plus_Plus => C_Plus_Plus_Args_String'Access);
-- For each supported language, the string between "-c" and "args" to type First_Language_Processing_Data is
-- be used in the gprmake switch for the start of the compiling switch array (First_Language_Indexes) of Language_Processing_Data;
-- section for each supported language. For example, "-ccargs" indicates
-- the start of the C compiler switch section. Default_First_Language_Processing_Data : First_Language_Processing_Data :=
(others => Default_Language_Processing_Data);
type Supp_Language_Data is record
Index : Language_Index := No_Language_Index;
Data : Language_Processing_Data := Default_Language_Processing_Data;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Supp_Languages is new Table.Table
(Table_Component_Type => Supp_Language_Data,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100,
Table_Name => "Prj.Supp_Languages");
-- The table for language data when there are more languages than
-- in First_Language_Indexes.
type Other_Source_Id is new Nat; type Other_Source_Id is new Nat;
No_Other_Source : constant Other_Source_Id := 0; No_Other_Source : constant Other_Source_Id := 0;
type Other_Source is record type Other_Source is record
Language : Programming_Language; -- language of the source Language : Language_Index; -- language of the source
File_Name : Name_Id; -- source file simple name File_Name : Name_Id; -- source file simple name
Path_Name : Name_Id; -- source full path name Path_Name : Name_Id; -- source full path name
Source_TS : Time_Stamp_Type; -- source file time stamp Source_TS : Time_Stamp_Type; -- source file time stamp
...@@ -375,8 +448,6 @@ package Prj is ...@@ -375,8 +448,6 @@ package Prj is
-- The following record contains data for a naming scheme -- The following record contains data for a naming scheme
type Naming_Data is record type Naming_Data is record
Current_Language : Name_Id := No_Name;
-- The programming language being currently considered
Dot_Replacement : Name_Id := No_Name; Dot_Replacement : Name_Id := No_Name;
-- The string to replace '.' in the source file name (for Ada). -- The string to replace '.' in the source file name (for Ada).
...@@ -393,24 +464,28 @@ package Prj is ...@@ -393,24 +464,28 @@ package Prj is
-- source file name of a spec. -- source file name of a spec.
-- Indexed by the programming language. -- Indexed by the programming language.
Current_Spec_Suffix : Name_Id := No_Name; Ada_Spec_Suffix : Name_Id := No_Name;
-- The "spec" suffix of the current programming language -- The suffix of the Ada spec sources
Spec_Suffix_Loc : Source_Ptr := No_Location; Spec_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where -- The position in the project file source where
-- Current_Spec_Suffix is defined. -- Ada_Spec_Suffix is defined.
Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
Supp_Suffixes : Supp_Language_Index := No_Supp_Language_Index;
-- The source suffixes of the different languages
Body_Suffix : Array_Element_Id := No_Array_Element; Body_Suffix : Array_Element_Id := No_Array_Element;
-- The string to append to the unit name for the -- The string to append to the unit name for the
-- source file name of a body. -- source file name of a body.
-- Indexed by the programming language. -- Indexed by the programming language.
Current_Body_Suffix : Name_Id := No_Name; Ada_Body_Suffix : Name_Id := No_Name;
-- The "body" suffix of the current programming language -- The suffix of the Ada body sources
Body_Suffix_Loc : Source_Ptr := No_Location; Body_Suffix_Loc : Source_Ptr := No_Location;
-- The position in the project file source where -- The position in the project file source where
-- Current_Body_Suffix is defined. -- Ada_Body_Suffix is defined.
Separate_Suffix : Name_Id := No_Name; Separate_Suffix : Name_Id := No_Name;
-- String to append to unit name for source file name of an Ada subunit. -- String to append to unit name for source file name of an Ada subunit.
...@@ -441,8 +516,7 @@ package Prj is ...@@ -441,8 +516,7 @@ package Prj is
-- The standard GNAT naming scheme -- The standard GNAT naming scheme
function Same_Naming_Scheme function Same_Naming_Scheme
(Left, Right : Naming_Data) (Left, Right : Naming_Data) return Boolean;
return Boolean;
-- Returns True if Left and Right are the same naming scheme -- Returns True if Left and Right are the same naming scheme
-- not considering Specs and Bodies. -- not considering Specs and Bodies.
...@@ -469,12 +543,12 @@ package Prj is ...@@ -469,12 +543,12 @@ package Prj is
-- The following record describes a project file representation -- The following record describes a project file representation
type Project_Data is record type Project_Data is record
Externally_Built : Boolean := False;
Languages : Languages_In_Project := No_Languages; Languages : Languages_In_Project := No_Languages;
Supp_Languages : Supp_Language_Index := No_Supp_Language_Index;
-- Indicate the different languages of the source of this project -- Indicate the different languages of the source of this project
Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
-- The source suffixes of the different languages other than Ada
First_Referred_By : Project_Id := No_Project; First_Referred_By : Project_Id := No_Project;
-- The project, if any, that was the first to be known -- The project, if any, that was the first to be known
-- as importing or extending this project. -- as importing or extending this project.
...@@ -498,7 +572,7 @@ package Prj is ...@@ -498,7 +572,7 @@ package Prj is
-- project. Set by Prj.Proc.Process. -- project. Set by Prj.Proc.Process.
Mains : String_List_Id := Nil_String; Mains : String_List_Id := Nil_String;
-- List of mains specified by attribute Main. Set by Prj.Nmsc.Ada_Check. -- List of mains specified by attribute Main. Set by Prj.Nmsc.Check.
Directory : Name_Id := No_Name; Directory : Name_Id := No_Name;
-- Directory where the project file resides. Set by Prj.Proc.Process. -- Directory where the project file resides. Set by Prj.Proc.Process.
...@@ -548,11 +622,11 @@ package Prj is ...@@ -548,11 +622,11 @@ package Prj is
Standalone_Library : Boolean := False; Standalone_Library : Boolean := False;
-- Indicate that this is a Standalone Library Project File. -- Indicate that this is a Standalone Library Project File.
-- Set by Prj.Nmsc.Ada_Check. -- Set by Prj.Nmsc.Check.
Lib_Interface_ALIs : String_List_Id := Nil_String; Lib_Interface_ALIs : String_List_Id := Nil_String;
-- For Standalone Library Project Files, indicate the list -- For Standalone Library Project Files, indicate the list
-- of Interface ALI files. Set by Prj.Nmsc.Ada_Check. -- of Interface ALI files. Set by Prj.Nmsc.Check.
Lib_Auto_Init : Boolean := False; Lib_Auto_Init : Boolean := False;
-- For non static Standalone Library Project Files, indicate if -- For non static Standalone Library Project Files, indicate if
...@@ -629,6 +703,15 @@ package Prj is ...@@ -629,6 +703,15 @@ package Prj is
-- The naming scheme of this project file. -- The naming scheme of this project file.
-- Set by Prj.Nmsc.Check_Naming_Scheme. -- Set by Prj.Nmsc.Check_Naming_Scheme.
First_Language_Processing : First_Language_Processing_Data :=
Default_First_Language_Processing_Data;
Supp_Language_Processing : Supp_Language_Index :=
No_Supp_Language_Index;
Default_Linker : Name_Id := No_Name;
Default_Linker_Path : Name_Id := No_Name;
Decl : Declarations := No_Declarations; Decl : Declarations := No_Declarations;
-- The declarations (variables, attributes and packages) of this -- The declarations (variables, attributes and packages) of this
-- project file. Set by Prj.Proc.Process. -- project file. Set by Prj.Proc.Process.
...@@ -699,6 +782,44 @@ package Prj is ...@@ -699,6 +782,44 @@ package Prj is
end record; end record;
function Is_Present
(Language : Language_Index;
In_Project : Project_Data) return Boolean;
-- Return True when Language is one of the languages used in
-- project Project.
procedure Set
(Language : Language_Index;
Present : Boolean;
In_Project : in out Project_Data);
-- Indicate if Language is or not a language used in project Project
function Language_Processing_Data_Of
(Language : Language_Index;
In_Project : Project_Data) return Language_Processing_Data;
-- Return the Language_Processing_Data for language Language in project
-- In_Project. Return the default when no Language_Processing_Data are
-- defined for the language.
procedure Set
(Language_Processing : Language_Processing_Data;
For_Language : Language_Index;
In_Project : in out Project_Data);
-- Set the Language_Processing_Data for language Language in project
-- In_Project.
function Suffix_Of
(Language : Language_Index;
In_Project : Project_Data) return Name_Id;
-- Return the suffix for language Language in project In_Project. Return
-- No_Name when no suffix is defined for the language.
procedure Set
(Suffix : Name_Id;
For_Language : Language_Index;
In_Project : in out Project_Data);
-- Set the suffix for language Language in project In_Project
Project_Error : exception; Project_Error : exception;
-- Raised by some subprograms in Prj.Attr. -- Raised by some subprograms in Prj.Attr.
......
...@@ -626,16 +626,24 @@ package body Snames is ...@@ -626,16 +626,24 @@ package body Snames is
"requeue#" & "requeue#" &
"tagged#" & "tagged#" &
"raise_exception#" & "raise_exception#" &
"ada_roots#" &
"binder#" & "binder#" &
"binder_driver#" &
"body_suffix#" & "body_suffix#" &
"builder#" & "builder#" &
"compiler#" & "compiler#" &
"compiler_driver#" &
"compiler_kind#" &
"compute_dependency#" &
"cross_reference#" & "cross_reference#" &
"default_linker#" &
"default_switches#" & "default_switches#" &
"dependency_option#" &
"exec_dir#" & "exec_dir#" &
"executable#" & "executable#" &
"executable_suffix#" & "executable_suffix#" &
"extends#" & "extends#" &
"externally_built#" &
"finder#" & "finder#" &
"global_configuration_pragmas#" & "global_configuration_pragmas#" &
"gnatls#" & "gnatls#" &
...@@ -643,6 +651,8 @@ package body Snames is ...@@ -643,6 +651,8 @@ package body Snames is
"implementation#" & "implementation#" &
"implementation_exceptions#" & "implementation_exceptions#" &
"implementation_suffix#" & "implementation_suffix#" &
"include_option#" &
"language_processing#" &
"languages#" & "languages#" &
"library_dir#" & "library_dir#" &
"library_auto_init#" & "library_auto_init#" &
......
...@@ -921,64 +921,75 @@ package Snames is ...@@ -921,64 +921,75 @@ package Snames is
Name_Raise_Exception : constant Name_Id := N + 568; Name_Raise_Exception : constant Name_Id := N + 568;
-- Additional reserved words in GNAT Project Files -- Additional reserved words and identifiers used in GNAT Project Files
-- Note that Name_External is already previously declared -- Note that Name_External is already previously declared
Name_Binder : constant Name_Id := N + 569; Name_Ada_Roots : constant Name_Id := N + 569;
Name_Body_Suffix : constant Name_Id := N + 570; Name_Binder : constant Name_Id := N + 570;
Name_Builder : constant Name_Id := N + 571; Name_Binder_Driver : constant Name_Id := N + 571;
Name_Compiler : constant Name_Id := N + 572; Name_Body_Suffix : constant Name_Id := N + 572;
Name_Cross_Reference : constant Name_Id := N + 573; Name_Builder : constant Name_Id := N + 573;
Name_Default_Switches : constant Name_Id := N + 574; Name_Compiler : constant Name_Id := N + 574;
Name_Exec_Dir : constant Name_Id := N + 575; Name_Compiler_Driver : constant Name_Id := N + 575;
Name_Executable : constant Name_Id := N + 576; Name_Compiler_Kind : constant Name_Id := N + 576;
Name_Executable_Suffix : constant Name_Id := N + 577; Name_Compute_Dependency : constant Name_Id := N + 577;
Name_Extends : constant Name_Id := N + 578; Name_Cross_Reference : constant Name_Id := N + 578;
Name_Finder : constant Name_Id := N + 579; Name_Default_Linker : constant Name_Id := N + 579;
Name_Global_Configuration_Pragmas : constant Name_Id := N + 580; Name_Default_Switches : constant Name_Id := N + 580;
Name_Gnatls : constant Name_Id := N + 581; Name_Dependency_Option : constant Name_Id := N + 581;
Name_Gnatstub : constant Name_Id := N + 582; Name_Exec_Dir : constant Name_Id := N + 582;
Name_Implementation : constant Name_Id := N + 583; Name_Executable : constant Name_Id := N + 583;
Name_Implementation_Exceptions : constant Name_Id := N + 584; Name_Executable_Suffix : constant Name_Id := N + 584;
Name_Implementation_Suffix : constant Name_Id := N + 585; Name_Extends : constant Name_Id := N + 585;
Name_Languages : constant Name_Id := N + 586; Name_Externally_Built : constant Name_Id := N + 586;
Name_Library_Dir : constant Name_Id := N + 587; Name_Finder : constant Name_Id := N + 587;
Name_Library_Auto_Init : constant Name_Id := N + 588; Name_Global_Configuration_Pragmas : constant Name_Id := N + 588;
Name_Library_GCC : constant Name_Id := N + 589; Name_Gnatls : constant Name_Id := N + 589;
Name_Library_Interface : constant Name_Id := N + 590; Name_Gnatstub : constant Name_Id := N + 590;
Name_Library_Kind : constant Name_Id := N + 591; Name_Implementation : constant Name_Id := N + 591;
Name_Library_Name : constant Name_Id := N + 592; Name_Implementation_Exceptions : constant Name_Id := N + 592;
Name_Library_Options : constant Name_Id := N + 593; Name_Implementation_Suffix : constant Name_Id := N + 593;
Name_Library_Reference_Symbol_File : constant Name_Id := N + 594; Name_Include_Option : constant Name_Id := N + 594;
Name_Library_Src_Dir : constant Name_Id := N + 595; Name_Language_Processing : constant Name_Id := N + 595;
Name_Library_Symbol_File : constant Name_Id := N + 596; Name_Languages : constant Name_Id := N + 596;
Name_Library_Symbol_Policy : constant Name_Id := N + 597; Name_Library_Dir : constant Name_Id := N + 597;
Name_Library_Version : constant Name_Id := N + 598; Name_Library_Auto_Init : constant Name_Id := N + 598;
Name_Linker : constant Name_Id := N + 599; Name_Library_GCC : constant Name_Id := N + 599;
Name_Local_Configuration_Pragmas : constant Name_Id := N + 600; Name_Library_Interface : constant Name_Id := N + 600;
Name_Locally_Removed_Files : constant Name_Id := N + 601; Name_Library_Kind : constant Name_Id := N + 601;
Name_Metrics : constant Name_Id := N + 602; Name_Library_Name : constant Name_Id := N + 602;
Name_Naming : constant Name_Id := N + 603; Name_Library_Options : constant Name_Id := N + 603;
Name_Object_Dir : constant Name_Id := N + 604; Name_Library_Reference_Symbol_File : constant Name_Id := N + 604;
Name_Pretty_Printer : constant Name_Id := N + 605; Name_Library_Src_Dir : constant Name_Id := N + 605;
Name_Project : constant Name_Id := N + 606; Name_Library_Symbol_File : constant Name_Id := N + 606;
Name_Separate_Suffix : constant Name_Id := N + 607; Name_Library_Symbol_Policy : constant Name_Id := N + 607;
Name_Source_Dirs : constant Name_Id := N + 608; Name_Library_Version : constant Name_Id := N + 608;
Name_Source_Files : constant Name_Id := N + 609; Name_Linker : constant Name_Id := N + 609;
Name_Source_List_File : constant Name_Id := N + 610; Name_Local_Configuration_Pragmas : constant Name_Id := N + 610;
Name_Spec : constant Name_Id := N + 611; Name_Locally_Removed_Files : constant Name_Id := N + 611;
Name_Spec_Suffix : constant Name_Id := N + 612; Name_Metrics : constant Name_Id := N + 612;
Name_Specification : constant Name_Id := N + 613; Name_Naming : constant Name_Id := N + 613;
Name_Specification_Exceptions : constant Name_Id := N + 614; Name_Object_Dir : constant Name_Id := N + 614;
Name_Specification_Suffix : constant Name_Id := N + 615; Name_Pretty_Printer : constant Name_Id := N + 615;
Name_Switches : constant Name_Id := N + 616; Name_Project : constant Name_Id := N + 616;
Name_Separate_Suffix : constant Name_Id := N + 617;
Name_Source_Dirs : constant Name_Id := N + 618;
Name_Source_Files : constant Name_Id := N + 619;
Name_Source_List_File : constant Name_Id := N + 620;
Name_Spec : constant Name_Id := N + 621;
Name_Spec_Suffix : constant Name_Id := N + 622;
Name_Specification : constant Name_Id := N + 623;
Name_Specification_Exceptions : constant Name_Id := N + 624;
Name_Specification_Suffix : constant Name_Id := N + 625;
Name_Switches : constant Name_Id := N + 626;
-- Other miscellaneous names used in front end -- Other miscellaneous names used in front end
Name_Unaligned_Valid : constant Name_Id := N + 617; Name_Unaligned_Valid : constant Name_Id := N + 627;
-- Mark last defined name for consistency check in Snames body -- Mark last defined name for consistency check in Snames body
Last_Predefined_Name : constant Name_Id := N + 617; Last_Predefined_Name : constant Name_Id := N + 627;
subtype Any_Operator_Name is Name_Id range subtype Any_Operator_Name is Name_Id range
First_Operator_Name .. Last_Operator_Name; First_Operator_Name .. Last_Operator_Name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment