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

Re: building gnat-4.9 on kfreebsd/Debian



On Mon, 2014-02-10 at 16:06 +0100, Xavier Grave wrote:
> On Mon, 10 Feb 2014 14:01:16 +0000, Brian Drummond wrote:
> > On Mon, 2014-02-10 at 14:51 +0100, Xavier Grave wrote:

> By the way it seems I had a have done a mistake in my patching session 
> (I should sleep more :) ) and now
> the build crash after a nice :
> 
> /home/xavier/gnat-lab/org.debian.gnat-4.9/build/./gcc/xgcc 
> -B/home/xavier/gnat-lab/org.debian.gnat-4.9/build/./gcc/ -c -g -O2  -W 
> -Wall -gnatpg -nostdinc  s-proinf.adb -o s-proinf.o
> s-osinte.adb:155:35: expected type "System.Os_Interface.time_t"
> s-osinte.adb:155:35: found type "Interfaces.C.long"
> 
> I have patched the s-osinte-kfreebsd-gnu.adb, we shall see :)

I'm not so sure there is a need to move from s-osinte-posix.adb to the
patched version s-osinte-kfreebsd-gnu.adb for kfreebsd. I see the same
build problem as above when building gnat-4.9 on GNU/Hurd. I think the
change from gnat-4.8 to gnat-4.9 in s-osinte-posix.adb is wrong
(edited):

--- gnat-4.8/gnat-4.8-4.8.2-5/src/gcc/ada/s-osinte-posix.adb
2011-08-01 17:05:02.000000000 +0200
+++ gnat-4.9/gnat-4.9-4.9-20140218/src/gcc/ada/s-osinte-posix.adb
2013-11-16 20:23:13.000000000 +0100

return timespec'(tv_sec => S,
-  tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
+  tv_nsec => time_t (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;

 end System.OS_Interface;

According to Posix the tv_nsec should be long:
http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html

The <time.h> header shall declare the structure timespec, which has at
least the following members:

time_t  tv_sec    Seconds. 
long    tv_nsec   Nanoseconds. 

Linux/kFreeBSD/Hurd all defines struct timespec in time.h as follows:
/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
   has nanoseconds instead of microseconds.  */
struct timespec
  {
    __time_t tv_sec;            /* Seconds.  */
    __syscall_slong_t tv_nsec;  /* Nanoseconds.  */
  };



Reply to: