Commit bd0a4cab by Emmanuel Briot Committed by Arnaud Charlet

2009-04-29 Emmanuel Briot <briot@adacore.com>

	* gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb,
	prj-part.ads, prj.adb, prj.ads, clean.adb, prj-dect.adb, prj-dect.ads,
	prj-nmsc.adb, prj-nmsc.ads, prj-pars.adb, prj-pars.ads, prj-makr.adb
	(Set_In_Configuration, In_Configuration): Removed.
	Replaced by an extra parameter Is_Config_File in several parameter to
	avoid global variables to store the state of the parser.

From-SVN: r146955
parent 69cb258c
2009-04-29 Emmanuel Briot <briot@adacore.com>
* gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb,
prj-part.ads, prj.adb, prj.ads, clean.adb, prj-dect.adb, prj-dect.ads,
prj-nmsc.adb, prj-nmsc.ads, prj-pars.adb, prj-pars.ads, prj-makr.adb
(Set_In_Configuration, In_Configuration): Removed.
Replaced by an extra parameter Is_Config_File in several parameter to
avoid global variables to store the state of the parser.
2009-04-29 Ed Schonberg <schonberg@adacore.com> 2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sinfo.ads, sinfo.adb: New attribute Next_Implicit_With, to chain * sinfo.ads, sinfo.adb: New attribute Next_Implicit_With, to chain
......
...@@ -1373,7 +1373,8 @@ package body Clean is ...@@ -1373,7 +1373,8 @@ package body Clean is
(Project => Main_Project, (Project => Main_Project,
In_Tree => Project_Tree, In_Tree => Project_Tree,
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,
Is_Config_File => False);
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");
......
...@@ -1884,7 +1884,8 @@ begin ...@@ -1884,7 +1884,8 @@ begin
(Project => Project, (Project => Project,
In_Tree => Project_Tree, In_Tree => Project_Tree,
Project_File_Name => Project_File.all, Project_File_Name => Project_File.all,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => False);
if Project = Prj.No_Project then if Project = Prj.No_Project then
Fail ("""" & Project_File.all & """ processing failed"); Fail ("""" & Project_File.all & """ processing failed");
......
...@@ -6843,7 +6843,8 @@ package body Make is ...@@ -6843,7 +6843,8 @@ package body Make is
(Project => Main_Project, (Project => Main_Project,
In_Tree => Project_Tree, In_Tree => Project_Tree,
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,
Is_Config_File => False);
-- The parsing of project files may have changed the current output -- The parsing of project files may have changed the current output
......
...@@ -63,7 +63,8 @@ package body Prj.Dect is ...@@ -63,7 +63,8 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id; First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id; Current_Package : Project_Node_Id;
Packages_To_Check : String_List_Access); Packages_To_Check : String_List_Access;
Is_Config_File : Boolean);
-- Parse a case construction -- Parse a case construction
procedure Parse_Declarative_Items procedure Parse_Declarative_Items
...@@ -73,16 +74,22 @@ package body Prj.Dect is ...@@ -73,16 +74,22 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id; First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id; Current_Package : Project_Node_Id;
Packages_To_Check : String_List_Access); Packages_To_Check : String_List_Access;
Is_Config_File : Boolean);
-- Parse declarative items. Depending on In_Zone, some declarative -- Parse declarative items. Depending on In_Zone, some declarative
-- items may be forbidden. -- items may be forbidden.
-- Is_Config_File should be set to True if the project represents a config
-- file (.cgpr) since some specific checks apply.
procedure Parse_Package_Declaration procedure Parse_Package_Declaration
(In_Tree : Project_Node_Tree_Ref; (In_Tree : Project_Node_Tree_Ref;
Package_Declaration : out Project_Node_Id; Package_Declaration : out Project_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Packages_To_Check : String_List_Access); Packages_To_Check : String_List_Access;
-- Parse a package declaration Is_Config_File : Boolean);
-- Parse a package declaration.
-- Is_Config_File should be set to True if the project represents a config
-- file (.cgpr) since some specific checks apply.
procedure Parse_String_Type_Declaration procedure Parse_String_Type_Declaration
(In_Tree : Project_Node_Tree_Ref; (In_Tree : Project_Node_Tree_Ref;
...@@ -108,7 +115,8 @@ package body Prj.Dect is ...@@ -108,7 +115,8 @@ package body Prj.Dect is
Declarations : out Project_Node_Id; Declarations : out Project_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Extends : Project_Node_Id; Extends : Project_Node_Id;
Packages_To_Check : String_List_Access) Packages_To_Check : String_List_Access;
Is_Config_File : Boolean)
is is
First_Declarative_Item : Project_Node_Id := Empty_Node; First_Declarative_Item : Project_Node_Id := Empty_Node;
...@@ -126,7 +134,8 @@ package body Prj.Dect is ...@@ -126,7 +134,8 @@ package body Prj.Dect is
First_Attribute => Prj.Attr.Attribute_First, First_Attribute => Prj.Attr.Attribute_First,
Current_Project => Current_Project, Current_Project => Current_Project,
Current_Package => Empty_Node, Current_Package => Empty_Node,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => Is_Config_File);
Set_First_Declarative_Item_Of Set_First_Declarative_Item_Of
(Declarations, In_Tree, To => First_Declarative_Item); (Declarations, In_Tree, To => First_Declarative_Item);
end Parse; end Parse;
...@@ -605,7 +614,8 @@ package body Prj.Dect is ...@@ -605,7 +614,8 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id; First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id; Current_Package : Project_Node_Id;
Packages_To_Check : String_List_Access) Packages_To_Check : String_List_Access;
Is_Config_File : Boolean)
is is
Current_Item : Project_Node_Id := Empty_Node; Current_Item : Project_Node_Id := Empty_Node;
Next_Item : Project_Node_Id := Empty_Node; Next_Item : Project_Node_Id := Empty_Node;
...@@ -728,7 +738,8 @@ package body Prj.Dect is ...@@ -728,7 +738,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute, First_Attribute => First_Attribute,
Current_Project => Current_Project, Current_Project => Current_Project,
Current_Package => Current_Package, Current_Package => Current_Package,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => Is_Config_File);
-- "when others =>" must be the last branch, so save the -- "when others =>" must be the last branch, so save the
-- Case_Item and exit -- Case_Item and exit
...@@ -754,7 +765,8 @@ package body Prj.Dect is ...@@ -754,7 +765,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute, First_Attribute => First_Attribute,
Current_Project => Current_Project, Current_Project => Current_Project,
Current_Package => Current_Package, Current_Package => Current_Package,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => Is_Config_File);
Set_First_Declarative_Item_Of Set_First_Declarative_Item_Of
(Current_Item, In_Tree, To => First_Declarative_Item); (Current_Item, In_Tree, To => First_Declarative_Item);
...@@ -799,7 +811,8 @@ package body Prj.Dect is ...@@ -799,7 +811,8 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id; First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id; Current_Package : Project_Node_Id;
Packages_To_Check : String_List_Access) Packages_To_Check : String_List_Access;
Is_Config_File : Boolean)
is is
Current_Declarative_Item : Project_Node_Id := Empty_Node; Current_Declarative_Item : Project_Node_Id := Empty_Node;
Next_Declarative_Item : Project_Node_Id := Empty_Node; Next_Declarative_Item : Project_Node_Id := Empty_Node;
...@@ -893,7 +906,8 @@ package body Prj.Dect is ...@@ -893,7 +906,8 @@ package body Prj.Dect is
(In_Tree => In_Tree, (In_Tree => In_Tree,
Package_Declaration => Current_Declaration, Package_Declaration => Current_Declaration,
Current_Project => Current_Project, Current_Project => Current_Project,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => Is_Config_File);
Set_Previous_End_Node (Current_Declaration); Set_Previous_End_Node (Current_Declaration);
...@@ -924,7 +938,8 @@ package body Prj.Dect is ...@@ -924,7 +938,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute, First_Attribute => First_Attribute,
Current_Project => Current_Project, Current_Project => Current_Project,
Current_Package => Current_Package, Current_Package => Current_Package,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => Is_Config_File);
Set_Previous_End_Node (Current_Declaration); Set_Previous_End_Node (Current_Declaration);
...@@ -977,7 +992,8 @@ package body Prj.Dect is ...@@ -977,7 +992,8 @@ package body Prj.Dect is
(In_Tree : Project_Node_Tree_Ref; (In_Tree : Project_Node_Tree_Ref;
Package_Declaration : out Project_Node_Id; Package_Declaration : out Project_Node_Id;
Current_Project : Project_Node_Id; Current_Project : Project_Node_Id;
Packages_To_Check : String_List_Access) Packages_To_Check : String_List_Access;
Is_Config_File : Boolean)
is is
First_Attribute : Attribute_Node_Id := Empty_Attribute; First_Attribute : Attribute_Node_Id := Empty_Attribute;
Current_Package : Package_Node_Id := Empty_Package; Current_Package : Package_Node_Id := Empty_Package;
...@@ -1101,7 +1117,7 @@ package body Prj.Dect is ...@@ -1101,7 +1117,7 @@ package body Prj.Dect is
end if; end if;
if Token = Tok_Renames then if Token = Tok_Renames then
if In_Configuration then if Is_Config_File then
Error_Msg Error_Msg
("no package renames in configuration projects", Token_Ptr); ("no package renames in configuration projects", Token_Ptr);
end if; end if;
...@@ -1216,7 +1232,8 @@ package body Prj.Dect is ...@@ -1216,7 +1232,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute, First_Attribute => First_Attribute,
Current_Project => Current_Project, Current_Project => Current_Project,
Current_Package => Package_Declaration, Current_Package => Package_Declaration,
Packages_To_Check => Packages_To_Check); Packages_To_Check => Packages_To_Check,
Is_Config_File => Is_Config_File);
Set_First_Declarative_Item_Of Set_First_Declarative_Item_Of
(Package_Declaration, In_Tree, To => First_Declarative_Item); (Package_Declaration, In_Tree, To => First_Declarative_Item);
......
...@@ -34,7 +34,8 @@ private package Prj.Dect is ...@@ -34,7 +34,8 @@ private package Prj.Dect is
Declarations : out Prj.Tree.Project_Node_Id; Declarations : out Prj.Tree.Project_Node_Id;
Current_Project : Prj.Tree.Project_Node_Id; Current_Project : Prj.Tree.Project_Node_Id;
Extends : Prj.Tree.Project_Node_Id; Extends : Prj.Tree.Project_Node_Id;
Packages_To_Check : String_List_Access); Packages_To_Check : String_List_Access;
Is_Config_File : Boolean);
-- Parse project declarative items -- Parse project declarative items
-- --
-- In_Tree is the project node tree -- In_Tree is the project node tree
...@@ -52,5 +53,8 @@ private package Prj.Dect is ...@@ -52,5 +53,8 @@ private package Prj.Dect is
-- For legal packages declared in project Current_Project that are not in -- For legal packages declared in project Current_Project that are not in
-- Packages_To_Check, only the syntax of the declarations are checked, not -- Packages_To_Check, only the syntax of the declarations are checked, not
-- the attribute names and kinds. -- the attribute names and kinds.
--
-- Is_Config_File should be set to True if the project represents a config
-- file (.cgpr) since some specific checks apply.
end Prj.Dect; end Prj.Dect;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2009, 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- --
...@@ -845,6 +845,7 @@ package body Prj.Makr is ...@@ -845,6 +845,7 @@ package body Prj.Makr is
Project_File_Name => Output_Name.all, Project_File_Name => Output_Name.all,
Always_Errout_Finalize => False, Always_Errout_Finalize => False,
Store_Comments => True, Store_Comments => True,
Is_Config_File => False,
Current_Directory => Get_Current_Dir, Current_Directory => Get_Current_Dir,
Packages_To_Check => Packages_To_Check_By_Gnatname); Packages_To_Check => Packages_To_Check_By_Gnatname);
......
...@@ -273,9 +273,11 @@ package body Prj.Nmsc is ...@@ -273,9 +273,11 @@ package body Prj.Nmsc is
-- Check that a name is a valid Ada unit name -- Check that a name is a valid Ada unit name
procedure Check_Naming_Schemes procedure Check_Naming_Schemes
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref); In_Tree : Project_Tree_Ref;
-- Check the naming scheme part of Data Is_Config_File : Boolean);
-- Check the naming scheme part of Data.
-- Is_Config_File should be True if Project is a config file (.cgpr)
procedure Check_Configuration procedure Check_Configuration
(Project : Project_Id; (Project : Project_Id;
...@@ -788,7 +790,8 @@ package body Prj.Nmsc is ...@@ -788,7 +790,8 @@ package body Prj.Nmsc is
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning; When_No_Sources : Error_Warning;
Current_Dir : String; Current_Dir : String;
Proc_Data : in out Processing_Data) Proc_Data : in out Processing_Data;
Is_Config_File : Boolean)
is is
Extending : Boolean := False; Extending : Boolean := False;
...@@ -836,7 +839,7 @@ package body Prj.Nmsc is ...@@ -836,7 +839,7 @@ package body Prj.Nmsc is
Extending := Project.Extends /= No_Project; Extending := Project.Extends /= No_Project;
Check_Naming_Schemes (Project, In_Tree); Check_Naming_Schemes (Project, In_Tree, Is_Config_File);
if Get_Mode = Ada_Only then if Get_Mode = Ada_Only then
Prepare_Ada_Naming_Exceptions Prepare_Ada_Naming_Exceptions
...@@ -2635,8 +2638,9 @@ package body Prj.Nmsc is ...@@ -2635,8 +2638,9 @@ package body Prj.Nmsc is
-------------------------- --------------------------
procedure Check_Naming_Schemes procedure Check_Naming_Schemes
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref) In_Tree : Project_Tree_Ref;
Is_Config_File : Boolean)
is is
Naming_Id : constant Package_Id := Naming_Id : constant Package_Id :=
Util.Value_Of (Name_Naming, Project.Decl.Packages, In_Tree); Util.Value_Of (Name_Naming, Project.Decl.Packages, In_Tree);
...@@ -3316,7 +3320,7 @@ package body Prj.Nmsc is ...@@ -3316,7 +3320,7 @@ package body Prj.Nmsc is
begin begin
-- No Naming package or parsing a configuration file? nothing to do -- No Naming package or parsing a configuration file? nothing to do
if Naming_Id /= No_Package and not In_Configuration then if Naming_Id /= No_Package and not Is_Config_File then
Naming := In_Tree.Packages.Table (Naming_Id); Naming := In_Tree.Packages.Table (Naming_Id);
if Current_Verbosity = High then if Current_Verbosity = High then
...@@ -4366,7 +4370,7 @@ package body Prj.Nmsc is ...@@ -4366,7 +4370,7 @@ package body Prj.Nmsc is
Error_Msg Error_Msg
(Project, (Project,
In_Tree, In_Tree,
"a standard project cannot have no language declared", "a standard project must have at least one language",
Languages.Location); Languages.Location);
end if; end if;
......
...@@ -46,7 +46,8 @@ private package Prj.Nmsc is ...@@ -46,7 +46,8 @@ private package Prj.Nmsc is
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning; When_No_Sources : Error_Warning;
Current_Dir : String; Current_Dir : String;
Proc_Data : in out Processing_Data); Proc_Data : in out Processing_Data;
Is_Config_File : Boolean);
-- Perform consistency and semantic checks on a project, starting from the -- Perform consistency and semantic checks on a project, starting from the
-- project tree parsed from the .gpr file. This procedure interprets the -- project tree parsed from the .gpr file. This procedure interprets the
-- various case statements in the project based on the current environment -- various case statements in the project based on the current environment
...@@ -68,6 +69,8 @@ private package Prj.Nmsc is ...@@ -68,6 +69,8 @@ private package Prj.Nmsc is
-- --
-- When_No_Sources indicates what should be done when no sources of a -- When_No_Sources indicates what should be done when no sources of a
-- language are found in a project where this language is declared. -- language are found in a project where this language is declared.
--
-- Is_Config_File should be True if Project is config file (.cgpr)
private private
type Processing_Data is record type Processing_Data is record
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2009, 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- --
...@@ -45,7 +45,8 @@ package body Prj.Pars is ...@@ -45,7 +45,8 @@ package body Prj.Pars is
Project_File_Name : String; Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages; Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error; When_No_Sources : Error_Warning := Error;
Reset_Tree : Boolean := True) Reset_Tree : Boolean := True;
Is_Config_File : Boolean)
is is
Project_Node_Tree : constant Project_Node_Tree_Ref := Project_Node_Tree : constant Project_Node_Tree_Ref :=
new Project_Node_Tree_Data; new Project_Node_Tree_Data;
...@@ -66,7 +67,8 @@ package body Prj.Pars is ...@@ -66,7 +67,8 @@ package body Prj.Pars is
Project_File_Name => Project_File_Name, Project_File_Name => Project_File_Name,
Always_Errout_Finalize => False, Always_Errout_Finalize => False,
Packages_To_Check => Packages_To_Check, Packages_To_Check => Packages_To_Check,
Current_Directory => Current_Dir); Current_Directory => Current_Dir,
Is_Config_File => Is_Config_File);
-- If there were no error, process the tree -- If there were no error, process the tree
...@@ -80,7 +82,8 @@ package body Prj.Pars is ...@@ -80,7 +82,8 @@ package body Prj.Pars is
Report_Error => null, Report_Error => null,
When_No_Sources => When_No_Sources, When_No_Sources => When_No_Sources,
Reset_Tree => Reset_Tree, Reset_Tree => Reset_Tree,
Current_Dir => Current_Dir); Current_Dir => Current_Dir,
Is_Config_File => Is_Config_File);
Prj.Err.Finalize; Prj.Err.Finalize;
if not Success then if not Success then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- -- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- --
...@@ -36,7 +36,8 @@ package Prj.Pars is ...@@ -36,7 +36,8 @@ package Prj.Pars is
Project_File_Name : String; Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages; Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error; When_No_Sources : Error_Warning := Error;
Reset_Tree : Boolean := True); Reset_Tree : Boolean := True;
Is_Config_File : Boolean);
-- Parse a project files and all its imported project files, in the -- Parse a project files and all its imported project files, in the
-- project tree In_Tree. -- project tree In_Tree.
-- --
...@@ -53,5 +54,8 @@ package Prj.Pars is ...@@ -53,5 +54,8 @@ package Prj.Pars is
-- --
-- When Reset_Tree is True, all the project data are removed from the -- When Reset_Tree is True, all the project data are removed from the
-- project table before processing. -- project table before processing.
--
-- Is_Config_File should be set to True if the project represents a config
-- file (.cgpr) since some specific checks apply.
end Prj.Pars; end Prj.Pars;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2008, Free Software Foundation, Inc. -- -- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- --
...@@ -36,7 +36,8 @@ package Prj.Part is ...@@ -36,7 +36,8 @@ package Prj.Part is
Always_Errout_Finalize : Boolean; Always_Errout_Finalize : Boolean;
Packages_To_Check : String_List_Access := All_Packages; Packages_To_Check : String_List_Access := All_Packages;
Store_Comments : Boolean := False; Store_Comments : Boolean := False;
Current_Directory : String := ""); Current_Directory : String := "";
Is_Config_File : Boolean);
-- Parse project file and all its imported project files and create a tree. -- Parse project file and all its imported project files and create a tree.
-- Return the node for the project (or Empty_Node if parsing failed). If -- Return the node for the project (or Empty_Node if parsing failed). If
-- Always_Errout_Finalize is True, Errout.Finalize is called in all cases, -- Always_Errout_Finalize is True, Errout.Finalize is called in all cases,
...@@ -48,5 +49,8 @@ package Prj.Part is ...@@ -48,5 +49,8 @@ package Prj.Part is
-- --
-- Current_Directory is used for optimization purposes only, avoiding extra -- Current_Directory is used for optimization purposes only, avoiding extra
-- system calls. -- system calls.
--
-- Is_Config_File should be set to True if the project represents a config
-- file (.cgpr) since some specific checks apply.
end Prj.Part; end Prj.Part;
...@@ -82,10 +82,12 @@ package body Prj.Proc is ...@@ -82,10 +82,12 @@ package body Prj.Proc is
(In_Tree : Project_Tree_Ref; (In_Tree : Project_Tree_Ref;
Project : Project_Id; Project : Project_Id;
Current_Dir : String; Current_Dir : String;
When_No_Sources : Error_Warning); When_No_Sources : Error_Warning;
Is_Config_File : 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.
-- Current_Dir is for optimization purposes, avoiding extra system calls. -- Current_Dir is for optimization purposes, avoiding extra system calls.
-- Is_Config_File should be True if Project is a config file (.cgpr)
procedure Copy_Package_Declarations procedure Copy_Package_Declarations
(From : Declarations; (From : Declarations;
...@@ -149,6 +151,7 @@ package body Prj.Proc is ...@@ -149,6 +151,7 @@ package body Prj.Proc is
Current_Dir : String_Access; Current_Dir : String_Access;
When_No_Sources : Error_Warning; When_No_Sources : Error_Warning;
Proc_Data : Processing_Data; Proc_Data : Processing_Data;
Is_Config_File : Boolean;
end record; end record;
-- Data passed to Recursive_Check -- Data passed to Recursive_Check
-- Current_Dir is for optimization purposes, avoiding extra system calls. -- Current_Dir is for optimization purposes, avoiding extra system calls.
...@@ -279,7 +282,8 @@ package body Prj.Proc is ...@@ -279,7 +282,8 @@ package body Prj.Proc is
(In_Tree : Project_Tree_Ref; (In_Tree : Project_Tree_Ref;
Project : Project_Id; Project : Project_Id;
Current_Dir : String; Current_Dir : String;
When_No_Sources : Error_Warning) When_No_Sources : Error_Warning;
Is_Config_File : Boolean)
is is
Dir : aliased String := Current_Dir; Dir : aliased String := Current_Dir;
...@@ -292,6 +296,7 @@ package body Prj.Proc is ...@@ -292,6 +296,7 @@ package body Prj.Proc is
Data.In_Tree := In_Tree; Data.In_Tree := In_Tree;
Data.Current_Dir := Dir'Unchecked_Access; Data.Current_Dir := Dir'Unchecked_Access;
Data.When_No_Sources := When_No_Sources; Data.When_No_Sources := When_No_Sources;
Data.Is_Config_File := Is_Config_File;
Initialize (Data.Proc_Data); Initialize (Data.Proc_Data);
Check_All_Projects (Project, Data, Imported_First => True); Check_All_Projects (Project, Data, Imported_First => True);
...@@ -1231,7 +1236,8 @@ package body Prj.Proc is ...@@ -1231,7 +1236,8 @@ package body Prj.Proc is
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error; When_No_Sources : Error_Warning := Error;
Reset_Tree : Boolean := True; Reset_Tree : Boolean := True;
Current_Dir : String := "") Current_Dir : String := "";
Is_Config_File : Boolean)
is is
begin begin
Process_Project_Tree_Phase_1 Process_Project_Tree_Phase_1
...@@ -1243,7 +1249,7 @@ package body Prj.Proc is ...@@ -1243,7 +1249,7 @@ package body Prj.Proc is
Report_Error => Report_Error, Report_Error => Report_Error,
Reset_Tree => Reset_Tree); Reset_Tree => Reset_Tree);
if not In_Configuration then if not Is_Config_File then
Process_Project_Tree_Phase_2 Process_Project_Tree_Phase_2
(In_Tree => In_Tree, (In_Tree => In_Tree,
Project => Project, Project => Project,
...@@ -1252,7 +1258,8 @@ package body Prj.Proc is ...@@ -1252,7 +1258,8 @@ package body Prj.Proc is
From_Project_Node_Tree => From_Project_Node_Tree, From_Project_Node_Tree => From_Project_Node_Tree,
Report_Error => Report_Error, Report_Error => Report_Error,
When_No_Sources => When_No_Sources, When_No_Sources => When_No_Sources,
Current_Dir => Current_Dir); Current_Dir => Current_Dir,
Is_Config_File => Is_Config_File);
end if; end if;
end Process; end Process;
...@@ -2305,7 +2312,8 @@ package body Prj.Proc is ...@@ -2305,7 +2312,8 @@ package body Prj.Proc is
From_Project_Node_Tree : Project_Node_Tree_Ref; From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error; When_No_Sources : Error_Warning := Error;
Current_Dir : String) Current_Dir : String;
Is_Config_File : Boolean)
is is
Obj_Dir : Path_Name_Type; Obj_Dir : Path_Name_Type;
Extending : Project_Id; Extending : Project_Id;
...@@ -2319,7 +2327,8 @@ package body Prj.Proc is ...@@ -2319,7 +2327,8 @@ package body Prj.Proc is
Success := True; Success := True;
if Project /= No_Project then if Project /= No_Project then
Check (In_Tree, Project, Current_Dir, When_No_Sources); Check (In_Tree, Project, Current_Dir, When_No_Sources,
Is_Config_File => Is_Config_File);
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
...@@ -2442,7 +2451,8 @@ package body Prj.Proc is ...@@ -2442,7 +2451,8 @@ package body Prj.Proc is
Prj.Nmsc.Check Prj.Nmsc.Check
(Project, Data.In_Tree, Error_Report, Data.When_No_Sources, (Project, Data.In_Tree, Error_Report, Data.When_No_Sources,
Data.Current_Dir.all, Data.Proc_Data); Data.Current_Dir.all, Data.Proc_Data,
Is_Config_File => Data.Is_Config_File);
end Recursive_Check; end Recursive_Check;
----------------------- -----------------------
......
...@@ -40,7 +40,8 @@ package Prj.Proc is ...@@ -40,7 +40,8 @@ package Prj.Proc is
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error; When_No_Sources : Error_Warning := Error;
Reset_Tree : Boolean := True; Reset_Tree : Boolean := True;
Current_Dir : String := ""); Current_Dir : String := "";
Is_Config_File : Boolean);
-- Process a project file tree into project file data structures. If -- Process a project file tree into project file data structures. If
-- Report_Error is null, use the error reporting mechanism. Otherwise, -- Report_Error is null, use the error reporting mechanism. Otherwise,
-- report errors using Report_Error. -- report errors using Report_Error.
...@@ -54,10 +55,12 @@ package Prj.Proc is ...@@ -54,10 +55,12 @@ package Prj.Proc is
-- project table before processing. -- project table before processing.
-- --
-- Process is a bit of a junk name, how about Process_Project_Tree??? -- Process is a bit of a junk name, how about Process_Project_Tree???
--
-- The two procedures that follow are implementing procedure Process in -- The two procedures that follow are implementing procedure Process in
-- two successive phases. They are used by gprbuild/gprclean to add the -- two successive phases. They are used by gprbuild/gprclean to add the
-- configuration attributes between the two phases. -- configuration attributes between the two phases.
--
-- Is_Config_File should be true if Project is a config file (.cgpr)
procedure Process_Project_Tree_Phase_1 procedure Process_Project_Tree_Phase_1
(In_Tree : Project_Tree_Ref; (In_Tree : Project_Tree_Ref;
...@@ -77,7 +80,8 @@ package Prj.Proc is ...@@ -77,7 +80,8 @@ package Prj.Proc is
From_Project_Node_Tree : Project_Node_Tree_Ref; From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access; Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error; When_No_Sources : Error_Warning := Error;
Current_Dir : String); Current_Dir : String;
Is_Config_File : Boolean);
-- See documentation of parameters in procedure Process above -- See documentation of parameters in procedure Process above
end Prj.Proc; end Prj.Proc;
...@@ -49,8 +49,6 @@ package body Prj is ...@@ -49,8 +49,6 @@ package body Prj is
Current_Mode : Mode := Ada_Only; Current_Mode : Mode := Ada_Only;
Configuration_Mode : Boolean := False;
The_Empty_String : Name_Id; The_Empty_String : Name_Id;
Default_Ada_Spec_Suffix_Id : File_Name_Type; Default_Ada_Spec_Suffix_Id : File_Name_Type;
...@@ -600,15 +598,6 @@ package body Prj is ...@@ -600,15 +598,6 @@ package body Prj is
return The_Casing_Images (Casing).all; return The_Casing_Images (Casing).all;
end Image; end Image;
----------------------
-- In_Configuration --
----------------------
function In_Configuration return Boolean is
begin
return Configuration_Mode;
end In_Configuration;
---------------- ----------------
-- Initialize -- -- Initialize --
---------------- ----------------
...@@ -1059,15 +1048,6 @@ package body Prj is ...@@ -1059,15 +1048,6 @@ package body Prj is
In_Tree.Array_Elements.Table (Naming.Body_Suffix) := Element; In_Tree.Array_Elements.Table (Naming.Body_Suffix) := Element;
end Set_Body_Suffix; end Set_Body_Suffix;
--------------------------
-- Set_In_Configuration --
--------------------------
procedure Set_In_Configuration (Value : Boolean) is
begin
Configuration_Mode := Value;
end Set_In_Configuration;
-------------- --------------
-- Set_Mode -- -- Set_Mode --
-------------- --------------
......
...@@ -99,12 +99,6 @@ package Prj is ...@@ -99,12 +99,6 @@ package Prj is
-- can ignore such errors when they don't need to build directly. Calling -- can ignore such errors when they don't need to build directly. Calling
-- Set_Mode will reset this variable, default is for Ada_Only. -- Set_Mode will reset this variable, default is for Ada_Only.
function In_Configuration return Boolean;
pragma Inline (In_Configuration);
procedure Set_In_Configuration (Value : Boolean);
pragma Inline (Set_In_Configuration);
All_Packages : constant String_List_Access; All_Packages : constant String_List_Access;
-- Default value of parameter Packages of procedures Parse, in Prj.Pars and -- Default value of parameter Packages of procedures Parse, in Prj.Pars and
-- Prj.Part, indicating that all packages should be checked. -- Prj.Part, indicating that all packages should be checked.
...@@ -1121,7 +1115,8 @@ package Prj is ...@@ -1121,7 +1115,8 @@ package Prj is
Config : Project_Configuration; Config : Project_Configuration;
Path : Path_Information := No_Path_Information; Path : Path_Information := No_Path_Information;
-- The path name of the project file -- The path name of the project file. This include base name of the
-- project file
Virtual : Boolean := False; Virtual : Boolean := False;
-- True for virtual extending projects -- True for virtual extending projects
......
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