This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec


> Ada was using long for time_t and
> 
> type timeval is array (1 .. 2) of C.long
> 
> It assumes that the type of tv_nsec is the same as tv_sec.

Yes, and that was indeed wrong/dangerous.

> > --- s-osinte-solaris-posix.ads  (revision 298928)
> > +++ s-osinte-solaris-posix.ads  (working copy)
> > @@ -513,7 +513,7 @@
> >
> >     type timespec is record
> >        tv_sec  : time_t;
> > -      tv_nsec : long;
> > +      tv_nsec : time_t;
> >     end record;
> >     pragma Convention (C, timespec);
> >
> > But I'd rather settle on which type is appropriate for the tv_nsec
> > field before making this change.
> >
> 
> __syscall_slong_t is a Linux specific type.  We
> can add tv_nsec_t, which should be the same
> as time_t for all the current targets.

Introducing tv_nsec_t looks reasonable to me.

Arno


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]