This is the mail archive of the newlib-cvs@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]

[newlib-cygwin] Add BSD guard for time_t


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5d0c2b87c87ff6a5ec150b8b1615dc4e23539e3a

commit 5d0c2b87c87ff6a5ec150b8b1615dc4e23539e3a
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Fri Apr 15 13:44:17 2016 +0200

    Add BSD guard for time_t
    
    Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>

Diff:
---
 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]