Re: [PATCH] Add timegm POSIX call [updated]

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Aug 23 12:56, Andrew Russell via newlib wrote:
> >From 45939beb4546d0bc005062e30c05cfea88e6bf47 Mon Sep 17 00:00:00 2001
> From: Andrew Russell <[email protected]>
> 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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlt/69YACgkQ9TYGna5E
T6B0eQ/+J9Mf3E5IEP6vPUHdivR5/yOkR1p2XJ2MbBL6b5cG9yjC+AEljaR1iUaR
e0KBiL6n6FgcCpRozTjtd4zRsxYdKv2hE/g5fGHPS0Wnw7abE3TMAvjXb/OClIZI
Lu7v9oWx2R58saJuBHQ3d1U3uq0ILpZF8CWfOyvNhAcANNnj2L59/H6JQk+HEU/n
vR5nSLuWWeI3rU7Nh0z2ojklO9XaQlvodvCu7GAK+erfi+ZfVxLOuva3unmBJsIk
sGjutvpQ7UFSTMP5bDR7Vrrht2LbrVOdCpuUyKpfByMYjAkfsz2FXnPY5CPF1mVD
XlCvFS9N+LLlN1R3/sRlhDRgtPL9T3C9fPZcY2mbPDvQNrTfSOIjqpPRZqtnDfwh
vPHPL2NHxDPNr+mRGm4tXOt+PNx59mmy5UbA00ZsgQXxdz2Il/jtpfLB0TrFsOfB
SkJlb9VhEJdGzuhIfgjFH8ET/8tJRKvib/K3vxeG6suEpCD759QxRIgkx4OXPPCO
FYyVQuubYbjXq+giEMHF4UQW01WKuYVY47W6eFRRwG+OYp9xvs+jLzKyHTOZHwoo
IRaIFVeFPJNIll10218IgtP6hyU3589TkPuZK9lM2Ps9nuK1wBQvP8beKSg48QX4
8xOKg3VYYplR7EnrGykpRavR/S5bw6z/rWK+NUkYaWIwyCGE4ys=
=zDtQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.