[PATCH v2 06/18] Add BSD guard for time_t
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Apr 15 11:44:17 UTC 2016
Signed-off-by: Sebastian Huber <sebastian.huber at 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
struct timespec {
diff --git a/newlib/libc/include/sys/_timeval.h b/newlib/libc/include/sys/_timeval.h
index d813d1f..676a0b8 100644
--- a/newlib/libc/include/sys/_timeval.h
+++ b/newlib/libc/include/sys/_timeval.h
@@ -36,9 +36,10 @@ typedef __suseconds_t suseconds_t;
#define _SUSECONDS_T_DECLARED
#endif
-#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
/* This define is also used outside of Newlib, e.g. in MinGW-w64 */
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index 7102a4f..1ba4c64 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -148,7 +148,9 @@ typedef void *_iconv_t;
#define _CLOCK_T_ unsigned long /* clock() */
typedef _CLOCK_T_ __clock_t;
-#define _TIME_T_ long /* time() */
+#define _TIME_T_ long /* time() */
+typedef _TIME_T_ __time_t;
+
#define _CLOCKID_T_ unsigned long
#define _TIMER_T_ unsigned long
diff --git a/newlib/libc/include/sys/timeb.h b/newlib/libc/include/sys/timeb.h
index 2647830..793b481 100644
--- a/newlib/libc/include/sys/timeb.h
+++ b/newlib/libc/include/sys/timeb.h
@@ -17,9 +17,10 @@ extern "C" {
#include <_ansi.h>
#include <sys/_types.h>
-#ifndef __time_t_defined
-typedef _TIME_T_ time_t;
-#define __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
struct timeb
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index f17821b..2338cf5 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -102,9 +102,10 @@ typedef _CLOCK_T_ clock_t;
#define _CLOCK_T_DECLARED
#endif
-#ifndef __time_t_defined
-typedef _TIME_T_ time_t;
-#define __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
#ifndef __daddr_t_defined
diff --git a/newlib/libc/sys/sparc64/sys/_timeval.h b/newlib/libc/sys/sparc64/sys/_timeval.h
index fbe9ce6..b0aaeda 100644
--- a/newlib/libc/sys/sparc64/sys/_timeval.h
+++ b/newlib/libc/sys/sparc64/sys/_timeval.h
@@ -3,9 +3,10 @@
#include <sys/_types.h>
-#ifndef __time_t_defined
-typedef _TIME_T_ time_t;
-#define __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
#ifdef __cplusplus
--
1.8.4.5
More information about the devel
mailing list