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: Arnaud Charlet <charlet at adacore dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Eric Botcazou <ebotcazou at adacore dot com>
- Date: Mon, 18 Nov 2013 15:17:45 +0100
- Subject: Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOrZpt5LCP_1dDiOYDi2phbfEQMBYtKaUZhzireTt9vGHg at mail dot gmail dot com> <20131115113815 dot GB7411 at adacore dot com> <CAMe9rOpAs6Gu07nhf-tM1ir97jF-LztL8JY86DuVQ8hb9q80ag at mail dot gmail dot com> <20131115115615 dot GD27059 at adacore dot com> <CAMe9rOpTqtdy_e-Yz6gUAGFWpZNr582-R16WOPEdbikCPg2VjA at mail dot gmail dot com> <20131118085832 dot GA13792 at adacore dot com> <20131118090233 dot GB6341 at adacore dot com> <CAMe9rOryT=7QZjmg__OE95cf-yCay+mGozB89hZ6+gJmWFCAwQ at mail dot gmail dot com> <20131118135712 dot GB1024 at adacore dot com> <CAMe9rOrmSeSD1T53dj6r2rS-AjxoYFajqjB0Ls9qM0q4FGppvA at mail dot gmail dot com>
> 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