[PATCH 06/18] Add BSD guard for time_t

Corinna Vinschen vinschen@redhat.com
Fri Apr 15 11:34:00 GMT 2016


On Apr 15 12:57, Sebastian Huber wrote:
> 
> 
> On 15/04/16 12:08, Corinna Vinschen wrote:
> >On Apr 14 13:54, Sebastian Huber wrote:
> >>Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
> >>---
> >>  newlib/libc/include/sys/_timespec.h    | 3 ++-
> >>  newlib/libc/include/sys/_timeval.h     | 3 ++-
> >>  newlib/libc/include/sys/_types.h       | 4 +++-
> >>  newlib/libc/include/sys/timeb.h        | 7 ++++---
> >>  newlib/libc/include/sys/types.h        | 7 ++++---
> >>  newlib/libc/sys/sparc64/sys/_timeval.h | 7 ++++---
> >>  6 files changed, 19 insertions(+), 12 deletions(-)
> >>
> >>diff --git a/newlib/libc/include/sys/_timespec.h b/newlib/libc/include/sys/_timespec.h
> >>index 4a7aabc..7609e4a 100644
> >>--- a/newlib/libc/include/sys/_timespec.h
> >>+++ b/newlib/libc/include/sys/_timespec.h
> >>@@ -36,9 +36,10 @@
> >>  #include <sys/_types.h>
> >>-#ifndef __time_t_defined
> >>+#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
> >>  typedef	_TIME_T_	time_t;
> >>  #define	__time_t_defined
> >>+#define	_TIME_T_DECLARED
> >>  #endif
> >>[...]
> >Would it make sense to outsource the definition of time_t to it's
> >own file, e.g. sys/_time.h and just include it everywhere it's
> >needed?
> 
> It is used in FreeBSD like this:
> 
> ./sys/sys/types.h:#ifndef _TIME_T_DECLARED
> ./sys/sys/timeb.h:#ifndef _TIME_T_DECLARED
> ./sys/sys/_timespec.h:#ifndef _TIME_T_DECLARED
> ./sys/sys/sem.h:#ifndef _TIME_T_DECLARED
> ./sys/sys/_timeval.h:#ifndef _TIME_T_DECLARED
> ./sys/sys/shm.h:#ifndef _TIME_T_DECLARED
> ./sys/sys/msg.h:#ifndef _TIME_T_DECLARED
> ./include/pwd.h:#ifndef _TIME_T_DECLARED
> ./include/time.h:#ifndef _TIME_T_DECLARED
> ./include/timeconv.h:#ifndef _TIME_T_DECLARED
> ./include/utime.h:#ifndef _TIME_T_DECLARED
> 
> FreeBSD uses the _XYZ_T_DECLARED mechanism, glibc the __need_xyz, and there
> are surely other ways to deal with the <a.h> and <b.h> both need type xyz_t,
> but should not make visible other types problem.

Ok.  Other than 02, 04 and 17 the patches look good.  As for 04, only
if it's not asked too much.  I can also apply a followup patch removing
the Cygwin definition.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20160415/a909dbbb/attachment.sig>


More information about the Newlib mailing list