aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-06-25 18:30:13 -0700
committerHaibo Huang <hhb@google.com>2020-06-25 18:30:13 -0700
commit081ccfa4c8d36c7deb7948d0c670361c56a2b810 (patch)
tree49511e90b583cb33aa3db5b839246d9a74079ab5
parent05b1bfbaa94b7c4797130c3e8e3d20168d618539 (diff)
downloadmingw-081ccfa4c8d36c7deb7948d0c670361c56a2b810.tar.gz
time.h: Use static inlines for time 32/64-bit forwarding functions.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Upstream URL: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/6988d73a95fbbd97a0bdbb517008cf18f4eb5f02/ Bug: https://github.com/android/ndk/issues/1291 Change-Id: I6b0fb931c29c595e00fdc083f10e94f79023484f
-rw-r--r--mingw-w64-v6.x/mingw-w64-headers/crt/crtdefs.h8
-rw-r--r--mingw-w64-v6.x/mingw-w64-headers/crt/time.h48
2 files changed, 32 insertions, 24 deletions
diff --git a/mingw-w64-v6.x/mingw-w64-headers/crt/crtdefs.h b/mingw-w64-v6.x/mingw-w64-headers/crt/crtdefs.h
index df52e03..2f92c6a 100644
--- a/mingw-w64-v6.x/mingw-w64-headers/crt/crtdefs.h
+++ b/mingw-w64-v6.x/mingw-w64-headers/crt/crtdefs.h
@@ -143,6 +143,14 @@ typedef __time64_t time_t;
#define _CRT_SECURE_CPP_NOTHROW throw()
#endif
+#ifndef __CRTDECL
+#if !defined(__cplusplus) && defined(__GNUC__)
+#define __CRTDECL __cdecl __attribute__ ((__unused__))
+#else
+#define __CRTDECL __cdecl
+#endif
+#endif
+
#if defined(__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(__ret,__func,__dsttype,__dst) \
diff --git a/mingw-w64-v6.x/mingw-w64-headers/crt/time.h b/mingw-w64-v6.x/mingw-w64-headers/crt/time.h
index 02abd7b..be2398d 100644
--- a/mingw-w64-v6.x/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-v6.x/mingw-w64-headers/crt/time.h
@@ -216,27 +216,27 @@ extern "C" {
#ifndef RC_INVOKED
#ifdef _USE_32BIT_TIME_T
-__forceinline time_t __cdecl time(time_t *_Time) { return _time32(_Time); }
-__forceinline double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); }
-__forceinline struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); }
-__forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); }
-__forceinline struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); }
-__forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime32_s(_Tm, _Time); }
-__forceinline char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); }
-__forceinline errno_t __cdecl ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime32_s(_Buf,_SizeInBytes,_Time); }
-__forceinline time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); }
-__forceinline time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); }
+static __inline time_t __CRTDECL time(time_t *_Time) { return _time32(_Time); }
+static __inline double __CRTDECL difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); }
+static __inline struct tm *__CRTDECL localtime(const time_t *_Time) { return _localtime32(_Time); }
+static __inline errno_t __CRTDECL localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); }
+static __inline struct tm *__CRTDECL gmtime(const time_t *_Time) { return _gmtime32(_Time); }
+static __inline errno_t __CRTDECL gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime32_s(_Tm, _Time); }
+static __inline char *__CRTDECL ctime(const time_t *_Time) { return _ctime32(_Time); }
+static __inline errno_t __CRTDECL ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime32_s(_Buf,_SizeInBytes,_Time); }
+static __inline time_t __CRTDECL mktime(struct tm *_Tm) { return _mktime32(_Tm); }
+static __inline time_t __CRTDECL _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); }
#else
-__forceinline time_t __cdecl time(time_t *_Time) { return _time64(_Time); }
-__forceinline double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); }
-__forceinline struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); }
-__forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
-__forceinline struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); }
-__forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime64_s(_Tm, _Time); }
-__forceinline char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); }
-__forceinline errno_t __cdecl ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime64_s(_Buf,_SizeInBytes,_Time); }
-__forceinline time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); }
-__forceinline time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
+static __inline time_t __CRTDECL time(time_t *_Time) { return _time64(_Time); }
+static __inline double __CRTDECL difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); }
+static __inline struct tm *__CRTDECL localtime(const time_t *_Time) { return _localtime64(_Time); }
+static __inline errno_t __CRTDECL localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
+static __inline struct tm *__CRTDECL gmtime(const time_t *_Time) { return _gmtime64(_Time); }
+static __inline errno_t __CRTDECL gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime64_s(_Tm, _Time); }
+static __inline char *__CRTDECL ctime(const time_t *_Time) { return _ctime64(_Time); }
+static __inline errno_t __CRTDECL ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime64_s(_Buf,_SizeInBytes,_Time); }
+static __inline time_t __CRTDECL mktime(struct tm *_Tm) { return _mktime64(_Tm); }
+static __inline time_t __CRTDECL _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
#endif
#endif /* !RC_INVOKED */
@@ -282,16 +282,16 @@ struct timezone {
#endif
#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
-__forceinline struct tm *__cdecl localtime_r(const time_t *_Time, struct tm *_Tm) {
+static __inline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
return localtime_s(_Tm, _Time) ? NULL : _Tm;
}
-__forceinline struct tm *__cdecl gmtime_r(const time_t *_Time, struct tm *_Tm) {
+static __inline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
return gmtime_s(_Tm, _Time) ? NULL : _Tm;
}
-__forceinline char *__cdecl ctime_r(const time_t *_Time, char *_Str) {
+static __inline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) {
return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
}
-__forceinline char *__cdecl asctime_r(const struct tm *_Tm, char * _Str) {
+static __inline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) {
return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
}
#endif