From 7dd1ab8497bdb14e30bce8d94214be7afc6e9a90 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 6 May 2009 10:29:29 +0200 Subject: [PATCH] [multiple changes] 2009-05-06 Thomas Quinot * 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 * 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. From-SVN: r147152 --- gcc/ada/ChangeLog | 14 +++++++++++++ gcc/ada/clean.adb | 2 +- gcc/ada/gnatcmd.adb | 12 ++++++----- gcc/ada/makeutl.ads | 4 ++++ gcc/ada/prj-nmsc.adb | 8 +------ gcc/ada/prj-pars.adb | 16 ++++++++------ gcc/ada/prj-pars.ads | 30 ++++++++++++++++---------- gcc/ada/prj-proc.ads | 59 +++++++++++++++++++++++++++++----------------------- gcc/ada/prj.ads | 4 ---- gcc/ada/sem_ch3.adb | 20 ------------------ gcc/ada/switch-m.adb | 3 ++- 11 files changed, 91 insertions(+), 81 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4d7bb56..fa0b625 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2009-05-06 Thomas Quinot + + * 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 + + * 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 * exp_aggr.adb (Build_Record_Aggr_Code): Add implicit call to the C++ diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb index 04512e7..2c08d49 100644 --- a/gcc/ada/clean.adb +++ b/gcc/ada/clean.adb @@ -25,7 +25,7 @@ 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; diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 8310cd2..8194a42 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -987,7 +987,7 @@ procedure GNATCmd is 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 @@ -1660,15 +1660,17 @@ begin -- --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); diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads index 3c9b4d9..c0dc9f1 100644 --- a/gcc/ada/makeutl.ads +++ b/gcc/ada/makeutl.ads @@ -40,6 +40,10 @@ package Makeutl is 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; diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 5a76d39..bb3ce48 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -410,7 +410,6 @@ package body Prj.Nmsc is 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; @@ -7270,7 +7269,6 @@ package body Prj.Nmsc is 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; @@ -7346,12 +7344,10 @@ package body Prj.Nmsc is 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; @@ -7424,7 +7420,6 @@ package body Prj.Nmsc is 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; @@ -7489,7 +7484,6 @@ package body Prj.Nmsc is 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, diff --git a/gcc/ada/prj-pars.adb b/gcc/ada/prj-pars.adb index 86f47ec..92010bf 100644 --- a/gcc/ada/prj-pars.adb +++ b/gcc/ada/prj-pars.adb @@ -45,17 +45,18 @@ package body Prj.Pars is 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 @@ -72,18 +73,19 @@ package body Prj.Pars is -- 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 @@ -93,6 +95,8 @@ package body Prj.Pars is Project := The_Project; + -- ??? Should free the project_node_tree, no longer useful + exception when X : others => diff --git a/gcc/ada/prj-pars.ads b/gcc/ada/prj-pars.ads index 02f1491..2c439ad 100644 --- a/gcc/ada/prj-pars.ads +++ b/gcc/ada/prj-pars.ads @@ -23,7 +23,7 @@ -- -- ------------------------------------------------------------------------------ --- Implements the parsing of project files +-- General wrapper for the parsing of project files package Prj.Pars is @@ -36,21 +36,29 @@ 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. diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads index f95f210..e15c8ef 100644 --- a/gcc/ada/prj-proc.ads +++ b/gcc/ada/prj-proc.ads @@ -6,7 +6,7 @@ -- -- -- 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- -- @@ -31,57 +31,64 @@ with Prj.Tree; use Prj.Tree; 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; diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index 83f4944..09b65f8 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -44,10 +44,6 @@ package Prj is -- 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. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 9bd9a00..cb66334 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1276,10 +1276,6 @@ package body Sem_Ch3 is 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 @@ -1331,22 +1327,6 @@ package body Sem_Ch3 is 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. diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb index 7be075d..d7ed40d 100644 --- a/gcc/ada/switch-m.adb +++ b/gcc/ada/switch-m.adb @@ -6,7 +6,7 @@ -- -- -- 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- -- @@ -24,6 +24,7 @@ ------------------------------------------------------------------------------ with Debug; use Debug; +with Makeutl; use Makeutl; with Osint; use Osint; with Opt; use Opt; with Prj; use Prj; -- 2.7.4