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 06/18] Add BSD guard for time_t


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

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]