Commit d6a24cdb by Arnaud Charlet

[multiple changes]

2009-06-23  Javier Miranda  <miranda@adacore.com>

	* exp_ch4.adb (Displace_Allocator_Pointer, Expand_N_Allocator): Handle
	designated types referencing entities from the limited view.

2009-06-23  Matthew Gingell  <gingell@adacore.com>

	* a-stzhas.ads, a-szfzha.ads: Fix typo.

	* Makefile.rtl: Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash depends on
	Ada.Strings.Wide_Wide_Hash. So we need to include a-stzhas in
	the list of RTS files.

2009-06-23  Thomas Quinot  <quinot@adacore.com>

	* ali.adb: Minor reformatting

2009-06-23  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb: Improve error message.

2009-06-23  Emmanuel Briot  <briot@adacore.com>

	* prj-nmsc.adb: Minor reformating

	* prj-conf.adb, prj-conf.ads: Remove use of Osint.Fail everywhere
	(Do_Autoconf): accepts an empty Normalized_Hostname
	(Process_Project_And_Apply_Config): New subprogram
	(Parse_Project_And_Apply_Config): On_Load_Config now applies to the
	project tree rather than the project view.

	* prj-part.adb, prj.ads (Project_Qualifier): New possible value
	Configuration.

From-SVN: r148838
parent f91c36dc
2009-06-23 Javier Miranda <miranda@adacore.com>
* exp_ch4.adb (Displace_Allocator_Pointer, Expand_N_Allocator): Handle
designated types referencing entities from the limited view.
2009-06-23 Robert Dewar <dewar@adacore.com> 2009-06-23 Robert Dewar <dewar@adacore.com>
* s-strhas.adb, s-strhas.ads: Restrict to 32-bit modular types * s-strhas.adb, s-strhas.ads: Restrict to 32-bit modular types
......
...@@ -220,6 +220,7 @@ GNATRTL_NONTASKING_OBJS= \ ...@@ -220,6 +220,7 @@ GNATRTL_NONTASKING_OBJS= \
a-stwiun$(objext) \ a-stwiun$(objext) \
a-stzbou$(objext) \ a-stzbou$(objext) \
a-stzfix$(objext) \ a-stzfix$(objext) \
a-stzhas$(objext) \
a-stzmap$(objext) \ a-stzmap$(objext) \
a-stzsea$(objext) \ a-stzsea$(objext) \
a-stzsup$(objext) \ a-stzsup$(objext) \
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
-- Is this really an RM unit? Doc needed??? -- Is this really an RM unit? Doc needed???
with Ada.Containers; with Ada.Containers;
with System.String_Hash;
function Ada.Strings.Wide_Wide_Hash function Ada.Strings.Wide_Wide_Hash
(Key : Wide_Wide_String) return Containers.Hash_Type; is new System.String_Hash.Hash
(Wide_Wide_Character, Wide_Wide_String, Containers.Hash_Type);
pragma Pure (Ada.Strings.Wide_Wide_Hash); pragma Pure (Ada.Strings.Wide_Wide_Hash);
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ada.Containers, Ada.Strings.Wide_Wide_Hash; with Ada.Containers;
with Ada.Strings.Wide_Wide_Hash;
function Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash function Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
(Key : Wide_Wide_String) return Containers.Hash_Type (Key : Wide_Wide_String) return Containers.Hash_Type
renames Ada.Strings.Wide_Wide_Hash; renames Ada.Strings.Wide_Wide_Hash;
pragma Pure (Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash); pragma Pure (Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash);
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- Copyright (C) 1992-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- --
...@@ -532,7 +532,7 @@ package body ALI is ...@@ -532,7 +532,7 @@ package body ALI is
begin begin
Skip_Space; Skip_Space;
-- Check if we are on a number. In the case of bas ALI files, this -- Check if we are on a number. In the case of bad ALI files, this
-- may not be true. -- may not be true.
if not (Nextc in '0' .. '9') then if not (Nextc in '0' .. '9') then
......
...@@ -386,7 +386,7 @@ package body Exp_Ch4 is ...@@ -386,7 +386,7 @@ package body Exp_Ch4 is
and then Nkind (Orig_Node) = N_Allocator); and then Nkind (Orig_Node) = N_Allocator);
PtrT := Etype (Orig_Node); PtrT := Etype (Orig_Node);
Dtyp := Designated_Type (PtrT); Dtyp := Available_View (Designated_Type (PtrT));
Etyp := Etype (Expression (Orig_Node)); Etyp := Etype (Expression (Orig_Node));
if Is_Class_Wide_Type (Dtyp) if Is_Class_Wide_Type (Dtyp)
...@@ -2999,7 +2999,7 @@ package body Exp_Ch4 is ...@@ -2999,7 +2999,7 @@ package body Exp_Ch4 is
procedure Expand_N_Allocator (N : Node_Id) is procedure Expand_N_Allocator (N : Node_Id) is
PtrT : constant Entity_Id := Etype (N); PtrT : constant Entity_Id := Etype (N);
Dtyp : constant Entity_Id := Designated_Type (PtrT); Dtyp : constant Entity_Id := Available_View (Designated_Type (PtrT));
Etyp : constant Entity_Id := Etype (Expression (N)); Etyp : constant Entity_Id := Etype (Expression (N));
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Desig : Entity_Id; Desig : Entity_Id;
......
...@@ -31,12 +31,12 @@ with Prj.Tree; ...@@ -31,12 +31,12 @@ with Prj.Tree;
package Prj.Conf is package Prj.Conf is
type Config_File_Hook is access procedure type Config_File_Hook is access procedure
(Config_File : Prj.Project_Id; (Config_File : Prj.Tree.Project_Node_Id;
Project_Tree : Prj.Project_Tree_Ref); Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref);
-- Hook called after the config file has been parsed. This lets the -- Hook called after the config file has been parsed. This lets the
-- application do last minute changes to it (GPS uses this to add the -- application do last minute changes to it (GPS uses this to add the
-- default naming schemes for instance). At that point, the config file -- default naming schemes for instance).
-- has not been applied to the project yet. -- At that point, the config file has not been applied to the project yet.
procedure Parse_Project_And_Apply_Config procedure Parse_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id; (Main_Project : out Prj.Project_Id;
...@@ -52,13 +52,14 @@ package Prj.Conf is ...@@ -52,13 +52,14 @@ package Prj.Conf is
Config_File_Path : out String_Access; Config_File_Path : out String_Access;
Target_Name : String := ""; Target_Name : String := "";
Normalized_Hostname : String; Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
On_Load_Config : Config_File_Hook := null); On_Load_Config : Config_File_Hook := null);
-- Find the main configuration project and parse the project tree rooted at -- Find the main configuration project and parse the project tree rooted at
-- this configuration project. -- this configuration project.
-- --
-- If the processing fails, Main_Project is set to No_Project. If the error -- If the processing fails, Main_Project is set to No_Project. If the error
-- happend while parsing the project itself (ie creating the tree), -- happend while parsing the project itself (ie creating the tree),
-- User_Project_Node is also set to Empty_Node -- User_Project_Node is also set to Empty_Node.
-- --
-- Autoconf_Specified indicates whether the user has specified --autoconf. -- Autoconf_Specified indicates whether the user has specified --autoconf.
-- If this is the case, the config file might be (re)generated, as -- If this is the case, the config file might be (re)generated, as
...@@ -74,6 +75,31 @@ package Prj.Conf is ...@@ -74,6 +75,31 @@ package Prj.Conf is
-- If specified, On_Load_Config is called just after the config file has -- If specified, On_Load_Config is called just after the config file has
-- been created/loaded. You can then modify it before it is later applied -- been created/loaded. You can then modify it before it is later applied
-- to the project itself. -- to the project itself.
--
-- Any error in generating or parsing the config file is reported via the
-- Invalid_Config exception, with an appropriate message. Any error while
-- parsing the project file results in No_Project.
procedure Process_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id;
User_Project_Node : Prj.Tree.Project_Node_Id;
Config_File_Name : String := "";
Autoconf_Specified : Boolean;
Project_Tree : Prj.Project_Tree_Ref;
Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
Packages_To_Check : String_List_Access;
Allow_Automatic_Generation : Boolean := True;
Automatically_Generated : out Boolean;
Config_File_Path : out String_Access;
Target_Name : String := "";
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
On_Load_Config : Config_File_Hook := null);
-- 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.
Invalid_Config : exception;
procedure Get_Or_Create_Configuration_File procedure Get_Or_Create_Configuration_File
(Project : Prj.Project_Id; (Project : Prj.Project_Id;
...@@ -87,11 +113,14 @@ package Prj.Conf is ...@@ -87,11 +113,14 @@ package Prj.Conf is
Packages_To_Check : String_List_Access := null; Packages_To_Check : String_List_Access := null;
Config : out Prj.Project_Id; Config : out Prj.Project_Id;
Config_File_Path : out String_Access; Config_File_Path : out String_Access;
Automatically_Generated : out Boolean); Automatically_Generated : out Boolean;
On_Load_Config : Config_File_Hook := null);
-- Compute the name of the configuration file that should be used. If no -- Compute the name of the configuration file that should be used. If no
-- default configuration file is found, a new one will be automatically -- default configuration file is found, a new one will be automatically
-- generated if Allow_Automatic_Generation is true (otherwise an error -- generated if Allow_Automatic_Generation is true.
-- reported to the user via Osint.Fail). --
-- Any error in generating or parsing the config file is reported via the
-- Invalid_Config exception, with an appropriate message.
-- --
-- On exit, Configuration_Project_Path is never null (if none could be -- On exit, Configuration_Project_Path is never null (if none could be
-- found, Os.Fail was called and the program exited anyway). -- found, Os.Fail was called and the program exited anyway).
......
...@@ -5861,8 +5861,7 @@ package body Prj.Nmsc is ...@@ -5861,8 +5861,7 @@ package body Prj.Nmsc is
-- No Source_Dirs specified: the single source directory is the one -- No Source_Dirs specified: the single source directory is the one
-- containing the project file -- containing the project file
String_Element_Table.Increment_Last String_Element_Table.Increment_Last (In_Tree.String_Elements);
(In_Tree.String_Elements);
Project.Source_Dirs := String_Element_Table.Last Project.Source_Dirs := String_Element_Table.Last
(In_Tree.String_Elements); (In_Tree.String_Elements);
In_Tree.String_Elements.Table (Project.Source_Dirs) := In_Tree.String_Elements.Table (Project.Source_Dirs) :=
...@@ -5875,7 +5874,7 @@ package body Prj.Nmsc is ...@@ -5875,7 +5874,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Attr Write_Attr
("Single source directory", ("Default source directory",
Get_Name_String (Project.Directory.Display_Name)); Get_Name_String (Project.Directory.Display_Name));
end if; end if;
......
...@@ -1218,6 +1218,7 @@ package body Prj.Part is ...@@ -1218,6 +1218,7 @@ package body Prj.Part is
Token_Ptr); Token_Ptr);
end if; end if;
Proj_Qualifier := Configuration;
Scan (In_Tree); Scan (In_Tree);
when others => when others =>
...@@ -1225,8 +1226,18 @@ package body Prj.Part is ...@@ -1225,8 +1226,18 @@ package body Prj.Part is
end case; end case;
end if; end if;
if Is_Config_File and then Proj_Qualifier = Unspecified then
-- Set the qualifier to Configuration, even if the token doesn't
-- exist in the source file itself, so that we can differentiate
-- project files and configuration files later on.
Proj_Qualifier := Configuration;
end if;
if Proj_Qualifier /= Unspecified then if Proj_Qualifier /= Unspecified then
if Is_Config_File then if Is_Config_File
and then Proj_Qualifier /= Configuration
then
Error_Msg ("a configuration project cannot be qualified except " & Error_Msg ("a configuration project cannot be qualified except " &
"as configuration project", "as configuration project",
Qualifier_Location); Qualifier_Location);
......
...@@ -67,6 +67,7 @@ package Prj is ...@@ -67,6 +67,7 @@ package Prj is
(Unspecified, (Unspecified,
Standard, Standard,
Library, Library,
Configuration,
Dry, Dry,
Aggregate, Aggregate,
Aggregate_Library); Aggregate_Library);
...@@ -77,6 +78,7 @@ package Prj is ...@@ -77,6 +78,7 @@ package Prj is
-- Dry: abstract project is -- Dry: abstract project is
-- Aggregate: aggregate project is -- Aggregate: aggregate project is
-- Aggregate_Library: aggregate library project is ... -- Aggregate_Library: aggregate library project is ...
-- Configuration: configuration project is ...
function Get_Mode return Mode; function Get_Mode return Mode;
pragma Inline (Get_Mode); pragma Inline (Get_Mode);
......
...@@ -4759,7 +4759,43 @@ package body Sem_Ch8 is ...@@ -4759,7 +4759,43 @@ package body Sem_Ch8 is
-- Here we have the case of an undefined component -- Here we have the case of an undefined component
else else
Error_Msg_NE ("& not declared in&", N, Selector);
-- The prefix may hide a homonym in the context that
-- declares the desired entity. This error can use a
-- specialized message.
if In_Open_Scopes (P_Name)
and then Present (Homonym (P_Name))
and then Is_Compilation_Unit (Homonym (P_Name))
and then
(Is_Immediately_Visible (Homonym (P_Name))
or else Is_Visible_Child_Unit (Homonym (P_Name)))
then
declare
H : constant Entity_Id := Homonym (P_Name);
begin
Id := First_Entity (H);
while Present (Id) loop
if Chars (Id) = Chars (Selector) then
Error_Msg_Qual_Level := 99;
Error_Msg_Name_1 := Chars (Selector);
Error_Msg_NE
("% not declared in&", N, P_Name);
Error_Msg_NE
("\use fully qualified name starting with"
& " Standard to make& visible", N, H);
Error_Msg_Qual_Level := 0;
exit;
end if;
Next_Entity (Id);
end loop;
end;
else
Error_Msg_NE ("& not declared in&", N, Selector);
end if;
-- Check for misspelling of some entity in prefix -- Check for misspelling of some entity in prefix
......
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