aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-11-30 11:59:09 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-11-30 11:59:09 +0000
commit4f852a1affeb624889e71701bf80f47a08e02361 (patch)
tree37fbde562366c9bfedea43f92975a43268784e0d /gcc
parent2056c5ede5306b0a0ad948d8409c5f7484ee65bf (diff)
downloadgcc-4f852a1affeb624889e71701bf80f47a08e02361.zip
gcc-4f852a1affeb624889e71701bf80f47a08e02361.tar.gz
gcc-4f852a1affeb624889e71701bf80f47a08e02361.tar.bz2
osint.adb: Add use type clause for CRTL.size_t.
* osint.adb: Add use type clause for CRTL.size_t. (C_String_Length): Return CRTL.size_t instead of Integer. (To_Path_String_Access): Take CRTL.size_t instead of Integer. (Get_Libraries_From_Registry): Use CRTL throughout. (To_Canonical_Dir_Spec): Use CRTL.size_t instead of Integer. (To_Canonical_File_List): Likewise. (To_Canonical_File_Spec): Likewise. (To_Canonical_Path_Spec): Likewise. (To_Host_Dir_Spec): Likewise. (To_Host_File_Spec): Likewise. (Update_Path): Use CRTL throughout. * s-shasto.adb: Add with clause for System.CRTL. (Initialize): Rename CRTL.strncpy instead of importing it manually. From-SVN: r231066
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog16
-rw-r--r--gcc/ada/osint.adb65
-rw-r--r--gcc/ada/s-shasto.adb19
3 files changed, 52 insertions, 48 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 34b12ca..eb00a33 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,21 @@
2015-11-30 Eric Botcazou <ebotcazou@adacore.com>
+ * osint.adb: Add use type clause for CRTL.size_t.
+ (C_String_Length): Return CRTL.size_t instead of Integer.
+ (To_Path_String_Access): Take CRTL.size_t instead of Integer.
+ (Get_Libraries_From_Registry): Use CRTL throughout.
+ (To_Canonical_Dir_Spec): Use CRTL.size_t instead of Integer.
+ (To_Canonical_File_List): Likewise.
+ (To_Canonical_File_Spec): Likewise.
+ (To_Canonical_Path_Spec): Likewise.
+ (To_Host_Dir_Spec): Likewise.
+ (To_Host_File_Spec): Likewise.
+ (Update_Path): Use CRTL throughout.
+ * s-shasto.adb: Add with clause for System.CRTL.
+ (Initialize): Rename CRTL.strncpy instead of importing it manually.
+
+2015-11-30 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/gigi.h (create_var_decl): Adjust prototype.
(create_subprog_decl): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Rename
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 6fc9071..dbb438c 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -46,6 +46,8 @@ with GNAT.HTable;
package body Osint is
+ use type CRTL.size_t;
+
Running_Program : Program_Type := Unspecified;
-- comment required here ???
@@ -135,12 +137,12 @@ package body Osint is
-- A version of Smart_Find_File that also returns a cache of the file
-- attributes for later reuse
- function C_String_Length (S : Address) return Integer;
+ function C_String_Length (S : Address) return CRTL.size_t;
-- Returns length of a C string (zero for a null address)
function To_Path_String_Access
(Path_Addr : Address;
- Path_Len : Integer) return String_Access;
+ Path_Len : CRTL.size_t) return String_Access;
-- Converts a C String to an Ada String. Are we doing this to avoid withing
-- Interfaces.C.Strings ???
-- Caller must free result.
@@ -419,27 +421,18 @@ package body Osint is
pragma Import (C, C_Get_Libraries_From_Registry,
"__gnat_get_libraries_from_registry");
- function Strlen (Str : Address) return Integer;
- pragma Import (C, Strlen, "strlen");
-
- procedure Strncpy (X : Address; Y : Address; Length : Integer);
- pragma Import (C, Strncpy, "strncpy");
-
- procedure C_Free (Str : Address);
- pragma Import (C, C_Free, "free");
-
Result_Ptr : Address;
- Result_Length : Integer;
+ Result_Length : CRTL.size_t;
Out_String : String_Ptr;
begin
Result_Ptr := C_Get_Libraries_From_Registry;
- Result_Length := Strlen (Result_Ptr);
+ Result_Length := CRTL.strlen (Result_Ptr);
- Out_String := new String (1 .. Result_Length);
- Strncpy (Out_String.all'Address, Result_Ptr, Result_Length);
+ Out_String := new String (1 .. Integer (Result_Length));
+ CRTL.strncpy (Out_String.all'Address, Result_Ptr, Result_Length);
- C_Free (Result_Ptr);
+ CRTL.free (Result_Ptr);
return Out_String;
end Get_Libraries_From_Registry;
@@ -673,14 +666,12 @@ package body Osint is
-- C_String_Length --
---------------------
- function C_String_Length (S : Address) return Integer is
- function Strlen (S : Address) return Integer;
- pragma Import (C, Strlen, "strlen");
+ function C_String_Length (S : Address) return CRTL.size_t is
begin
if S = Null_Address then
return 0;
else
- return Strlen (S);
+ return CRTL.strlen (S);
end if;
end C_String_Length;
@@ -2959,7 +2950,7 @@ package body Osint is
C_Host_Dir : String (1 .. Host_Dir'Length + 1);
Canonical_Dir_Addr : Address;
- Canonical_Dir_Len : Integer;
+ Canonical_Dir_Len : CRTL.size_t;
begin
C_Host_Dir (1 .. Host_Dir'Length) := Host_Dir;
@@ -3023,7 +3014,7 @@ package body Osint is
declare
Canonical_File_List : String_Access_List (1 .. Num_Files);
Canonical_File_Addr : Address;
- Canonical_File_Len : Integer;
+ Canonical_File_Len : CRTL.size_t;
begin
-- Retrieve the expanded directory names and build the list
@@ -3056,7 +3047,7 @@ package body Osint is
C_Host_File : String (1 .. Host_File'Length + 1);
Canonical_File_Addr : Address;
- Canonical_File_Len : Integer;
+ Canonical_File_Len : CRTL.size_t;
begin
C_Host_File (1 .. Host_File'Length) := Host_File;
@@ -3091,7 +3082,7 @@ package body Osint is
C_Host_Path : String (1 .. Host_Path'Length + 1);
Canonical_Path_Addr : Address;
- Canonical_Path_Len : Integer;
+ Canonical_Path_Len : CRTL.size_t;
begin
C_Host_Path (1 .. Host_Path'Length) := Host_Path;
@@ -3126,7 +3117,7 @@ package body Osint is
C_Canonical_Dir : String (1 .. Canonical_Dir'Length + 1);
Host_Dir_Addr : Address;
- Host_Dir_Len : Integer;
+ Host_Dir_Len : CRTL.size_t;
begin
C_Canonical_Dir (1 .. Canonical_Dir'Length) := Canonical_Dir;
@@ -3158,7 +3149,7 @@ package body Osint is
C_Canonical_File : String (1 .. Canonical_File'Length + 1);
Host_File_Addr : Address;
- Host_File_Len : Integer;
+ Host_File_Len : CRTL.size_t;
begin
C_Canonical_File (1 .. Canonical_File'Length) := Canonical_File;
@@ -3181,9 +3172,9 @@ package body Osint is
function To_Path_String_Access
(Path_Addr : Address;
- Path_Len : Integer) return String_Access
+ Path_Len : CRTL.size_t) return String_Access
is
- subtype Path_String is String (1 .. Path_Len);
+ subtype Path_String is String (1 .. Integer (Path_Len));
type Path_String_Access is access Path_String;
function Address_To_Access is new
@@ -3196,9 +3187,9 @@ package body Osint is
Return_Val : String_Access;
begin
- Return_Val := new String (1 .. Path_Len);
+ Return_Val := new String (1 .. Integer (Path_Len));
- for J in 1 .. Path_Len loop
+ for J in 1 .. Integer (Path_Len) loop
Return_Val (J) := Path_Access (J);
end loop;
@@ -3214,27 +3205,21 @@ package body Osint is
function C_Update_Path (Path, Component : Address) return Address;
pragma Import (C, C_Update_Path, "update_path");
- function Strlen (Str : Address) return Integer;
- pragma Import (C, Strlen, "strlen");
-
- procedure Strncpy (X : Address; Y : Address; Length : Integer);
- pragma Import (C, Strncpy, "strncpy");
-
In_Length : constant Integer := Path'Length;
In_String : String (1 .. In_Length + 1);
Component_Name : aliased String := "GCC" & ASCII.NUL;
Result_Ptr : Address;
- Result_Length : Integer;
+ Result_Length : CRTL.size_t;
Out_String : String_Ptr;
begin
In_String (1 .. In_Length) := Path.all;
In_String (In_Length + 1) := ASCII.NUL;
Result_Ptr := C_Update_Path (In_String'Address, Component_Name'Address);
- Result_Length := Strlen (Result_Ptr);
+ Result_Length := CRTL.strlen (Result_Ptr);
- Out_String := new String (1 .. Result_Length);
- Strncpy (Out_String.all'Address, Result_Ptr, Result_Length);
+ Out_String := new String (1 .. Integer (Result_Length));
+ CRTL.strncpy (Out_String.all'Address, Result_Ptr, Result_Length);
return Out_String;
end Update_Path;
diff --git a/gcc/ada/s-shasto.adb b/gcc/ada/s-shasto.adb
index 2d9b9e8..38787cc 100644
--- a/gcc/ada/s-shasto.adb
+++ b/gcc/ada/s-shasto.adb
@@ -37,6 +37,7 @@ with System.Global_Locks;
with System.Soft_Links;
with System;
+with System.CRTL;
with System.File_Control_Block;
with System.File_IO;
with System.HTable;
@@ -270,24 +271,26 @@ package body System.Shared_Storage is
procedure Get_Env_Value_Ptr (Name, Length, Ptr : Address);
pragma Import (C, Get_Env_Value_Ptr, "__gnat_getenv");
- procedure Strncpy (Astring_Addr, Cstring : Address; N : Integer);
- pragma Import (C, Strncpy, "strncpy");
+ subtype size_t is CRTL.size_t;
+
+ procedure Strncpy (dest, src : System.Address; n : size_t)
+ renames CRTL.strncpy;
Dir_Name : aliased constant String :=
"SHARED_MEMORY_DIRECTORY" & ASCII.NUL;
- Env_Value_Ptr : aliased Address;
- Env_Value_Length : aliased Integer;
+ Env_Value_Ptr : aliased Address;
+ Env_Value_Len : aliased Integer;
begin
if Dir = null then
Get_Env_Value_Ptr
- (Dir_Name'Address, Env_Value_Length'Address, Env_Value_Ptr'Address);
+ (Dir_Name'Address, Env_Value_Len'Address, Env_Value_Ptr'Address);
- Dir := new String (1 .. Env_Value_Length);
+ Dir := new String (1 .. Env_Value_Len);
- if Env_Value_Length > 0 then
- Strncpy (Dir.all'Address, Env_Value_Ptr, Env_Value_Length);
+ if Env_Value_Len > 0 then
+ Strncpy (Dir.all'Address, Env_Value_Ptr, size_t (Env_Value_Len));
end if;
System.Global_Locks.Create_Lock (Global_Lock, Dir.all & "__lock");