This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Arnaud Charlet <charlet at adacore dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Eric Botcazou <ebotcazou at adacore dot com>
- Date: Thu, 14 Nov 2013 12:57:24 -0800
- Subject: Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec
- Authentication-results: sourceware.org; auth=none
- References: <20131113203213 dot GA1176 at intel dot com> <20131114083820 dot GA27428 at adacore dot com> <CAMe9rOpyx+5Dv_kdUKJpFrPVg7TTqx1cMRw4FN-v3YYuk8RxPg at mail dot gmail dot com> <20131114100216 dot GD19827 at adacore dot com> <CAMe9rOoPj441p7Zt4=XhQx72FG6vSf=pv3Zu39PYBTVE-k+==g at mail dot gmail dot com> <20131114103019 dot GA25699 at adacore dot com> <CAMe9rOobLZz4rc56qaGBqJBw9Gjgis7C-4e1DvQS1n5ce_yVhQ at mail dot gmail dot com> <20131114141639 dot GA5675 at adacore dot com>
On Thu, Nov 14, 2013 at 6:16 AM, Arnaud Charlet <charlet@adacore.com> wrote:
>> I also changed s-osinte-posix.adb and s-osprim-posix.adb
>> for x32. They aren't Linux specific. What should I do with
>> them?
>
> I would use the time_t type defined in s-osinte* (all POSIX implementations
> of s-osinte* have such definition, or if they don't, it's easy to add), and
> in the s-osinte-linux version we can have a renaming:
>
> subtype time_t is System.Linux.time_t
>
> and in System.Linux have either:
>
> type time_t is new Long_Integer;
>
> or
>
> type time_t is new Long_Long_Integer;
>
> depending on the variant.
>
> Arno
Please bear with me. I know next to nothing about Ada.
I tried:
diff --git a/gcc/ada/s-linux.ads b/gcc/ada/s-linux.ads
index c8a7ad1..6244ca7 100644
--- a/gcc/ada/s-linux.ads
+++ b/gcc/ada/s-linux.ads
@@ -38,6 +38,24 @@
package System.Linux is
pragma Preelaborate;
+ ------------
+ -- time_t --
+ ------------
+
+ type time_t is new Long_Integer;
+
+ ---------------
+ -- tv_nsec_t --
+ ---------------
+
+ type tv_nsec_t is new Long_Integer;
+
+ -----------------------
+ -- timeval_element_t --
+ -----------------------
+
+ type timeval_element_t is new Long_Integer;
+
-----------
-- Errno --
-----------
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index a99c4e5..6fbe13a 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -596,11 +596,12 @@ private
type pid_t is new int;
- type time_t is new long;
+ subtype time_t is System.Linux.time_t;
+ subtype tv_nsec_t is System.Linux.tv_nsec_t;
type timespec is record
tv_sec : time_t;
- tv_nsec : long;
+ tv_nsec : tv_nsec_t;
end record;
pragma Convention (C, timespec);
and got
s-osinte.adb:102:17: operator for type "System.Linux.time_t" is not
directly visible
s-osinte.adb:102:17: use clause would make operation legal
s-osinte.adb:107:35: expected type "System.Linux.tv_nsec_t"
s-osinte.adb:107:35: found type "Interfaces.C.long"
make[7]: *** [s-osinte.o] Error 1
How do I resolve this?
Thanks.
--
H.J.