Fix build issue on NetBSD: Add time(3) to PAL
authorKamil Rytarowski <n54@gmx.com>
Fri, 12 Feb 2016 02:40:30 +0000 (03:40 +0100)
committerKamil Rytarowski <n54@gmx.com>
Sun, 14 Feb 2016 14:07:15 +0000 (15:07 +0100)
Otherwise it triggers linker warnings.

/tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/gc/gc.cpp:33869:
warning: warning: reference to compatibility time(); include <time.h> for correct reference

$ uname -a
NetBSD chieftec 7.99.25 NetBSD 7.99.25 (GENERIC) #0: Fri Dec 25 20:51:06 UTC 2015  root@chieftec:/tmp/netbsd-tmp/sys/arch/amd64/compile/GENERIC amd64

src/pal/inc/pal.h
src/pal/src/cruntime/misc.cpp
src/pal/src/include/pal/misc.h
src/pal/src/include/pal/palinternal.h

index cc4a695d043d0fac41174b00aae923b7937f399d..0aa436504afc58a94ea440fc0ae4fdeb1c4e11f3 100644 (file)
@@ -6027,6 +6027,7 @@ CoCreateGuid(OUT GUID * pguid);
 #define localtime     PAL_localtime
 #define mktime        PAL_mktime
 #define rand          PAL_rand
+#define time          PAL_time
 #define getenv        PAL_getenv
 #define fgets         PAL_fgets
 #define fgetws        PAL_fgetws
index 6ca340bf3f75b5090ccbba11a2b3f2dd5e9aa861..107d5e316d1a89bc611e0f48f1a93cd118fa5026 100644 (file)
@@ -206,7 +206,7 @@ See MSDN for more details.
 --*/
 
 PAL_time_t 
-__cdecl 
+__cdecl
 PAL_mktime(struct PAL_tm *tm)
 {
     time_t result;
@@ -260,6 +260,30 @@ PAL_rand(void)
 }
 
 
+/*++
+Function:
+
+   time
+
+See MSDN for more details.
+--*/
+PAL_time_t
+__cdecl
+PAL_time(PAL_time_t *tloc)
+{
+    time_t result;
+
+    PERF_ENTRY(time);
+    ENTRY( "time( tloc=%p )\n",tloc );
+
+    result = time(tloc);
+
+    LOGEXIT( "time returning %#lx\n",result );
+    PERF_EXIT(time);
+    return result;
+}
+
+
 PALIMPORT 
 void __cdecl 
 PAL_qsort(void *base, size_t nmemb, size_t size, 
index 99e7546215cd633dfedb339d732566c2e2270501..2be2cc06b285d01065385b69b7939290ea3d03b3 100644 (file)
@@ -41,12 +41,19 @@ extern CRITICAL_SECTION gcsEnvironment;
 Function :
 
     PAL_rand
-    
-    Calls rand and mitigates the difference between RAND_MAX 
+
+    Calls rand and mitigates the difference between RAND_MAX
     on Windows and FreeBSD.
 --*/
 int __cdecl PAL_rand(void);
 
+/*++
+Function :
+
+    PAL_time
+--*/
+PAL_time_t __cdecl PAL_time(PAL_time_t*);
+
 /*++
 Function:
 TIMEInitialize
@@ -128,4 +135,3 @@ void MiscUnsetenv(const char *name);
 #endif // __cplusplus
 
 #endif /* __MISC_H_ */
-
index 9dbbf1cd0095fc7b543fc729b34a57fbdd75b22b..070ffdf24016a1a933002fcd56fba495e1ff1b44 100644 (file)
@@ -199,7 +199,6 @@ function_name() to call the system's implementation
 #define srand DUMMY_srand
 #define atoi DUMMY_atoi
 #define atof DUMMY_atof
-#define time DUMMY_time
 #define tm PAL_tm
 #define size_t DUMMY_size_t
 #define time_t PAL_time_t