Message ID | 87lenvrzey.fsf@oldenburg.str.redhat.com |
---|---|
State | New |
Headers | show |
Series | <time.h>: Make strptime available by default | expand |
On Nov 28 2022, Florian Weimer via Libc-alpha wrote: > This matches what FreeBSD does. Does it? What I see is that the strptime declaration is conditional on __XSI_VISIBLE, which is their equivalent of __USE_XOPEN, I think. > diff --git a/time/time.h b/time/time.h > index d18089116e..f507b44228 100644 > --- a/time/time.h > +++ b/time/time.h > @@ -101,7 +101,7 @@ extern size_t strftime (char *__restrict __s, size_t __maxsize, > const char *__restrict __format, > const struct tm *__restrict __tp) __THROW; > > -#ifdef __USE_XOPEN > +#if (defined __USE_XOPEN || defined __USE_MISC) No need for parens.
* Andreas Schwab: > On Nov 28 2022, Florian Weimer via Libc-alpha wrote: > >> This matches what FreeBSD does. > > Does it? What I see is that the strptime declaration is conditional on > __XSI_VISIBLE, which is their equivalent of __USE_XOPEN, I think. Clang without any special flags defines __XSI_VISBLE to 700 on FreeBSD 13.1 at least, which is why the declaration is visible by default. I'm not sure why we don't default to __USE_XOPEN. Maybe it has something to do with our diverging definitions of strerror_r and basename? Thanks, Florian
On Nov 28 2022, Florian Weimer wrote: > * Andreas Schwab: > >> On Nov 28 2022, Florian Weimer via Libc-alpha wrote: >> >>> This matches what FreeBSD does. >> >> Does it? What I see is that the strptime declaration is conditional on >> __XSI_VISIBLE, which is their equivalent of __USE_XOPEN, I think. > > Clang without any special flags defines __XSI_VISBLE to 700 on FreeBSD > 13.1 at least, which is why the declaration is visible by default. <sys/cdefs.h> defines this by default: #else /* Default environment: show everything. */ #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #define __EXT1_VISIBLE 1 #endif
diff --git a/time/time.h b/time/time.h index d18089116e..f507b44228 100644 --- a/time/time.h +++ b/time/time.h @@ -101,7 +101,7 @@ extern size_t strftime (char *__restrict __s, size_t __maxsize, const char *__restrict __format, const struct tm *__restrict __tp) __THROW; -#ifdef __USE_XOPEN +#if (defined __USE_XOPEN || defined __USE_MISC) /* Parse S according to FORMAT and store binary time information in TP. The return value is a pointer to the first unparsed character in S. */ extern char *strptime (const char *__restrict __s,