[RFA] confine _TIMEVAL_DEFINED guard in libc/include/sys/time.h
Joel Sherrill
joel.sherrill@oarcorp.com
Mon Nov 12 17:29:00 GMT 2012
On 11/12/2012 09:20 AM, Christopher Faylor wrote:
> On Mon, Nov 12, 2012 at 11:40:31AM +0100, Corinna Vinschen wrote:
>> 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?
> Well, maybe, but that isn't a necessary change as far as getting 32-bit
> Cygwin building is concerned*. Although I can see the sense in putting
> the macros under this conditional, the macros on Linux are not protected
> by the equivalent "__need_timeval". Also, moving the macros has
> potential side-effects for rtems. Do they have to weigh in on this too?
RTEMS only supports newlib currently so as long as newlib is
internally consistent, we should be OK.
As a disclaimer to that, we have lots of code from NetBSD and
FreeBSD for things that range from shell commands to the
USB and TCP/IP stacks. Those may have .h files which depend
on the structure of this conditional. But I don't see _TIMEVAL_DEFINED
used in any of that code.
I think changing this to the cleanest form is OK for RTEMS.
> I thought this was an obvious change architecturally for newlib since
> the guard (or at least the naming of the guard) was clearly wrong.
> Moving the macros seems slightly less obvious.
What's correct and what breaks assumptions that have been
in place for years are unfortunately often two different things.
> cgf
>
> *I've had to make a number of changes to Cygwin to get it to build with
> the latest released version of the mingw64 headers.
--
Joel Sherrill, Ph.D. Director of Research& Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35806
Support Available (256) 722-9985
More information about the Newlib
mailing list