This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] Add timegm POSIX call [updated]


On Aug 23 12:56, Andrew Russell via newlib wrote:
> >From 45939beb4546d0bc005062e30c05cfea88e6bf47 Mon Sep 17 00:00:00 2001
> From: Andrew Russell <ahrussell@google.com>
> Date: Thu, 23 Aug 2018 11:10:21 -0700
> Subject: [PATCH 1/1] Refactor mktime and add the POSIX function timegm
> 
> Updated with appropriate version-gating of the timegm() symbol from time.h
> 
> ---
>  newlib/libc/include/time.h   |  3 ++
>  newlib/libc/saber            |  1 +
>  newlib/libc/time/Makefile.am |  2 +
>  newlib/libc/time/Makefile.in | 11 ++++-
>  newlib/libc/time/local.h     |  2 +
>  newlib/libc/time/mktime.c    | 81 +++++++++++++++++++++++++-----------
>  newlib/libc/time/timegm.c    | 63 ++++++++++++++++++++++++++++
>  7 files changed, 138 insertions(+), 25 deletions(-)
>  create mode 100644 newlib/libc/time/timegm.c
> 
> diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
> index a2efcc15e..e5e151881 100644
> --- a/newlib/libc/include/time.h
> +++ b/newlib/libc/include/time.h
> @@ -56,6 +56,9 @@ struct tm
>  clock_t    clock (void);
>  double    difftime (time_t _time2, time_t _time1);
>  time_t    mktime (struct tm *_timeptr);
> +#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || defined(_GNU_SOURCE)

This is not correct.  Don't use the _XXX_SOURCE macros in the header
files, use the __XXX_VISIBLE macros instead.  Please have a look at the
descriptive comments in newlib/libc/include/sys/features.h and compare
with other usages of the __XXX_VISIBLE macros.

Btw., _BSD_SOURCE and _SVID_SOURCE are deprecated, as on Linux.  That's
_DEFAULT_SOURCE these days (but see above).


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


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