summaryrefslogtreecommitdiff
path: root/ggml.c
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2023-04-11 06:19:54 -0700
committerGitHub <noreply@github.com>2023-04-11 15:19:54 +0200
commit2663d2c6784ad7b77998c6874df25648d597f74b (patch)
tree1739feb4d2c189ddb5f04e14a4fb326ec61b0242 /ggml.c
parenta0caa34b162449b5c13b8d604573053300ff54a1 (diff)
Windows fixes (#890)
Mostly for msys2 and mingw64 builds, which are different from each other and different from standard Visual Studio builds. Isn't Windows fun? - Define _GNU_SOURCE in more files (it's already used in ggml.c for Linux's sake). - Don't use PrefetchVirtualMemory if not building for Windows 8 or later (mingw64 doesn't by default). But warn the user about this situation since it's probably not intended. - Check for NOMINMAX already being defined, which it is on mingw64. - Actually use the `increment` variable (bug in my `pizza` PR). - Suppress unused variable warnings in the fake pthread_create and pthread_join implementations for Windows. - (not Windows-related) Remove mention of `asprintf` from comment; `asprintf` is no longer used. Fixes #871.
Diffstat (limited to 'ggml.c')
-rw-r--r--ggml.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ggml.c b/ggml.c
index ada3bbbd..897b67d9 100644
--- a/ggml.c
+++ b/ggml.c
@@ -1,4 +1,4 @@
-// Defines CLOCK_MONOTONIC and asprintf on Linux
+// Defines CLOCK_MONOTONIC on Linux
#define _GNU_SOURCE
#include "ggml.h"
@@ -50,6 +50,7 @@ typedef HANDLE pthread_t;
typedef DWORD thread_ret_t;
static int pthread_create(pthread_t* out, void* unused, thread_ret_t(*func)(void*), void* arg) {
+ (void) unused;
HANDLE handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) func, arg, 0, NULL);
if (handle == NULL)
{
@@ -61,6 +62,7 @@ static int pthread_create(pthread_t* out, void* unused, thread_ret_t(*func)(void
}
static int pthread_join(pthread_t thread, void* unused) {
+ (void) unused;
return (int) WaitForSingleObject(thread, INFINITE);
}