[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8



On Sun, 2014-03-23 at 19:13 +0100, Ludovic Brenta wrote:
> Ludovic Brenta writes:
> > Svante Signell <svante.signell@gmail.com> writes:
> >> Ping, adding this bug report to debian-ada too. Who is Ada upstream?
> >
> > Patience.  I'm waiting for Matthias to upload a newer gcc-4.9-source
> > containing the fix for your bug #740153, then I will upload a gnat-4.9
> > incorporating this and your patch.
> 
> Now that the newer gcc-4.9 has been uploaded, I am reviewing this issue
> and I discovered that the change you complain about was in fact made
> upstream (that was not clear to me from your bug report):
> 
> commit e3a1f6b50495473f677f413d8740808a3fde5a9a
> Author: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Fri Nov 15 12:06:25 2013 +0000
> 
>     Add and use System.Linux.time_t for time_t
>     
>     	PR ada/54040

>     	* s-osinte-linux.ads (time_t): Mark it private.  Replace long
>     	with System.Linux.time_t.
>     	(timespec): Replace long with time_t.
>     	* s-osinte-posix.adb (To_Timespec): Likewise.
>     	* s-taprop-linux.adb (timeval): Replace C.long with
>     	System.OS_Interface.time_t.

> I also see that s-osinte-gnu.ads, which is used solely by hurd-i386 and
> added by the Debian patch ada-hurd.diff, has this to say about the
> matter:
> 
>    type time_t is new long;
> 
>    type timespec is record
>       tv_sec  : time_t;
>       tv_nsec : long;
>    end record;
>    pragma Convention (C, timespec);
> 
> I propose to make "time_t" a subtype, rather than a derived type, of
> long.  This should keep everyone happy.  Comments?

I don't see the reason for upstream to change tv_nsec to time_t at all
in s-osinte-posix.adb., see the POSIX spec and Linux/etc header files
referred to earlier! Independent on if it is a private or not.

s-osinte-linux-ads:
type time_t is private;

   type time_t is new System.Linux.time_t;

   type timespec is record
      tv_sec  : time_t;
      tv_nsec : time_t;
   end record;
   pragma Convention (C, timespec);

s-osinte-kfreebsd-gnu.ads:
type time_t is new long;

   type timespec is record
      tv_sec  : time_t;
      tv_nsec : time_t;
   end record;
   pragma Convention (C, timespec);

(same problems with kFreeBSD as for Hurd. Therefore s-osinte-posix.adb
was modified to s-osinte-kfreebsd-gnu.adb in ada-kfreebsd.diff (this
part of the patch is not necessary, it should be possible to use the
posix (.adb) version))


Reply to: