Commit 32404665 by Emmanuel Briot Committed by Arnaud Charlet

gnatcmd.adb, [...]: Minor reformatting.

2009-07-13  Emmanuel Briot  <briot@adacore.com>

	* gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb,
	prj.adb, prj.ads, clean.adb, prj-nmsc.adb, prj-nmsc.ads, prj-pars.adb,
	prj-pars.ads, prj-conf.adb, prj-conf.ads, prj-env.adb, prj-tree.adb,
	prj-tree.ads: Minor reformatting.
	(Processing_Flags): new record to encapsulate the set of common
	parameters to several subprograms in the project manager.
	(Prj.Nmsc.Process_Naming_Scheme): renames Check, and moved to body
	Remove the need for the Current_Dir parameter in subprograms.
	(Look_For_Sources): minor refactoring, now that we no longer need to
	share subprograms between the two Ada_Only and Multi_Language modes
	(Processing_Flags): New field Error_On_Unknown_Language.
	Merge tests for library project between gnatmake and gprbuild.

From-SVN: r149563
parent 959dd7d8
2009-07-13 Emmanuel Briot <briot@adacore.com>
* gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb,
prj.adb, prj.ads, clean.adb, prj-nmsc.adb, prj-nmsc.ads, prj-pars.adb,
prj-pars.ads, prj-conf.adb, prj-conf.ads, prj-env.adb, prj-tree.adb,
prj-tree.ads: Minor reformatting.
(Processing_Flags): new record to encapsulate the set of common
parameters to several subprograms in the project manager.
(Prj.Nmsc.Process_Naming_Scheme): renames Check, and moved to body
Remove the need for the Current_Dir parameter in subprograms.
(Look_For_Sources): minor refactoring, now that we no longer need to
share subprograms between the two Ada_Only and Multi_Language modes
(Processing_Flags): New field Error_On_Unknown_Language.
Merge tests for library project between gnatmake and gprbuild.
2009-07-13 Arnaud Charlet <charlet@adacore.com>
* lib.adb, make.adb, mlib.adb, exp_dist.adb: Update comments.
......
......@@ -1391,6 +1391,7 @@ package body Clean is
(Project => Main_Project,
In_Tree => Project_Tree,
Project_File_Name => Project_File_Name.all,
Flags => Gnatmake_Flags,
Packages_To_Check => Packages_To_Check_By_Gnatmake);
if Main_Project = No_Project then
......
......@@ -1777,6 +1777,7 @@ begin
(Project => Project,
In_Tree => Project_Tree,
Project_File_Name => Project_File.all,
Flags => Gnatmake_Flags,
Packages_To_Check => Packages_To_Check);
if Project = Prj.No_Project then
......
......@@ -6865,7 +6865,8 @@ package body Make is
(Project => Main_Project,
In_Tree => Project_Tree,
Project_File_Name => Project_File_Name.all,
Packages_To_Check => Packages_To_Check_By_Gnatmake);
Packages_To_Check => Packages_To_Check_By_Gnatmake,
Flags => Gnatmake_Flags);
-- The parsing of project files may have changed the current output
......
......@@ -396,6 +396,7 @@ package body Prj.Conf is
Config : out Prj.Project_Id;
Config_File_Path : out String_Access;
Automatically_Generated : out Boolean;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null)
is
function Default_File_Name return String;
......@@ -862,7 +863,7 @@ package body Prj.Conf is
Success => Success,
From_Project_Node => Config_Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
Report_Error => null,
Flags => Flags,
Reset_Tree => False);
end if;
......@@ -904,13 +905,9 @@ package body Prj.Conf is
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null;
Compiler_Driver_Mandatory : Boolean := True;
Allow_Duplicate_Basenames : Boolean := False;
Reset_Tree : Boolean := True;
Require_Sources_Other_Lang : Boolean := True;
When_No_Sources : Error_Warning := Warning)
Reset_Tree : Boolean := True)
is
Main_Config_Project : Project_Id;
Success : Boolean;
......@@ -925,7 +922,7 @@ package body Prj.Conf is
Success => Success,
From_Project_Node => User_Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
Report_Error => Report_Error,
Flags => Flags,
Reset_Tree => Reset_Tree);
if not Success then
......@@ -948,6 +945,7 @@ package body Prj.Conf is
Packages_To_Check => Packages_To_Check,
Config_File_Path => Config_File_Path,
Automatically_Generated => Automatically_Generated,
Flags => Flags,
On_Load_Config => On_Load_Config);
Apply_Config_File (Main_Config_Project, Project_Tree);
......@@ -960,12 +958,7 @@ package body Prj.Conf is
Success => Success,
From_Project_Node => User_Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
Report_Error => Report_Error,
Current_Dir => Current_Directory,
When_No_Sources => When_No_Sources,
Require_Sources_Other_Lang => Require_Sources_Other_Lang,
Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
Allow_Duplicate_Basenames => Allow_Duplicate_Basenames);
Flags => Flags);
if not Success then
Main_Project := No_Project;
......@@ -990,7 +983,7 @@ package body Prj.Conf is
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null)
is
begin
......@@ -1029,7 +1022,7 @@ package body Prj.Conf is
Config_File_Path => Config_File_Path,
Target_Name => Target_Name,
Normalized_Hostname => Normalized_Hostname,
Report_Error => Report_Error,
Flags => Flags,
On_Load_Config => On_Load_Config);
end Parse_Project_And_Apply_Config;
......@@ -1131,19 +1124,22 @@ package body Prj.Conf is
Project_Tree : Project_Node_Tree_Ref)
is
Name : Name_Id;
begin
if Config_File = Empty_Node then
-- Create a dummy config file is none was found.
-- Create a dummy config file is none was found
Name_Len := Auto_Cgpr'Length;
Name_Buffer (1 .. Name_Len) := Auto_Cgpr;
Name := Name_Find;
Config_File := Create_Project
(In_Tree => Project_Tree,
Name => Name,
Full_Path => Path_Name_Type (Name),
Is_Config_File => True);
Config_File :=
Create_Project
(In_Tree => Project_Tree,
Name => Name,
Full_Path => Path_Name_Type (Name),
Is_Config_File => True);
-- ??? This isn't strictly required, since Prj.Nmsc.Add_Language
-- already has a workaround in the Ada_Only case. But it would be
......@@ -1151,6 +1147,8 @@ package body Prj.Conf is
-- Likewise for the default language, hard-coded in
-- Pjr.Nmsc.Check_Programming_Languages
-- Why is all the following code commented out???
-- Update_Attribute_Value_In_Scenario
-- (Tree => Project_Tree,
-- Project => Config_File,
......
......@@ -55,7 +55,7 @@ package Prj.Conf is
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null);
-- Find the main configuration project and parse the project tree rooted at
-- this configuration project.
......@@ -96,19 +96,17 @@ package Prj.Conf is
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null;
Compiler_Driver_Mandatory : Boolean := True;
Allow_Duplicate_Basenames : Boolean := False;
Reset_Tree : Boolean := True;
Require_Sources_Other_Lang : Boolean := True;
When_No_Sources : Error_Warning := Warning);
Reset_Tree : Boolean := True);
-- Same as above, except the project must already have been parsed through
-- Prj.Part.Parse, and only the processing of the project and the
-- configuration is done at this level.
--
-- If Reset_Tree is true, all projects are first removed from the tree.
-- When_No_Sources indicates what should be done when no sources are found
-- for one of the languages of the project.
--
-- If Require_Sources_Other_Lang is true, then all languages must have at
-- least one source file, or an error is reported via When_No_Sources. If
-- it is false, this is only required for Ada (and only if it is a language
......@@ -129,6 +127,7 @@ package Prj.Conf is
Config : out Prj.Project_Id;
Config_File_Path : out String_Access;
Automatically_Generated : out Boolean;
Flags : Processing_Flags;
On_Load_Config : Config_File_Hook := null);
-- Compute the name of the configuration file that should be used. If no
-- default configuration file is found, a new one will be automatically
......@@ -142,20 +141,19 @@ package Prj.Conf is
--
-- The choice and generation of a configuration file depends on several
-- attributes of the user's project file (given by the Project argument),
-- like the list of languages that must be supported. Project must
-- therefore have been partially processed (phase one of the processing
-- only).
-- e.g. list of languages that must be supported. Project must therefore
-- have been partially processed (phase one of the processing only).
--
-- Config_File_Name should be set to the name of the config file specified
-- by the user (either through gprbuild's --config or --autoconf switches).
-- In the latter case, Autoconf_Specified should be set to true, to
-- indicate that the configuration file can be regenerated to match target
-- and languages. This name can either be an absolute path, or the a base
-- name that will be searched in the default config file directories (which
-- In the latter case, Autoconf_Specified should be set to true to indicate
-- that the configuration file can be regenerated to match target and
-- languages. This name can either be an absolute path, or the a base name
-- that will be searched in the default config file directories (which
-- depends on the installation path for the tools).
--
-- Target_Name is used to chose among several possibilities
-- the configuration file that will be used.
-- Target_Name is used to chose the configuration file that will be used
-- from among several possibilities.
--
-- If a project file could be found, it is automatically parsed and
-- processed (and Packages_To_Check is used to indicate which packages
......@@ -175,11 +173,11 @@ package Prj.Conf is
procedure Add_Default_GNAT_Naming_Scheme
(Config_File : in out Prj.Tree.Project_Node_Id;
Project_Tree : Prj.Tree.Project_Node_Tree_Ref);
-- A hook for Get_Or_Create_Configuration_File and
-- Process_Project_And_Apply_Config that will create a new config file (in
-- memory) and add the default GNAT naming scheme to it. Nothing is done
-- if the config_file already exists, to avoid overriding what the user
-- might have put in there.
-- A hook that will create a new config file (in memory), used for
-- Get_Or_Create_Configuration_File and Process_Project_And_Apply_Config
-- and add the default GNAT naming scheme to it. Nothing is done if the
-- config_file already exists, to avoid overriding what the user might
-- have put in there.
--------------
-- Runtimes --
......@@ -193,7 +191,7 @@ package Prj.Conf is
-- --config switch then automatically generating a configuration file.
function Runtime_Name_For (Language : Name_Id) return String;
-- Returns the runtime name for a language. Returns an empty string if
-- no runtime was specified for the language using option --RTS.
-- Returns the runtime name for a language. Returns an empty string if no
-- runtime was specified for the language using option --RTS.
end Prj.Conf;
......@@ -646,7 +646,6 @@ package body Prj.Env is
-- Visit all the files and process those that need an SFN pragma
Iter := For_Each_Source (In_Tree, For_Project);
while Element (Iter) /= No_Source loop
Source := Element (Iter);
......
......@@ -23,87 +23,21 @@
-- --
------------------------------------------------------------------------------
-- Perform various checks on a project and find all its source files
with GNAT.Dynamic_HTables;
-- Find source dirs and source files for a project
private package Prj.Nmsc is
type Tree_Processing_Data is private;
-- Temporary data which is needed while parsing a project. It does not need
-- to be kept in memory once a project has been fully loaded, but is
-- necessary while performing consistency checks (duplicate sources,...)
-- This data must be initialized before processing any project, and the
-- same data is used for processing all projects in the tree.
procedure Initialize
(Data : out Tree_Processing_Data;
Tree : Project_Tree_Ref;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False);
-- Initialize Data
-- If Allow_Duplicate_Basenames, then files with the same base names are
-- authorized within a project for source-based languages (never for unit
-- based languages)
-- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
-- for each language must be defined, or we will not look for its source
-- files.
-- When_No_Sources indicates what should be done when no sources of a
-- language are found in a project where this language is declared.
-- If Require_Sources_Other_Lang is true, then all languages must have at
-- least one source file, or an error is reported via When_No_Sources. If
-- it is false, this is only required for Ada (and only if it is a language
-- of the project).
-- If Report_Error is null, use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
procedure Free (Data : in out Tree_Processing_Data);
-- Free the memory occupied by Data
procedure Check
(Project : Project_Id;
Current_Dir : String;
Data : in out Tree_Processing_Data);
-- Perform consistency and semantic checks on a project, starting from the
-- project tree parsed from the .gpr file. This procedure interprets the
-- various case statements in the project based on the current environment
-- variables (the "scenario"). After checking the validity of the naming
-- scheme, it searches for all the source files of the project. The result
-- of this procedure is a filled-in data structure for Project_Id which
-- contains all the information about the project. This information is only
-- valid while the scenario variables are preserved. If the current mode
-- is Ada_Only, this procedure will only search Ada sources, but in multi-
-- language mode it will look for sources for all supported languages.
--
-- Current_Dir is for optimization purposes only, avoiding system calls to
-- query it.
private
package Files_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num,
Element => Source_Id,
No_Element => No_Source,
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
-- Mapping from base file names to Source_Id (containing full info about
-- the source)
type Tree_Processing_Data is record
Tree : Project_Tree_Ref;
-- The data applies when parsing this tree
File_To_Source : Files_Htable.Instance;
procedure Process_Naming_Scheme
(Tree : Project_Tree_Ref;
Root_Project : Project_Id;
Flags : Processing_Flags);
-- Perform consistency and semantic checks on all the projects in the tree.
-- This procedure interprets the various case statements in the project
-- based on the current environment variables (the "scenario"). After
-- checking the validity of the naming scheme, it searches for all the
-- source files of the project. The result of this procedure is a filled-in
-- data structure for Project_Id which contains all the information about
-- the project. This information is only valid while the scenario variables
-- are preserved.
Require_Sources_Other_Lang : Boolean;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
-- See comments for Initialize
end record;
end Prj.Nmsc;
......@@ -44,8 +44,7 @@ package body Prj.Pars is
Project : out Project_Id;
Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error;
Report_Error : Put_Line_Access := null;
Flags : Processing_Flags;
Reset_Tree : Boolean := True)
is
Project_Node : Project_Node_Id := Empty_Node;
......@@ -90,15 +89,11 @@ package body Prj.Pars is
Allow_Automatic_Generation => False,
Automatically_Generated => Automatically_Generated,
Config_File_Path => Config_File_Path,
Report_Error => Report_Error,
Flags => Flags,
Normalized_Hostname => "",
Compiler_Driver_Mandatory => False,
Allow_Duplicate_Basenames => False,
Require_Sources_Other_Lang => False,
On_Load_Config =>
Add_Default_GNAT_Naming_Scheme'Access,
Reset_Tree => Reset_Tree,
When_No_Sources => When_No_Sources);
Reset_Tree => Reset_Tree);
Success := The_Project /= No_Project;
......
......@@ -35,8 +35,7 @@ package Prj.Pars is
Project : out Project_Id;
Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error;
Report_Error : Prj.Put_Line_Access := null;
Flags : Processing_Flags;
Reset_Tree : Boolean := True);
-- Parse and process a project files and all its imported project files, in
-- the project tree In_Tree.
......@@ -56,9 +55,6 @@ package Prj.Pars is
-- produces an error. For other packages, an unknown attribute produces a
-- warning.
--
-- When_No_Sources indicates what should be done when no sources are found
-- in a project for a specified or implied language.
--
-- When Reset_Tree is True, all the project data are removed from the
-- project table before processing.
......
......@@ -1110,8 +1110,8 @@ package body Prj.Part is
Write_Eol;
end if;
Project_Directory := Path_Name_Type
(Get_Directory (File_Name_Type (Normed_Path_Name)));
Project_Directory :=
Path_Name_Type (Get_Directory (File_Name_Type (Normed_Path_Name)));
-- Is there any imported project?
......
......@@ -37,7 +37,7 @@ package Prj.Proc is
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
Flags : Prj.Processing_Flags;
Reset_Tree : Boolean := True);
-- Process a project tree (ie the direct resulting of parsing a .gpr file)
-- based on the current scenario variables.
......@@ -48,12 +48,6 @@ package Prj.Proc is
-- needed to automatically generate a configuration file. This first phase
-- of the processing does not require a configuration file.
--
-- If Report_Error is null, use the error reporting mechanism. Otherwise,
-- report errors using Report_Error.
--
-- When_No_Sources indicates what should be done when no sources are found
-- in a project for a specified or implied language.
--
-- When Reset_Tree is True, all the project data are removed from the
-- project table before processing.
......@@ -63,24 +57,13 @@ package Prj.Proc is
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
Current_Dir : String;
Require_Sources_Other_Lang : Boolean;
Compiler_Driver_Mandatory : Boolean;
Allow_Duplicate_Basenames : Boolean);
Flags : Processing_Flags);
-- Perform the second phase of the processing, filling the rest of the
-- project with the information extracted from the project tree. This phase
-- requires that the configuration file has already been parsed (in fact
-- we currently assume that the contents of the configuration file has
-- been included in Project through Confgpr.Apply_Config_File). The
-- parameters are the same as for phase_1, with the addition of:
--
-- Current_Dir is for optimization purposes, avoiding extra system calls.
--
-- If Allow_Duplicate_Basenames, then files with the same base names are
-- authorized within a project for source-based languages (never for unit
-- based languages)
procedure Process
(In_Tree : Project_Tree_Ref;
......@@ -88,10 +71,8 @@ package Prj.Proc is
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
Reset_Tree : Boolean := True;
Current_Dir : String := "");
Flags : Processing_Flags;
Reset_Tree : Boolean := True);
-- Performs the two phases of the processing
end Prj.Proc;
......@@ -24,7 +24,7 @@
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Osint; use Osint;
with Osint; use Osint;
with Prj.Err;
package body Prj.Tree is
......@@ -97,8 +97,7 @@ package body Prj.Tree is
begin
pragma Assert
(Present (To)
and then
In_Tree.Project_Nodes.Table (To).Kind /= N_Comment);
and then In_Tree.Project_Nodes.Table (To).Kind /= N_Comment);
Zone := In_Tree.Project_Nodes.Table (To).Comments;
......@@ -109,25 +108,25 @@ package body Prj.Tree is
Project_Node_Table.Increment_Last (In_Tree.Project_Nodes);
In_Tree.Project_Nodes.Table
(Project_Node_Table.Last (In_Tree.Project_Nodes)) :=
(Kind => N_Comment_Zones,
Qualifier => Unspecified,
Expr_Kind => Undefined,
Location => No_Location,
Directory => No_Path,
Variables => Empty_Node,
Packages => Empty_Node,
Pkg_Id => Empty_Package,
Name => No_Name,
Src_Index => 0,
Path_Name => No_Path,
Value => No_Name,
Field1 => Empty_Node,
Field2 => Empty_Node,
Field3 => Empty_Node,
Field4 => Empty_Node,
Flag1 => False,
Flag2 => False,
Comments => Empty_Node);
(Kind => N_Comment_Zones,
Qualifier => Unspecified,
Expr_Kind => Undefined,
Location => No_Location,
Directory => No_Path,
Variables => Empty_Node,
Packages => Empty_Node,
Pkg_Id => Empty_Package,
Name => No_Name,
Src_Index => 0,
Path_Name => No_Path,
Value => No_Name,
Field1 => Empty_Node,
Field2 => Empty_Node,
Field3 => Empty_Node,
Field4 => Empty_Node,
Flag1 => False,
Flag2 => False,
Comments => Empty_Node);
Zone := Project_Node_Table.Last (In_Tree.Project_Nodes);
In_Tree.Project_Nodes.Table (To).Comments := Zone;
......
......@@ -294,9 +294,8 @@ package Prj.Tree is
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Directory_Of);
-- Only valid for N_Project nodes.
-- Returns the directory that contains the project file. This always
-- ends with a directory separator
-- Returns the directory that contains the project file. This always ends
-- with a directory separator. Only valid for N_Project nodes.
function Expression_Kind_Of
(Node : Project_Node_Id;
......@@ -441,8 +440,7 @@ package Prj.Tree is
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
pragma Inline (Project_Of_Renamed_Package_Of);
-- Only valid for N_Package_Declaration nodes.
-- May return Empty_Node.
-- Only valid for N_Package_Declaration nodes. May return Empty_Node.
function Next_Package_In_Project
(Node : Project_Node_Id;
......@@ -601,8 +599,8 @@ package Prj.Tree is
-- Set Procedures --
--------------------
-- The following procedures are part of the abstract interface of
-- the Project File tree.
-- The following procedures are part of the abstract interface of the
-- Project File tree.
-- Each Set_* procedure is valid only for the same Project_Node_Kind
-- nodes as the corresponding query function above.
......@@ -971,6 +969,7 @@ package Prj.Tree is
Pkg_Id : Package_Node_Id := Empty_Package;
-- Only used for N_Package_Declaration
--
-- The component Pkg_Id is an entry into the table Package_Attributes
-- (in Prj.Attr). It is used to indicate all the attributes of the
-- package with their characteristics.
......@@ -1006,38 +1005,45 @@ package Prj.Tree is
Flag1 : Boolean := False;
-- This flag is significant only for:
--
-- N_Attribute_Declaration and N_Attribute_Reference
-- It indicates for an associative array attribute, that the
-- Indicates for an associative array attribute, that the
-- index is case insensitive.
-- N_Comment - it indicates that the comment is preceded by an
-- empty line.
-- N_Project - it indicates that there are comments in the project
-- source that cannot be kept in the tree.
--
-- N_Comment
-- Indicates that the comment is preceded by an empty line.
--
-- N_Project
-- Indicates that there are comments in the project source that
-- cannot be kept in the tree.
--
-- N_Project_Declaration
-- - it indicates that there are unkept comments in the
-- project.
-- Indicates that there are unkept comments in the project.
--
-- N_With_Clause
-- - it indicates that this is not the last with in a
-- with clause. It is set for "A", but not for "B" in
-- with "B";
-- and
-- with "A", "B";
-- Indicates that this is not the last with in a with clause.
-- Set for "A", but not for "B" in with "B"; and with "A", "B";
Flag2 : Boolean := False;
-- This flag is significant only for:
-- N_Project - it indicates that the project "extends all" another
-- project.
-- N_Comment - it indicates that the comment is followed by an
-- empty line.
--
-- N_Project
-- Indicates that the project "extends all" another project.
--
-- N_Comment
-- Indicates that the comment is followed by an empty line.
--
-- N_With_Clause
-- - it indicates that the originally imported project
-- is an extending all project.
-- Indicates that the originally imported project is an extending
-- all project.
Comments : Project_Node_Id := Empty_Node;
-- For nodes other that N_Comment_Zones or N_Comment, designates the
-- comment zones associated with the node.
-- for N_Comment_Zones, designates the comment after the "end" of
--
-- For N_Comment_Zones, designates the comment after the "end" of
-- the construct.
--
-- For N_Comment, designates the next comment, if any.
end record;
......@@ -1256,15 +1262,14 @@ package Prj.Tree is
-- -- Flag2: comment is followed by an empty line
-- -- Comments: next comment
package Project_Node_Table is
new GNAT.Dynamic_Tables
package Project_Node_Table is new
GNAT.Dynamic_Tables
(Table_Component_Type => Project_Node_Record,
Table_Index_Type => Project_Node_Id,
Table_Low_Bound => First_Node_Id,
Table_Initial => Project_Nodes_Initial,
Table_Increment => Project_Nodes_Increment);
-- This table contains the syntactic tree of project data
-- from project files.
-- Table contains the syntactic tree of project data from project files
type Project_Name_And_Node is record
Name : Name_Id;
......@@ -1320,13 +1325,9 @@ private
type Comment_State is record
End_Of_Line_Node : Project_Node_Id := Empty_Node;
Previous_Line_Node : Project_Node_Id := Empty_Node;
Previous_End_Node : Project_Node_Id := Empty_Node;
Unkept_Comments : Boolean := False;
Comments : Comments_Ptr := null;
end record;
......
......@@ -1219,6 +1219,28 @@ package body Prj is
end if;
end Other_Part;
------------------
-- Create_Flags --
------------------
function Create_Flags
(Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
Error_On_Unknown_Language : Boolean := True)
return Processing_Flags is
begin
return Processing_Flags'
(Report_Error => Report_Error,
When_No_Sources => When_No_Sources,
Require_Sources_Other_Lang => Require_Sources_Other_Lang,
Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
Error_On_Unknown_Language => Error_On_Unknown_Language,
Compiler_Driver_Mandatory => Compiler_Driver_Mandatory);
end Create_Flags;
begin
-- Make sure that the standard config and user project file extensions are
-- compatible with canonical case file naming.
......
......@@ -1342,6 +1342,42 @@ package Prj is
-- This procedure resets all the tables that are used when processing a
-- project file tree. Initialize must be called before the call to Reset.
type Processing_Flags is private;
-- Flags used while parsing and processing a project tree.
-- These configure various behavior in the parser, as well as indicate how
-- to report error messages.
-- This structure does not allocate memory and never needs to be freed
function Create_Flags
(Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
Error_On_Unknown_Language : Boolean := True)
return Processing_Flags;
-- If Allow_Duplicate_Basenames, then files with the same base names are
-- authorized within a project for source-based languages (never for unit
-- based languages)
-- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
-- for each language must be defined, or we will not look for its source
-- files.
-- When_No_Sources indicates what should be done when no sources of a
-- language are found in a project where this language is declared.
-- If Require_Sources_Other_Lang is true, then all languages must have at
-- least one source file, or an error is reported via When_No_Sources. If
-- it is false, this is only required for Ada (and only if it is a language
-- of the project).
-- If Report_Error is null, use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
-- If Error_On_Unknown_Language is true, an error is displayed if some of
-- the source files listed in the project do not match any naming scheme
Gprbuild_Flags : constant Processing_Flags;
Gnatmake_Flags : constant Processing_Flags;
-- Flags used by the various tools. They all display the error messages
-- through Prj.Err
package Project_Boolean_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Boolean,
......@@ -1517,4 +1553,29 @@ private
-- Type to represent the part of a project tree which is private to the
-- Project Manager.
type Processing_Flags is record
Require_Sources_Other_Lang : Boolean;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Allow_Duplicate_Basenames : Boolean;
Compiler_Driver_Mandatory : Boolean;
Error_On_Unknown_Language : Boolean;
end record;
Gprbuild_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Warning,
Require_Sources_Other_Lang => True,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
Error_On_Unknown_Language => True);
Gnatmake_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Error,
Require_Sources_Other_Lang => False,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => False,
Error_On_Unknown_Language => False);
end Prj;
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