+2018-05-29 Bob Duff <duff@adacore.com>
+
+ * lib-writ.adb (Write_ALI): Cleanup: avoid use of global var; call new
+ To_Lower function.
+ * libgnat/s-casuti.ads, libgnat/s-casuti.adb (To_Upper, To_Lower,
+ To_Mixed): New functions.
+ * osint.adb: Cleanup: use Is_Directory_Separator, which correctly
+ allows both '\' and '/' on Windows.
+
2018-05-28 Eric Botcazou <ebotcazou@adacore.com>
* repinfo.ads: Minor fixes and tweaks in comments.
-- Normal case of a unit entry with a source index
if Sind > No_Source_File then
- Fname := File_Name (Sind);
+ -- We never want directory information in ALI files
+ -- ???But back out this change temporarily until
+ -- gprbuild is fixed.
- -- Ensure that on platforms where the file names are not case
- -- sensitive, the recorded file name is in lower case.
+ if False then
+ Fname := Strip_Directory (File_Name (Sind));
+ else
+ Fname := File_Name (Sind);
+ end if;
+
+ -- Ensure that on platforms where the file names are not
+ -- case sensitive, the recorded file name is in lower case.
if not File_Names_Case_Sensitive then
- Get_Name_String (Fname);
- To_Lower (Name_Buffer (1 .. Name_Len));
- Fname := Name_Find;
+ Fname := Name_Find (To_Lower (Get_Name_String (Fname)));
end if;
Write_Info_Name_May_Be_Quoted (Fname);
end loop;
end To_Lower;
+ function To_Lower (A : String) return String is
+ Result : String := A;
+ begin
+ To_Lower (Result);
+ return Result;
+ end To_Lower;
+
--------------
-- To_Mixed --
--------------
end loop;
end To_Mixed;
+ function To_Mixed (A : String) return String is
+ Result : String := A;
+ begin
+ To_Mixed (Result);
+ return Result;
+ end To_Mixed;
+
--------------
-- To_Upper --
--------------
end loop;
end To_Upper;
+ function To_Upper (A : String) return String is
+ Result : String := A;
+ begin
+ To_Upper (Result);
+ return Result;
+ end To_Upper;
+
end System.Case_Util;
-- returns the input argument unchanged.
procedure To_Upper (A : in out String);
+ function To_Upper (A : String) return String;
-- Folds all characters of string A to upper case
function To_Lower (A : Character) return Character;
-- returns the input argument unchanged.
procedure To_Lower (A : in out String);
+ function To_Lower (A : String) return String;
-- Folds all characters of string A to lower case
procedure To_Mixed (A : in out String);
+ function To_Mixed (A : String) return String;
-- Converts A to mixed case (i.e. lower case, except for initial
-- character and any character after an underscore, which are
-- converted to upper case.
Add_Suffix := False;
exit;
- elsif Name_Buffer (J) = '/' or else
- Name_Buffer (J) = Directory_Separator
- then
+ elsif Is_Directory_Separator (Name_Buffer (J)) then
exit;
end if;
end loop;
Add_Suffix := False;
exit;
- elsif Canonical_Name (J) = '/' or else
- Canonical_Name (J) = Directory_Separator
- then
+ elsif Is_Directory_Separator (Canonical_Name (J)) then
exit;
end if;
end loop;
-- Add a directory separator at the end of the directory if necessary
-- so that we can directly append a file to the directory
- if Search_Dir (Search_Dir'Last) /= Directory_Separator then
+ if not Is_Directory_Separator (Search_Dir (Search_Dir'Last)) then
Local_Search_Dir :=
new String'(Search_Dir & String'(1 => Directory_Separator));
else
raise Program_Error;
end if;
- if Buffer (Path_Len) /= Directory_Separator then
+ if not Is_Directory_Separator (Buffer (Path_Len)) then
Path_Len := Path_Len + 1;
Buffer (Path_Len) := Directory_Separator;
end if;
Fptr := File_Name'First;
for J in reverse File_Name'Range loop
- if File_Name (J) = Directory_Separator
- or else File_Name (J) = '/'
- then
+ if Is_Directory_Separator (File_Name (J)) then
if J = File_Name'Last then
Fail ("File name missing");
end if;
-- Ditto for suffix, e.g. in "gcc-4.1", the suffix is "-4.1"
for J in reverse 1 .. Name_Len loop
- if Name_Buffer (J) = '/'
- or else Name_Buffer (J) = Directory_Separator
+ if Is_Directory_Separator (Name_Buffer (J))
or else Name_Buffer (J) = ':'
then
Start_Of_Prefix := J + 1;