This is the mail archive of the mailing list for the glibc 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 08/13] Installed-header hygiene (BZ#20366): time.h types.

On Wed, Sep 21, 2016 at 3:04 PM, Carlos O'Donell <> wrote:
>> -#ifdef __USE_XOPEN2K
>> -# define __need_time_t
>> -# define __need_timespec
>> +#include <bits/types/time_t.h>
>> +#include <bits/types/struct_timespec.h>
>> +#ifndef __USE_XOPEN2K
>> +# include <time.h>
>>  #endif
>> -#include <time.h>
> Your change unconditionally pulls in the two new headers?
> Why aren't the original semantics OK?

It _is_ the original semantics.  Before the patch, we have

#ifdef __USE_XOPEN2K
# define __need_time_t
# define __need_timespec
#include <time.h>

i.e. always include time.h, but under __USE_XOPEN2K, ask it to define
only time_t and struct timespec.  In other words, time_t and struct
timespec are always exposed by sched.h, and if __USE_XOPEN2K is *not*
defined, then so is the rest of time.h.  That translates directly to

#include <bits/types/time_t.h>
#include <bits/types/struct_timespec.h>
#ifndef __USE_XOPEN2K
# include <time.h>

with the new mechanism.  (I have doubts about whether this is the
_right_ thing for this header to be doing, but it is what conform/
expects it to do.)

Your version

> #ifdef __USE_XOPEN2K
> # include <bits/types/time_t.h>
> # include <bits/types/struct_timespec.h>
> #else
> # include <time.h>
> #endif

does the same thing as well, since time.h will unconditionally include
both headers.  I don't really care which version we go with.


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