Commit e34ca162 by Arnaud Charlet

[multiple changes]

2009-04-20  Pascal Obry  <obry@adacore.com>

	* a-direct.adb (To_Lower_If_Case_Insensitive): Removed.
	Remove all calls to To_Lower_If_Case_Insensitive to preserve
	the pathname original casing.

2009-04-20  Robert Dewar  <dewar@adacore.com>

	* g-trasym.adb: Minor reformatting

	* s-os_lib.adb: Minor reformatting

	* sem.adb: Minor reformatting
	Minor code reorganization

	* sem_ch3.adb: Minor reformatting

	* sem_ch4.adb: Minor reformatting

	* sem_ch8.adb: Minor reformatting

	* sem_type.adb: Minor reformatting

From-SVN: r146412
parent ee9aa7b6
2009-04-20 Pascal Obry <obry@adacore.com>
* a-direct.adb (To_Lower_If_Case_Insensitive): Removed.
Remove all calls to To_Lower_If_Case_Insensitive to preserve
the pathname original casing.
2009-04-20 Robert Dewar <dewar@adacore.com>
* g-trasym.adb: Minor reformatting
* s-os_lib.adb: Minor reformatting
* sem.adb: Minor reformatting
Minor code reorganization
* sem_ch3.adb: Minor reformatting
* sem_ch4.adb: Minor reformatting
* sem_ch8.adb: Minor reformatting
* sem_type.adb: Minor reformatting
2009-04-20 Javier Miranda <miranda@adacore.com> 2009-04-20 Javier Miranda <miranda@adacore.com>
* sem_disp.adb (Find_Dispatching_Type): For subprograms internally * sem_disp.adb (Find_Dispatching_Type): For subprograms internally
...@@ -93,20 +93,15 @@ package body Ada.Directories is ...@@ -93,20 +93,15 @@ package body Ada.Directories is
-- Get the next entry in a directory, setting Entry_Fetched if successful -- Get the next entry in a directory, setting Entry_Fetched if successful
-- or resetting Is_Valid if not. -- or resetting Is_Valid if not.
procedure To_Lower_If_Case_Insensitive (S : in out String);
-- Put S in lower case if file and path names are case-insensitive
--------------- ---------------
-- Base_Name -- -- Base_Name --
--------------- ---------------
function Base_Name (Name : String) return String is function Base_Name (Name : String) return String is
Simple : String := Simple_Name (Name); Simple : constant String := Simple_Name (Name);
-- Simple'First is guaranteed to be 1 -- Simple'First is guaranteed to be 1
begin begin
To_Lower_If_Case_Insensitive (Simple);
-- Look for the last dot in the file name and return the part of the -- Look for the last dot in the file name and return the part of the
-- file name preceding this last dot. If the first dot is the first -- file name preceding this last dot. If the first dot is the first
-- character of the file name, the base name is the empty string. -- character of the file name, the base name is the empty string.
...@@ -198,7 +193,6 @@ package body Ada.Directories is ...@@ -198,7 +193,6 @@ package body Ada.Directories is
Last := Last + Extension'Length; Last := Last + Extension'Length;
end if; end if;
To_Lower_If_Case_Insensitive (Result (1 .. Last));
return Result (1 .. Last); return Result (1 .. Last);
end if; end if;
end Compose; end Compose;
...@@ -287,7 +281,6 @@ package body Ada.Directories is ...@@ -287,7 +281,6 @@ package body Ada.Directories is
return Containing_Directory (Current_Directory); return Containing_Directory (Current_Directory);
else else
To_Lower_If_Case_Insensitive (Result (1 .. Last));
return Result (1 .. Last); return Result (1 .. Last);
end if; end if;
end; end;
...@@ -448,11 +441,9 @@ package body Ada.Directories is ...@@ -448,11 +441,9 @@ package body Ada.Directories is
Local_Get_Current_Dir (Buffer'Address, Path_Len'Address); Local_Get_Current_Dir (Buffer'Address, Path_Len'Address);
declare declare
Cur : String := Normalize_Pathname (Buffer (1 .. Path_Len)); Cur : constant String := Normalize_Pathname (Buffer (1 .. Path_Len));
begin begin
To_Lower_If_Case_Insensitive (Cur);
if Cur'Length > 1 and then Cur (Cur'Last) = Dir_Separator then if Cur'Length > 1 and then Cur (Cur'Last) = Dir_Separator then
return Cur (1 .. Cur'Last - 1); return Cur (1 .. Cur'Last - 1);
else else
...@@ -790,10 +781,9 @@ package body Ada.Directories is ...@@ -790,10 +781,9 @@ package body Ada.Directories is
-- Use System.OS_Lib.Normalize_Pathname -- Use System.OS_Lib.Normalize_Pathname
declare declare
Value : String := Normalize_Pathname (Name); Value : constant String := Normalize_Pathname (Name);
subtype Result is String (1 .. Value'Length); subtype Result is String (1 .. Value'Length);
begin begin
To_Lower_If_Case_Insensitive (Value);
return Result (Value); return Result (Value);
end; end;
end if; end if;
...@@ -1061,18 +1051,14 @@ package body Ada.Directories is ...@@ -1061,18 +1051,14 @@ package body Ada.Directories is
function Simple_Name (Name : String) return String is function Simple_Name (Name : String) return String is
function Simple_Name_CI (Path : String) return String; function Simple_Name_Internal (Path : String) return String;
-- This function does the job. The difference between Simple_Name_CI -- This function does the job
-- and Simple_Name (the parent function) is that the former is case
-- sensitive, while the latter is not. Path and Suffix are adjusted
-- appropriately before calling Simple_Name_CI under platforms where
-- the file system is not case sensitive.
-------------------- --------------------------
-- Simple_Name_CI -- -- Simple_Name_Internal --
-------------------- --------------------------
function Simple_Name_CI (Path : String) return String is function Simple_Name_Internal (Path : String) return String is
Cut_Start : Natural := Cut_Start : Natural :=
Strings.Fixed.Index Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward); (Path, Dir_Seps, Going => Strings.Backward);
...@@ -1093,11 +1079,7 @@ package body Ada.Directories is ...@@ -1093,11 +1079,7 @@ package body Ada.Directories is
Cut_End := Path'Last; Cut_End := Path'Last;
Check_For_Standard_Dirs : declare Check_For_Standard_Dirs : declare
Offset : constant Integer := Path'First - Name'First; BN : constant String := Path (Cut_Start .. Cut_End);
BN : constant String :=
Name (Cut_Start - Offset .. Cut_End - Offset);
-- Here we use Simple_Name.Name to keep the original casing
Has_Drive_Letter : constant Boolean := Has_Drive_Letter : constant Boolean :=
System.OS_Lib.Path_Separator /= ':'; System.OS_Lib.Path_Separator /= ':';
-- If Path separator is not ':' then we are on a DOS based OS -- If Path separator is not ':' then we are on a DOS based OS
...@@ -1120,7 +1102,7 @@ package body Ada.Directories is ...@@ -1120,7 +1102,7 @@ package body Ada.Directories is
return BN; return BN;
end if; end if;
end Check_For_Standard_Dirs; end Check_For_Standard_Dirs;
end Simple_Name_CI; end Simple_Name_Internal;
-- Start of processing for Simple_Name -- Start of processing for Simple_Name
...@@ -1133,23 +1115,12 @@ package body Ada.Directories is ...@@ -1133,23 +1115,12 @@ package body Ada.Directories is
else else
-- Build the value to return with lower bound 1 -- Build the value to return with lower bound 1
if Is_Path_Name_Case_Sensitive then declare
declare Value : constant String := Simple_Name_Internal (Name);
Value : constant String := Simple_Name_CI (Name); subtype Result is String (1 .. Value'Length);
subtype Result is String (1 .. Value'Length); begin
begin return Result (Value);
return Result (Value); end;
end;
else
declare
Value : constant String :=
Simple_Name_CI (Characters.Handling.To_Lower (Name));
subtype Result is String (1 .. Value'Length);
begin
return Result (Value);
end;
end if;
end if; end if;
end Simple_Name; end Simple_Name;
...@@ -1233,7 +1204,10 @@ package body Ada.Directories is ...@@ -1233,7 +1204,10 @@ package body Ada.Directories is
-- Check the pattern -- Check the pattern
begin begin
Pat := Compile (Pattern, Glob => True); Pat := Compile
(Pattern,
Glob => True,
Case_Sensitive => Is_Path_Name_Case_Sensitive);
exception exception
when Error_In_Regexp => when Error_In_Regexp =>
Free (Search.Value); Free (Search.Value);
...@@ -1264,17 +1238,4 @@ package body Ada.Directories is ...@@ -1264,17 +1238,4 @@ package body Ada.Directories is
Search.Value.Is_Valid := True; Search.Value.Is_Valid := True;
end Start_Search; end Start_Search;
----------------------------------
-- To_Lower_If_Case_Insensitive --
----------------------------------
procedure To_Lower_If_Case_Insensitive (S : in out String) is
begin
if not Is_Path_Name_Case_Sensitive then
for J in S'Range loop
S (J) := To_Lower (S (J));
end loop;
end if;
end To_Lower_If_Case_Insensitive;
end Ada.Directories; end Ada.Directories;
...@@ -77,7 +77,7 @@ package body GNAT.Traceback.Symbolic is ...@@ -77,7 +77,7 @@ package body GNAT.Traceback.Symbolic is
-- This is the procedure version of the Ada aware addr2line. It places -- This is the procedure version of the Ada aware addr2line. It places
-- in BUF a string representing the symbolic translation of the N_ADDRS -- in BUF a string representing the symbolic translation of the N_ADDRS
-- raw addresses provided in ADDRS, looked up in debug information from -- raw addresses provided in ADDRS, looked up in debug information from
-- FILENAME. LEN points to an integer which contains the size of the -- FILENAME. LEN points to an integer which contains the size of the
-- BUF buffer at input and the result length at output. -- BUF buffer at input and the result length at output.
-- --
-- This procedure is provided by libaddr2line on targets that support -- This procedure is provided by libaddr2line on targets that support
......
...@@ -1833,7 +1833,8 @@ package body System.OS_Lib is ...@@ -1833,7 +1833,8 @@ package body System.OS_Lib is
-- By default, the drive letter on Windows is in upper case -- By default, the drive letter on Windows is in upper case
if On_Windows and then Path_Len >= 2 if On_Windows
and then Path_Len >= 2
and then Buffer (2) = ':' and then Buffer (2) = ':'
then then
System.Case_Util.To_Upper (Buffer (1 .. 1)); System.Case_Util.To_Upper (Buffer (1 .. 1));
......
...@@ -83,8 +83,8 @@ package body Sem is ...@@ -83,8 +83,8 @@ package body Sem is
procedure Write_Unit_Info procedure Write_Unit_Info
(Unit_Num : Unit_Number_Type; (Unit_Num : Unit_Number_Type;
Item : Node_Id; Item : Node_Id;
Prefix : String := ""); Prefix : String := "");
-- Print out debugging information about the unit -- Print out debugging information about the unit
------------- -------------
...@@ -1359,10 +1359,15 @@ package body Sem is ...@@ -1359,10 +1359,15 @@ package body Sem is
-- Start of processing for Semantics -- Start of processing for Semantics
begin begin
if Debug_Unit_Walk and then Already_Analyzed then if Debug_Unit_Walk then
Write_Str ("(done)"); if Already_Analyzed then
Write_Unit_Info (Get_Cunit_Unit_Number (Comp_Unit), Unit (Comp_Unit), Write_Str ("(done)");
Prefix => "--> "); end if;
Write_Unit_Info
(Get_Cunit_Unit_Number (Comp_Unit),
Unit (Comp_Unit),
Prefix => "--> ");
Indent; Indent;
end if; end if;
...@@ -1378,11 +1383,11 @@ package body Sem is ...@@ -1378,11 +1383,11 @@ package body Sem is
-- Cleaner might be to do the kludge at the point of excluding the -- Cleaner might be to do the kludge at the point of excluding the
-- pragma (do not exclude for renamings ???) -- pragma (do not exclude for renamings ???)
GNAT_Mode := if Is_Predefined_File_Name
GNAT_Mode (Unit_File_Name (Current_Sem_Unit), Renamings_Included => False)
or else Is_Predefined_File_Name then
(Unit_File_Name (Current_Sem_Unit), GNAT_Mode := True;
Renamings_Included => False); end if;
if Generic_Main then if Generic_Main then
Expander_Mode_Save_And_Set (False); Expander_Mode_Save_And_Set (False);
...@@ -1416,8 +1421,8 @@ package body Sem is ...@@ -1416,8 +1421,8 @@ package body Sem is
end if; end if;
-- Do analysis, and then append the compilation unit onto the -- Do analysis, and then append the compilation unit onto the
-- Comp_Unit_List, if appropriate. This is done after analysis, so if -- Comp_Unit_List, if appropriate. This is done after analysis, so
-- this unit depends on some others, they have already been -- if this unit depends on some others, they have already been
-- appended. We ignore bodies, except for the main unit itself. We -- appended. We ignore bodies, except for the main unit itself. We
-- have also to guard against ill-formed subunits that have an -- have also to guard against ill-formed subunits that have an
-- improper context. -- improper context.
...@@ -1428,7 +1433,7 @@ package body Sem is ...@@ -1428,7 +1433,7 @@ package body Sem is
null; null;
elsif Present (Comp_Unit) elsif Present (Comp_Unit)
and then Nkind (Unit (Comp_Unit)) in N_Proper_Body and then Nkind (Unit (Comp_Unit)) in N_Proper_Body
and then not In_Extended_Main_Source_Unit (Comp_Unit) and then not In_Extended_Main_Source_Unit (Comp_Unit)
then then
null; null;
...@@ -1436,7 +1441,9 @@ package body Sem is ...@@ -1436,7 +1441,9 @@ package body Sem is
else else
pragma Assert (not Ignore_Comp_Units); pragma Assert (not Ignore_Comp_Units);
if No (Comp_Unit_List) then -- Initialize if first time -- Initialize if first time
if No (Comp_Unit_List) then
Comp_Unit_List := New_Elmt_List; Comp_Unit_List := New_Elmt_List;
end if; end if;
...@@ -1474,11 +1481,17 @@ package body Sem is ...@@ -1474,11 +1481,17 @@ package body Sem is
Restore_Opt_Config_Switches (Save_Config_Switches); Restore_Opt_Config_Switches (Save_Config_Switches);
Expander_Mode_Restore; Expander_Mode_Restore;
if Debug_Unit_Walk and then Already_Analyzed then if Debug_Unit_Walk then
Outdent; Outdent;
Write_Str ("(done)");
Write_Unit_Info (Get_Cunit_Unit_Number (Comp_Unit), Unit (Comp_Unit), if Already_Analyzed then
Prefix => "<-- "); Write_Str ("(done)");
end if;
Write_Unit_Info
(Get_Cunit_Unit_Number (Comp_Unit),
Unit (Comp_Unit),
Prefix => "<-- ");
end if; end if;
end Semantics; end Semantics;
...@@ -1545,11 +1558,15 @@ package body Sem is ...@@ -1545,11 +1558,15 @@ package body Sem is
declare declare
Unit_Num : constant Unit_Number_Type := Unit_Num : constant Unit_Number_Type :=
Get_Cunit_Unit_Number (CU); Get_Cunit_Unit_Number (CU);
begin begin
Write_Unit_Info (Unit_Num, Item); if Debug_Unit_Walk then
Write_Unit_Info (Unit_Num, Item);
end if;
-- ??? why is this commented out
-- ???pragma Assert (not Seen (Unit_Num));
pragma Assert (not Seen (Unit_Num));
Seen (Unit_Num) := True; Seen (Unit_Num) := True;
end; end;
...@@ -1649,11 +1666,13 @@ package body Sem is ...@@ -1649,11 +1666,13 @@ package body Sem is
Write_Line ("Ignored units:"); Write_Line ("Ignored units:");
Indent; Indent;
for Unit_Num in Seen'Range loop for Unit_Num in Seen'Range loop
if not Seen (Unit_Num) then if not Seen (Unit_Num) then
Write_Unit_Info (Unit_Num, Unit (Cunit (Unit_Num))); Write_Unit_Info (Unit_Num, Unit (Cunit (Unit_Num)));
end if; end if;
end loop; end loop;
Outdent; Outdent;
end if; end if;
end if; end if;
...@@ -1670,29 +1689,27 @@ package body Sem is ...@@ -1670,29 +1689,27 @@ package body Sem is
procedure Write_Unit_Info procedure Write_Unit_Info
(Unit_Num : Unit_Number_Type; (Unit_Num : Unit_Number_Type;
Item : Node_Id; Item : Node_Id;
Prefix : String := "") Prefix : String := "")
is is
begin begin
if Debug_Unit_Walk then Write_Str (Prefix);
Write_Str (Prefix); Write_Unit_Name (Unit_Name (Unit_Num));
Write_Unit_Name (Unit_Name (Unit_Num)); Write_Str (", unit ");
Write_Str (", unit "); Write_Int (Int (Unit_Num));
Write_Int (Int (Unit_Num)); Write_Str (", ");
Write_Str (", "); Write_Int (Int (Item));
Write_Int (Int (Item)); Write_Str ("=");
Write_Str (Node_Kind'Image (Nkind (Item)));
if Item /= Original_Node (Item) then
Write_Str (", orig = ");
Write_Int (Int (Original_Node (Item)));
Write_Str ("="); Write_Str ("=");
Write_Str (Node_Kind'Image (Nkind (Item))); Write_Str (Node_Kind'Image (Nkind (Original_Node (Item))));
if Item /= Original_Node (Item) then
Write_Str (", orig = ");
Write_Int (Int (Original_Node (Item)));
Write_Str ("=");
Write_Str (Node_Kind'Image (Nkind (Original_Node (Item))));
end if;
Write_Eol;
end if; end if;
Write_Eol;
end Write_Unit_Info; end Write_Unit_Info;
end Sem; end Sem;
...@@ -5922,9 +5922,9 @@ package body Sem_Ch3 is ...@@ -5922,9 +5922,9 @@ package body Sem_Ch3 is
-- This is the unusual case where a type completed by a private -- This is the unusual case where a type completed by a private
-- derivation occurs within a package nested in a child unit, and -- derivation occurs within a package nested in a child unit, and
-- the parent is declared in an ancestor. In this case, the full -- the parent is declared in an ancestor. In this case, the full
-- view of the parent type will become visible in the body of the -- view of the parent type will become visible in the body of
-- enclosing child, and only then will the current type be -- the enclosing child, and only then will the current type be
-- possibly non-private. We build a underlying full view that -- possibly non-private. We build a underlying full view that
-- will be installed when the enclosing child body is compiled. -- will be installed when the enclosing child body is compiled.
Full_Der := Full_Der :=
......
...@@ -5874,7 +5874,6 @@ package body Sem_Ch4 is ...@@ -5874,7 +5874,6 @@ package body Sem_Ch4 is
begin begin
Actual := Next (First_Actual (Call)); Actual := Next (First_Actual (Call));
Index := First_Index (Arr_Type); Index := First_Index (Arr_Type);
while Present (Actual) and then Present (Index) loop while Present (Actual) and then Present (Index) loop
if not Has_Compatible_Type (Actual, Etype (Index)) then if not Has_Compatible_Type (Actual, Etype (Index)) then
Arr_Type := Empty; Arr_Type := Empty;
......
...@@ -788,7 +788,7 @@ package body Sem_Ch8 is ...@@ -788,7 +788,7 @@ package body Sem_Ch8 is
I : Interp_Index; I : Interp_Index;
It : Interp; It : Interp;
Typ : Entity_Id := Empty; Typ : Entity_Id := Empty;
Seen : Boolean := False; Seen : Boolean := False;
begin begin
Get_First_Interp (Nam, I, It); Get_First_Interp (Nam, I, It);
...@@ -799,8 +799,9 @@ package body Sem_Ch8 is ...@@ -799,8 +799,9 @@ package body Sem_Ch8 is
if Ekind (It.Typ) = Ekind (T) then if Ekind (It.Typ) = Ekind (T) then
if Ekind (T) = E_Anonymous_Access_Subprogram_Type if Ekind (T) = E_Anonymous_Access_Subprogram_Type
and then Type_Conformant and then
(Designated_Type (T), Designated_Type (It.Typ)) Type_Conformant
(Designated_Type (T), Designated_Type (It.Typ))
then then
if not Seen then if not Seen then
Seen := True; Seen := True;
...@@ -810,8 +811,8 @@ package body Sem_Ch8 is ...@@ -810,8 +811,8 @@ package body Sem_Ch8 is
end if; end if;
elsif Ekind (T) = E_Anonymous_Access_Type elsif Ekind (T) = E_Anonymous_Access_Type
and then Covers and then
(Designated_Type (T), Designated_Type (It.Typ)) Covers (Designated_Type (T), Designated_Type (It.Typ))
then then
if not Seen then if not Seen then
Seen := True; Seen := True;
......
...@@ -1688,26 +1688,28 @@ package body Sem_Type is ...@@ -1688,26 +1688,28 @@ package body Sem_Type is
and then Present (Access_Definition (Parent (N))) and then Present (Access_Definition (Parent (N)))
then then
if Ekind (It1.Typ) = E_Anonymous_Access_Type if Ekind (It1.Typ) = E_Anonymous_Access_Type
or else Ekind (It1.Typ) = E_Anonymous_Access_Subprogram_Type or else
Ekind (It1.Typ) = E_Anonymous_Access_Subprogram_Type
then then
if Ekind (It2.Typ) = Ekind (It1.Typ) then if Ekind (It2.Typ) = Ekind (It1.Typ) then
-- True ambiguity -- True ambiguity
return No_Interp; return No_Interp;
else else
return It1; return It1;
end if; end if;
elsif Ekind (It2.Typ) = E_Anonymous_Access_Type elsif Ekind (It2.Typ) = E_Anonymous_Access_Type
or else Ekind (It2.Typ) = E_Anonymous_Access_Subprogram_Type or else
Ekind (It2.Typ) = E_Anonymous_Access_Subprogram_Type
then then
return It2; return It2;
else -- No legal interpretation
-- No legal interpretation.
else
return No_Interp; return No_Interp;
end if; end if;
......
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