[RFA] confine _TIMEVAL_DEFINED guard in libc/include/sys/time.h

Corinna Vinschen vinschen@redhat.com
Mon Nov 12 16:08:00 GMT 2012

On Nov 11 13:58, Christopher Faylor wrote:
> The _TIMEVAL_DEFINED guard in time.h is a little to enthusiastic in what
> it is guarding.  It's possible that there are other guards needed here
> but, IMO, _TIMEVAL_DEFINED shouldn't be turning off the declaration of
> timezone.  Without this change, using Mingw64 headers becomes
> problematic.
> Ok to apply?

More or less, yes.  The Mingw64 header uses the _TIMEVAL_DEFINED guard
also to guard the macros timerisset, timercmp, and timerclear, so we
should do the same.  Would you mind to add that?

As a sidenote, using timeval in calls to Windows functions should be
replace with using the type TIMEVAL.  The Mingw64 winsock headers use
TIMEVAL from ./psdk_inc/_ip_types.h throughout.  The Windows timeval
definition differs from the Cygwin definition on 64 bit due to the
different size of the datatype long, while TIMEVAL is defined to work
for LP64 as well as for LLP64.

> 2012-11-11  Christopher Faylor  <...>
>         * libc/include/sys/time.h: Avoid guarding other than timeval
>         declaration with _TIMEVAL_DEFINED.


Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the Newlib mailing list