[waffle] [PATCH 4/4] wgl: attempt to fix the final test

Emil Velikov emil.l.velikov at gmail.com
Tue Aug 12 08:37:35 PDT 2014


MSVC helps us out with the final test by undicating that we're
corrupting the stack, which begs the question - at which point are we
messing up with the calling conventions. This patch attempts to resolve
that yet the bug still persists :'(

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/waffle/core/wcore_error_unittest.c | 4 ++++
 third_party/threads/threads.h          | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/waffle/core/wcore_error_unittest.c b/src/waffle/core/wcore_error_unittest.c
index 5176031..8b9b334 100644
--- a/src/waffle/core/wcore_error_unittest.c
+++ b/src/waffle/core/wcore_error_unittest.c
@@ -148,7 +148,11 @@ struct thread_arg {
 };
 
 /// The start routine given to threads in test wcore_error.thread_local.
+#if !defined(_WIN32)
 static bool
+#else
+static bool __stdcall
+#endif
 thread_start(struct thread_arg *a)
 {
     static const enum waffle_error error_codes[NUM_THREADS] = {
diff --git a/third_party/threads/threads.h b/third_party/threads/threads.h
index 4e7dba2..eb024dd 100644
--- a/third_party/threads/threads.h
+++ b/third_party/threads/threads.h
@@ -117,7 +117,7 @@ typedef pthread_once_t  once_flag;
 
 /*---------------------------- types ----------------------------*/
 typedef void (*tss_dtor_t)(void*);
-typedef int (*thrd_start_t)(void*);
+typedef int (__stdcall *thrd_start_t)(void*);
 
 struct xtime {
     time_t sec;
-- 
2.0.2



More information about the waffle mailing list