+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb (Access_Type_Declaration): An access type whose
+ designated type is a limited view from a limited with clause (flagged
+ From_With_Type) is not itself such a limited view.
+
+2009-05-06 Emmanuel Briot <briot@adacore.com>
+
+ * prj-nmsc.adb: Remove unused variable.
+
+ * clean.adb, gnatcmd.adb, makeutl.ads, prj-pars.adb, prj-pars.ads,
+ prj-proc.ads, prj.ads, switch-m.adb (Subdirs_Option): Moved to
+ makeutl.ads, since not all users of prj.ads need this.
+
2009-05-06 Javier Miranda <miranda@adacore.com>
* exp_aggr.adb (Build_Record_Aggr_Code): Add implicit call to the C++
with ALI; use ALI;
with Csets;
-with Makeutl;
+with Makeutl; use Makeutl;
with MLib.Tgt; use MLib.Tgt;
with Namet; use Namet;
with Opt; use Opt;
Last_Switches.Table (Index).all);
end loop;
- -- One switch for the standard GNAT library dir.
+ -- One switch for the standard GNAT library dir
Last_Switches.Increment_Last;
Last_Switches.Table
-- --subdirs=... Specify Subdirs
- if Argv'Length > Subdirs_Option'Length and then
+ if Argv'Length > Makeutl.Subdirs_Option'Length and then
Argv
- (Argv'First .. Argv'First + Subdirs_Option'Length - 1) =
- Subdirs_Option
+ (Argv'First ..
+ Argv'First + Makeutl.Subdirs_Option'Length - 1) =
+ Makeutl.Subdirs_Option
then
Subdirs :=
new String'
(Argv
- (Argv'First + Subdirs_Option'Length .. Argv'Last));
+ (Argv'First + Makeutl.Subdirs_Option'Length ..
+ Argv'Last));
Remove_Switch (Arg_Num);
Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data;
-- The project tree
+ Subdirs_Option : constant String := "--subdirs=";
+ -- Switch used to indicate that the real directories (object, exec,
+ -- library, ...) are subdirectories of those in the project file.
+
procedure Add
(Option : String_Access;
To : in out String_List_Access;
File_Name : File_Name_Type;
Alternate_Languages : out Language_List;
Language : out Language_Ptr;
- Language_Name : out Name_Id;
Display_Language_Name : out Name_Id;
Unit : out Name_Id;
Lang_Kind : out Language_Kind;
File_Name : File_Name_Type;
Alternate_Languages : out Language_List;
Language : out Language_Ptr;
- Language_Name : out Name_Id;
Display_Language_Name : out Name_Id;
Unit : out Name_Id;
Lang_Kind : out Language_Kind;
Tmp_Lang := Project.Languages;
while Tmp_Lang /= No_Language_Index loop
- Language_Name := Tmp_Lang.Name;
-
if Current_Verbosity = High then
Write_Line
(" Testing language "
- & Get_Name_String (Language_Name)
+ & Get_Name_String (Tmp_Lang.Name)
& " Header_File=" & Header_File'Img);
end if;
Src_Ind : Source_File_Index;
Unit : Name_Id;
Source_To_Replace : Source_Id := No_Source;
- Language_Name : Name_Id;
Display_Language_Name : Name_Id;
Lang_Kind : Language_Kind;
Kind : Source_Kind := Spec;
File_Name => File_Name,
Alternate_Languages => Alternate_Languages,
Language => Language,
- Language_Name => Language_Name,
Display_Language_Name => Display_Language_Name,
Unit => Unit,
Lang_Kind => Lang_Kind,
Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error;
+ Report_Error : Put_Line_Access := null;
Reset_Tree : Boolean := True;
- Is_Config_File : Boolean)
+ Is_Config_File : Boolean := False)
is
- Project_Node_Tree : constant Project_Node_Tree_Ref :=
- new Project_Node_Tree_Data;
Project_Node : Project_Node_Id := Empty_Node;
The_Project : Project_Id := No_Project;
Success : Boolean := True;
Current_Dir : constant String := Get_Current_Dir;
+ Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
begin
+ Project_Node_Tree := new Project_Node_Tree_Data;
Prj.Tree.Initialize (Project_Node_Tree);
-- Parse the main project file into a tree
-- If there were no error, process the tree
- if Present (Project_Node) then
+ if Project_Node /= Empty_Node then
Prj.Proc.Process
(In_Tree => In_Tree,
Project => The_Project,
Success => Success,
From_Project_Node => Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
- Report_Error => null,
- When_No_Sources => When_No_Sources,
+ Report_Error => Report_Error,
Reset_Tree => Reset_Tree,
+ When_No_Sources => When_No_Sources,
Current_Dir => Current_Dir,
Is_Config_File => Is_Config_File);
+
Prj.Err.Finalize;
if not Success then
Project := The_Project;
+ -- ??? Should free the project_node_tree, no longer useful
+
exception
when X : others =>
-- --
------------------------------------------------------------------------------
--- Implements the parsing of project files
+-- General wrapper for the parsing of project files
package Prj.Pars is
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;
Reset_Tree : Boolean := True;
- Is_Config_File : Boolean);
- -- Parse a project files and all its imported project files, in the
- -- project tree In_Tree.
+ Is_Config_File : Boolean := False);
+ -- Parse and process a project files and all its imported project files, in
+ -- the project tree In_Tree.
+ -- All the project files are parsed (through Prj.Tree) to create a tree in
+ -- memory. That tree is then processed (through Prj.Proc) to create a
+ -- expanded representation of the tree based on the current scenario
+ -- variables. This function is only a convenient wrapper over other
+ -- services provided in the Prj.* package hierarchy.
--
- -- If parsing is successful, Project_Id is the project ID
- -- of the main project file; otherwise, Project_Id is set
- -- to No_Project.
+ -- If parsing is successful, Project is the project ID of the root project
+ -- file; otherwise, Project_Id is set to No_Project. Project_Node_Tree is
+ -- set to the tree (unprocessed) representation of the project file. This
+ -- tree is permanently correct, whereas Project will need to be recomputed
+ -- if the scenario variables change.
--
-- Packages_To_Check indicates the packages where any unknown attribute
- -- produces an error. For other packages, an unknown attribute produces
- -- a warning.
+ -- 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_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.
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2007, 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
package Prj.Proc is
- procedure Process
+ procedure Process_Project_Tree_Phase_1
(In_Tree : Project_Tree_Ref;
Project : out Project_Id;
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 := "";
- Is_Config_File : Boolean);
- -- Process a project file tree into project file data structures. If
- -- Report_Error is null, use the error reporting mechanism. Otherwise,
- -- report errors using Report_Error.
+ Reset_Tree : Boolean := True);
+ -- Process a project tree (ie the direct resulting of parsing a .gpr file)
+ -- based on the current scenario variables.
--
- -- Current_Dir is for optimization purposes, avoiding extra system calls.
+ -- The result of this phase_1 is a partial project tree (Project) where
+ -- only a few fields have been initialized (in particular the list of
+ -- languages). These are the fields that are necessary to run gprconfig if
+ -- 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.
- --
- -- Process is a bit of a junk name, how about Process_Project_Tree???
- --
- -- The two procedures that follow are implementing procedure Process in
- -- two successive phases. They are used by gprbuild/gprclean to add the
- -- 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_2
(In_Tree : Project_Tree_Ref;
- Project : out Project_Id;
+ Project : Project_Id;
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
- Reset_Tree : Boolean := True);
- -- See documentation of parameters in procedure Process above
+ When_No_Sources : Error_Warning := Error;
+ Current_Dir : String;
+ Is_Config_File : Boolean);
+ -- 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.
+ --
+ -- Is_Config_File should be true if Project is a config file (.cgpr)
- procedure Process_Project_Tree_Phase_2
+ procedure Process
(In_Tree : Project_Tree_Ref;
- Project : Project_Id;
+ Project : out Project_Id;
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;
+ Reset_Tree : Boolean := True;
+ Current_Dir : String := "";
Is_Config_File : Boolean);
- -- See documentation of parameters in procedure Process above
+ -- Performs the two phases of the processing
end Prj.Proc;
-- Name used to replace others as an index of an associative array
-- attribute in situations where this is allowed.
- Subdirs_Option : constant String := "--subdirs=";
- -- Switch used to indicate that the real directories (object, exec,
- -- library, ...) are subdirectories of those in the project file.
-
Subdirs : String_Ptr := null;
-- The value after the equal sign in switch --subdirs=...
-- Contains the relative subdirectory.
procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id) is
S : constant Node_Id := Subtype_Indication (Def);
P : constant Node_Id := Parent (Def);
-
- Desig : Entity_Id;
- -- Designated type
-
begin
-- Check for permissible use of incomplete type
Init_Size_Align (T);
end if;
- Desig := Designated_Type (T);
-
- -- If designated type is an imported tagged type, indicate that the
- -- access type is also imported, and therefore restricted in its use.
- -- The access type may already be imported, so keep setting otherwise.
-
- -- Ada 2005 (AI-50217): If the non-limited view of the designated type
- -- is available, use it as the designated type of the access type, so
- -- that the back-end gets a usable entity.
-
- if From_With_Type (Desig)
- and then Ekind (Desig) /= E_Access_Type
- then
- Set_From_With_Type (T);
- end if;
-
-- Note that Has_Task is always false, since the access type itself
-- is not a task type. See Einfo for more description on this point.
-- Exactly the same consideration applies to Has_Controlled_Component.
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
------------------------------------------------------------------------------
with Debug; use Debug;
+with Makeutl; use Makeutl;
with Osint; use Osint;
with Opt; use Opt;
with Prj; use Prj;