[PATCH 05/18] Add BSD guard for clock_t
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Apr 14 11:54:34 UTC 2016
Signed-off-by: Sebastian Huber <sebastian.huber at embedded-brains.de>
---
newlib/libc/include/sys/_types.h | 4 +++-
newlib/libc/include/sys/times.h | 7 ++++---
newlib/libc/include/sys/types.h | 7 ++++---
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index af32bcb..0f5cb9d 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -145,7 +145,9 @@ typedef _LOCK_RECURSIVE_T _flock_t;
typedef void *_iconv_t;
#endif
-#define _CLOCK_T_ unsigned long /* clock() */
+#define _CLOCK_T_ unsigned long /* clock() */
+typedef _CLOCK_T_ __clock_t;
+
#define _TIME_T_ long /* time() */
#define _CLOCKID_T_ unsigned long
#define _TIMER_T_ unsigned long
diff --git a/newlib/libc/include/sys/times.h b/newlib/libc/include/sys/times.h
index dc072f4..b1f1dc6 100644
--- a/newlib/libc/include/sys/times.h
+++ b/newlib/libc/include/sys/times.h
@@ -7,9 +7,10 @@ extern "C" {
#include <_ansi.h>
#include <sys/_types.h>
-#ifndef __clock_t_defined
-typedef _CLOCK_T_ clock_t;
-#define __clock_t_defined
+#if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
+typedef _CLOCK_T_ clock_t;
+#define __clock_t_defined
+#define _CLOCK_T_DECLARED
#endif
/* Get Process Times, P1003.1b-1993, p. 92 */
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index e48c2f2..f17821b 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -96,9 +96,10 @@ typedef unsigned int uint; /* System V compatibility */
typedef unsigned long ulong; /* System V compatibility */
#endif
-#ifndef __clock_t_defined
-typedef _CLOCK_T_ clock_t;
-#define __clock_t_defined
+#if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
+typedef _CLOCK_T_ clock_t;
+#define __clock_t_defined
+#define _CLOCK_T_DECLARED
#endif
#ifndef __time_t_defined
--
1.8.4.5
More information about the devel
mailing list