From: guerby Date: Mon, 23 Nov 2009 14:56:58 +0000 (+0000) Subject: 2009-11-23 Eric Botcazou X-Git-Tag: upstream/4.9.2~32465 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d3b373b46f6783116567b9b9e75d316ef009201;p=platform%2Fupstream%2Flinaro-gcc.git 2009-11-23 Eric Botcazou Laurent GUERBY PR ada/42153 * s-osinte-linux.ads (struct_timeval): Delete. * s-osinte-hpux.ads (struct_timeval, To_Duration, To_Timeval): Delete. * s-osinte-kfreebsd-gnu.ads: Likewise. * s-osinte-rtems.ads: Likewise. * s-osinte-aix.ads: Likewise. * s-osinte-hpux-dce.ads: Likewise. * s-osinte-darwin.ads: Likewise. * s-osinte-solaris-posix.ads: Likewise. * s-osinte-irix.ads: Likewise. * s-osinte-solaris.ads: Likewise. * s-osinte-hpux-dce.adb (To_Duration, To_Timeval): Delete. * s-osinte-irix.adb: Likewise. * s-osinte-solaris.adb: Likewise. * s-osinte-rtems.adb: Likewise. Minor reformatting. * s-osinte-aix.adb (To_Duration, To_Timeval): Delete. (clock_gettime): Use cal.c timeval_to_duration. * s-osinte-darwin.adb: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154446 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2eaa7ce..02c9efe 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,26 @@ +2009-11-23 Eric Botcazou + Laurent GUERBY + + PR ada/42153 + * s-osinte-linux.ads (struct_timeval): Delete. + * s-osinte-hpux.ads (struct_timeval, To_Duration, To_Timeval): + Delete. + * s-osinte-kfreebsd-gnu.ads: Likewise. + * s-osinte-rtems.ads: Likewise. + * s-osinte-aix.ads: Likewise. + * s-osinte-hpux-dce.ads: Likewise. + * s-osinte-darwin.ads: Likewise. + * s-osinte-solaris-posix.ads: Likewise. + * s-osinte-irix.ads: Likewise. + * s-osinte-solaris.ads: Likewise. + * s-osinte-hpux-dce.adb (To_Duration, To_Timeval): Delete. + * s-osinte-irix.adb: Likewise. + * s-osinte-solaris.adb: Likewise. + * s-osinte-rtems.adb: Likewise. Minor reformatting. + * s-osinte-aix.adb (To_Duration, To_Timeval): Delete. + (clock_gettime): Use cal.c timeval_to_duration. + * s-osinte-darwin.adb: Likewise. + 2009-11-23 Rainer Orth * adaint.h: Assume large file support on IRIX only if _LFAPI. diff --git a/gcc/ada/s-osinte-aix.adb b/gcc/ada/s-osinte-aix.adb index 3c54faf..15b4d63 100644 --- a/gcc/ada/s-osinte-aix.adb +++ b/gcc/ada/s-osinte-aix.adb @@ -48,11 +48,6 @@ package body System.OS_Interface is return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; end To_Duration; - function To_Duration (TV : struct_timeval) return Duration is - begin - return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; - end To_Duration; - ------------------------ -- To_Target_Priority -- ------------------------ @@ -104,31 +99,6 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - ---------------- - -- To_Timeval -- - ---------------- - - function To_Timeval (D : Duration) return struct_timeval is - S : long; - F : Duration; - - begin - S := long (Long_Long_Integer (D)); - F := D - Duration (S); - - -- If F is negative due to a round-up, adjust for positive F value - - if F < 0.0 then - S := S - 1; - F := F + 1.0; - end if; - - return - struct_timeval' - (tv_sec => S, - tv_usec => long (Long_Long_Integer (F * 10#1#E6))); - end To_Timeval; - ------------------- -- clock_gettime -- ------------------- @@ -138,20 +108,37 @@ package body System.OS_Interface is tp : access timespec) return int is - pragma Warnings (Off, clock_id); + pragma Unreferenced (clock_id); + + -- Darwin threads don't have clock_gettime, so use + -- gettimeofday() instead. + + use Interfaces; + + type timeval is array (1 .. 2) of C.long; + + procedure timeval_to_duration + (T : not null access timeval; + sec : not null access C.long; + usec : not null access C.long); + pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration"); + Micro : constant := 10**6; + sec : aliased C.long; + usec : aliased C.long; + TV : aliased timeval; Result : int; - tv : aliased struct_timeval; function gettimeofday - (tv : access struct_timeval; - tz : System.Address := System.Null_Address) - return int; + (Tv : access timeval; + Tz : System.Address := System.Null_Address) return int; pragma Import (C, gettimeofday, "gettimeofday"); begin - Result := gettimeofday (tv'Unchecked_Access); - tp.all := To_Timespec (To_Duration (tv)); + Result := gettimeofday (TV'Access, System.Null_Address); + pragma Assert (Result = 0); + timeval_to_duration (TV'Access, sec'Access, usec'Access); + tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro); return Result; end clock_gettime; diff --git a/gcc/ada/s-osinte-aix.ads b/gcc/ada/s-osinte-aix.ads index b5de4f2..b1639a7 100644 --- a/gcc/ada/s-osinte-aix.ads +++ b/gcc/ada/s-osinte-aix.ads @@ -206,7 +206,6 @@ package System.OS_Interface is function clock_gettime (clock_id : clockid_t; tp : access timespec) return int; - -- AIX threads don't have clock_gettime, so use gettimeofday() instead function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); @@ -221,16 +220,6 @@ package System.OS_Interface is pragma Convention (C, struct_timezone); type struct_timezone_ptr is access all struct_timezone; - type struct_timeval is private; - -- This is needed on systems that do not have clock_gettime() but do have - -- gettimeofday(). - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -554,12 +543,6 @@ private type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; - type struct_timeval is record - tv_sec : long; - tv_usec : long; - end record; - pragma Convention (C, struct_timeval); - type pthread_attr_t is new System.Address; pragma Convention (C, pthread_attr_t); -- typedef struct __pt_attr *pthread_attr_t; diff --git a/gcc/ada/s-osinte-darwin.adb b/gcc/ada/s-osinte-darwin.adb index ac016d0..1f47dde 100644 --- a/gcc/ada/s-osinte-darwin.adb +++ b/gcc/ada/s-osinte-darwin.adb @@ -48,11 +48,6 @@ package body System.OS_Interface is return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; end To_Duration; - function To_Duration (TV : struct_timeval) return Duration is - begin - return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; - end To_Duration; - ------------------------ -- To_Target_Priority -- ------------------------ @@ -88,31 +83,6 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - ---------------- - -- To_Timeval -- - ---------------- - - function To_Timeval (D : Duration) return struct_timeval is - S : time_t; - F : Duration; - - begin - S := time_t (D); - F := D - Duration (S); - - -- If F has negative value due to a round-up, adjust for positive F - -- value. - - if F < 0.0 then - S := S - 1; - F := F + 1.0; - end if; - - return struct_timeval' - (Tv_Sec => S, - tv_usec => int32_t (Long_Long_Integer (F * 10#1#E6))); - end To_Timeval; - ------------------- -- clock_gettime -- ------------------- @@ -122,17 +92,36 @@ package body System.OS_Interface is tp : access timespec) return int is pragma Unreferenced (clock_id); + + -- AIX threads don't have clock_gettime, so use + -- gettimeofday() instead. + + use Interfaces; + + type timeval is array (1 .. 2) of C.long; + + procedure timeval_to_duration + (T : not null access timeval; + sec : not null access C.long; + usec : not null access C.long); + pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration"); + + Micro : constant := 10**6; + sec : aliased C.long; + usec : aliased C.long; + TV : aliased timeval; Result : int; - tv : aliased struct_timeval; function gettimeofday - (tv : access struct_timeval; - tz : System.Address := System.Null_Address) return int; + (Tv : access timeval; + Tz : System.Address := System.Null_Address) return int; pragma Import (C, gettimeofday, "gettimeofday"); begin - Result := gettimeofday (tv'Unchecked_Access); - tp.all := To_Timespec (To_Duration (tv)); + Result := gettimeofday (TV'Access, System.Null_Address); + pragma Assert (Result = 0); + timeval_to_duration (TV'Access, sec'Access, usec'Access); + tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro); return Result; end clock_gettime; diff --git a/gcc/ada/s-osinte-darwin.ads b/gcc/ada/s-osinte-darwin.ads index 71cbe15..99bdc6d 100644 --- a/gcc/ada/s-osinte-darwin.ads +++ b/gcc/ada/s-osinte-darwin.ads @@ -199,14 +199,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -528,12 +520,6 @@ private type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; - type struct_timeval is record - tv_sec : time_t; - tv_usec : int32_t; - end record; - pragma Convention (C, struct_timeval); - -- -- Darwin specific signal implementation -- diff --git a/gcc/ada/s-osinte-hpux-dce.adb b/gcc/ada/s-osinte-hpux-dce.adb index ea8f808..45a5ed1 100644 --- a/gcc/ada/s-osinte-hpux-dce.adb +++ b/gcc/ada/s-osinte-hpux-dce.adb @@ -78,32 +78,6 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - function To_Duration (TV : struct_timeval) return Duration is - begin - return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; - end To_Duration; - - function To_Timeval (D : Duration) return struct_timeval is - S : time_t; - F : Duration; - begin - S := time_t (Long_Long_Integer (D)); - F := D - Duration (S); - - -- If F has negative value due to a round-up, adjust for positive F - -- value. - - if F < 0.0 then - S := S - 1; - F := F + 1.0; - end if; - - return - struct_timeval' - (tv_sec => S, - tv_usec => time_t (Long_Long_Integer (F * 10#1#E6))); - end To_Timeval; - ------------------------- -- POSIX.1c Section 3 -- ------------------------- diff --git a/gcc/ada/s-osinte-hpux-dce.ads b/gcc/ada/s-osinte-hpux-dce.ads index d296cfe..417aae9 100644 --- a/gcc/ada/s-osinte-hpux-dce.ads +++ b/gcc/ada/s-osinte-hpux-dce.ads @@ -207,14 +207,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -459,12 +451,6 @@ private type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 1; - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - type cma_t_address is new System.Address; type cma_t_handle is record diff --git a/gcc/ada/s-osinte-hpux.ads b/gcc/ada/s-osinte-hpux.ads index 29605b8..5c4003d 100644 --- a/gcc/ada/s-osinte-hpux.ads +++ b/gcc/ada/s-osinte-hpux.ads @@ -209,16 +209,6 @@ package System.OS_Interface is pragma Convention (C, struct_timezone); type struct_timezone_ptr is access all struct_timezone; - type struct_timeval is private; - -- This is needed on systems that do not have clock_gettime() - -- but do have gettimeofday(). - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -535,12 +525,6 @@ private type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 1; - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - type pthread_attr_t is new int; type pthread_condattr_t is new int; type pthread_mutexattr_t is new int; diff --git a/gcc/ada/s-osinte-irix.adb b/gcc/ada/s-osinte-irix.adb index d63ee9c..cc3e015 100644 --- a/gcc/ada/s-osinte-irix.adb +++ b/gcc/ada/s-osinte-irix.adb @@ -60,11 +60,6 @@ package body System.OS_Interface is return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; end To_Duration; - function To_Duration (TV : struct_timeval) return Duration is - begin - return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; - end To_Duration; - ----------------- -- To_Timespec -- ----------------- @@ -89,30 +84,4 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - ---------------- - -- To_Timeval -- - ---------------- - - function To_Timeval (D : Duration) return struct_timeval is - S : time_t; - F : Duration; - - begin - S := time_t (Long_Long_Integer (D)); - F := D - Duration (S); - - -- If F has negative value due to a round-up, adjust for positive F - -- value. - - if F < 0.0 then - S := S - 1; - F := F + 1.0; - end if; - - return - struct_timeval' - (tv_sec => S, - tv_usec => time_t (Long_Long_Integer (F * 10#1#E6))); - end To_Timeval; - end System.OS_Interface; diff --git a/gcc/ada/s-osinte-irix.ads b/gcc/ada/s-osinte-irix.ads index 5432656..7231c39 100644 --- a/gcc/ada/s-osinte-irix.ads +++ b/gcc/ada/s-osinte-irix.ads @@ -201,14 +201,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -493,12 +485,6 @@ private CLOCK_SGI_CYCLE : constant clockid_t := 2; CLOCK_SGI_FAST : constant clockid_t := 3; - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - type array_type_9 is array (Integer range 0 .. 4) of long; type pthread_attr_t is record X_X_D : array_type_9; diff --git a/gcc/ada/s-osinte-kfreebsd-gnu.ads b/gcc/ada/s-osinte-kfreebsd-gnu.ads index e85af99..958d421 100644 --- a/gcc/ada/s-osinte-kfreebsd-gnu.ads +++ b/gcc/ada/s-osinte-kfreebsd-gnu.ads @@ -208,19 +208,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - - function gettimeofday - (tv : access struct_timeval; - tz : System.Address := System.Null_Address) return int; - pragma Import (C, gettimeofday, "gettimeofday"); - function sysconf (name : int) return long; pragma Import (C, sysconf); @@ -511,12 +498,6 @@ private end record; pragma Convention (C, timespec); - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - type pthread_attr_t is record detachstate : int; schedpolicy : int; diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads index 2a620c5..323fc15 100644 --- a/gcc/ada/s-osinte-linux.ads +++ b/gcc/ada/s-osinte-linux.ads @@ -518,12 +518,6 @@ private end record; pragma Convention (C, timespec); - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - type pthread_attr_t is record detachstate : int; schedpolicy : int; diff --git a/gcc/ada/s-osinte-rtems.adb b/gcc/ada/s-osinte-rtems.adb index ab98de5..d8e57f6 100644 --- a/gcc/ada/s-osinte-rtems.adb +++ b/gcc/ada/s-osinte-rtems.adb @@ -89,35 +89,19 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - function To_Duration (TV : struct_timeval) return Duration is - begin - return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; - end To_Duration; - - function To_Timeval (D : Duration) return struct_timeval is - S : int; - F : Duration; - begin - S := int (Long_Long_Integer (D)); - F := D - Duration (S); - - -- If F has negative value due to a round-up, adjust for positive F - -- value. - if F < 0.0 then - S := S - 1; - F := F + 1.0; - end if; - return - struct_timeval' - (tv_sec => S, - tv_usec => int (Long_Long_Integer (F * 10#1#E6))); - end To_Timeval; + ------------------ + -- pthread_init -- + ------------------ procedure pthread_init is begin null; end pthread_init; + -------------------- + -- Get_Stack_Base -- + -------------------- + function Get_Stack_Base (thread : pthread_t) return Address is pragma Warnings (Off, thread); @@ -125,6 +109,10 @@ package body System.OS_Interface is return Null_Address; end Get_Stack_Base; + ----------------- + -- sigaltstack -- + ----------------- + function sigaltstack (ss : not null access stack_t; oss : access stack_t) return int is diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads index 70e4a27..eb8b17d 100644 --- a/gcc/ada/s-osinte-rtems.ads +++ b/gcc/ada/s-osinte-rtems.ads @@ -191,14 +191,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -595,12 +587,6 @@ private type clockid_t is new rtems_id; CLOCK_REALTIME : constant clockid_t := 1; - type struct_timeval is record - tv_sec : int; - tv_usec : int; - end record; - pragma Convention (C, struct_timeval); - type pthread_attr_t is record is_initialized : int; stackaddr : System.Address; diff --git a/gcc/ada/s-osinte-solaris-posix.ads b/gcc/ada/s-osinte-solaris-posix.ads index ae31806..c5885e7 100644 --- a/gcc/ada/s-osinte-solaris-posix.ads +++ b/gcc/ada/s-osinte-solaris-posix.ads @@ -204,14 +204,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------------------- -- Priority Scheduling -- ------------------------- @@ -524,12 +516,6 @@ private type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; - type struct_timeval is record - tv_sec : time_t; - tv_usec : time_t; - end record; - pragma Convention (C, struct_timeval); - type pthread_attr_t is record pthread_attrp : System.Address; end record; diff --git a/gcc/ada/s-osinte-solaris.adb b/gcc/ada/s-osinte-solaris.adb index b9997bf..3f40bc6 100644 --- a/gcc/ada/s-osinte-solaris.adb +++ b/gcc/ada/s-osinte-solaris.adb @@ -77,40 +77,6 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - ----------------- - -- To_Duration -- - ----------------- - - function To_Duration (TV : struct_timeval) return Duration is - begin - return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; - end To_Duration; - - ---------------- - -- To_Timeval -- - ---------------- - - function To_Timeval (D : Duration) return struct_timeval is - S : long; - F : Duration; - - begin - S := long (Long_Long_Integer (D)); - F := D - Duration (S); - - -- If F has negative value due to a round-up, adjust for positive F - - if F < 0.0 then - S := S - 1; - F := F + 1.0; - end if; - - return - struct_timeval' - (tv_sec => S, - tv_usec => long (Long_Long_Integer (F * 10#1#E6))); - end To_Timeval; - ------------------ -- pthread_init -- ------------------ diff --git a/gcc/ada/s-osinte-solaris.ads b/gcc/ada/s-osinte-solaris.ads index a937f6e..0728b18 100644 --- a/gcc/ada/s-osinte-solaris.ads +++ b/gcc/ada/s-osinte-solaris.ads @@ -263,16 +263,6 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); - type struct_timeval is private; - -- This is needed on systems that do not have clock_gettime() - -- but do have gettimeofday(). - - function To_Duration (TV : struct_timeval) return Duration; - pragma Inline (To_Duration); - - function To_Timeval (D : Duration) return struct_timeval; - pragma Inline (To_Timeval); - ------------- -- Process -- ------------- @@ -528,12 +518,6 @@ private type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; - type struct_timeval is record - tv_sec : long; - tv_usec : long; - end record; - pragma Convention (C, struct_timeval); - type array_type_9 is array (0 .. 3) of unsigned_char; type record_type_3 is record flag : array_type_9;