This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Please revert the patches in bug #54040 and #59346 and special case x32
- From: Ludovic Brenta <ludovic at ludovic-brenta dot org>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: svante dot signell at gmail dot com, gcc-patches at gcc dot gnu dot org, debian-ada <debian-ada at lists dot debian dot org>, Arnaud Charlet <charlet at adacore dot com>
- Date: Wed, 09 Apr 2014 21:54:35 +0200
- Subject: Re: Please revert the patches in bug #54040 and #59346 and special case x32
- Authentication-results: sourceware.org; auth=none
- References: <1395668239 dot 5365 dot 43 dot camel at G3620 dot my dot own dot domain> <11842828 dot ILKrFo6h4V at polaris> <1396958839 dot 1276 dot 12 dot camel at G3620 dot my dot own dot domain> <174636620 dot hURAyCpPt0 at polaris>
Eric Botcazou <ebotcazou@adacore.com> writes:
> In order to avoid creating more x32-specific files, I think that we
> need to move the definition of 'struct timespec' and 'struct timeval'
> (both specified by POSIX) to s-linux.ads. This requires with'ing
> Interfaces.C, but I think that's OK since s-linux.ads is a spin-off of
> s-osinte-linux.ads which also with'es Interfaces.C.
In my worthless opinion, it is a mistake to declare POSIX data types in
s-linux.ads, they should be in s-posix.ads or similar (don't worry if
that's a new file; and it should not be a "leaf" package). Think of
GNU/kFreeBSD and GNU/Hurd, which have nothing to do with Linux.
Furthermore there should be only one declaration of type timespec
(i.e. "do not repeat yourself"); that declaration should be in
s-posix.ads and that declaration should "violate" POSIX like so:
with System.OS_Interface;
package System.POSIX is
type timespec is record
tv_sec : time_t;
tv_nsec : System.OS_Interface.Nanoseconds_T; -- instead of "long"
end record;
pragma Convention (C, timespec);
end System.POSIX;
Each platform-specific version of System.OS_Interface should then
declare their own type Nanoseconds_T. The version for x32 would declare
type Nanoseconds_T is new Long_Long_Integer;
-- or perhaps range -2**63 .. 2**63-1 to be more explicit?
thereby really violating POSIX but all others would declare
type Nanoseconds_T is new Interfaces.C.long;
thereby restoring compliance with POSIX.
I'm really sorry that I don't have the time to propose a proper patch
but if someone does, I'd be happy to review it.
--
Ludovic Brenta.