This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 06/18] Add BSD guard for time_t
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Fri, 15 Apr 2016 12:57:37 +0200
- Subject: Re: [PATCH 06/18] Add BSD guard for time_t
- Authentication-results: sourceware.org; auth=none
- References: <1460634887-4420-1-git-send-email-sebastian dot huber at embedded-brains dot de> <1460634887-4420-6-git-send-email-sebastian dot huber at embedded-brains dot de> <20160415100806 dot GG5014 at calimero dot vinschen dot de>
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.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschÃftliche Mitteilung im Sinne des EHUG.