Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/Vulkan-Loader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kryshen <A.Kryshen@gmail.com>2019-07-20 18:31:13 +0300
committerLenny Komow <lenny@lunarg.com>2019-07-23 02:08:17 +0300
commitab2bcb97c78a3a086c3d09327de4fb47060a2bbf (patch)
tree4e577257bfcb91d4299fb9a03885510d1f347c01
parent8bd09ccc0a2013fed5e24cad0c516b9423b676cf (diff)
loader: Fix MinGW compilationsdk-1.1.114.0sdk-1.1.114
Change-Id: I2a80ed83b0431be07cb6f992f4c8742a86aca294
-rw-r--r--loader/vk_loader_platform.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index a91c6489a..c697293e4 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -334,7 +334,23 @@ static char *loader_platform_get_proc_address_error(const char *name) {
// Threads:
typedef HANDLE loader_platform_thread;
+
+// __declspec(thread) is not supported by MinGW compiler (ignored with warning or
+// cause erorr depending on compiler switches)
+//
+// __thread should be used instead
+//
+// __MINGW32__ defined for both 32 and 64 bit MinGW compilers, so it is enough to
+// detect any (32 or 64) flawor of MinGW compiler.
+//
+// @note __GNUC__ could be used as a more generic way to detect _any_
+// GCC[-compitible] compiler on Windows, but this fix was tested
+// only with MinGW, so keep it explicit at the moment.
+#if defined(__MINGW32__)
+#define THREAD_LOCAL_DECL __thread
+#else
#define THREAD_LOCAL_DECL __declspec(thread)
+#endif
// The once init functionality is not used when building a DLL on Windows. This is because there is no way to clean up the
// resources allocated by anything allocated by once init. This isn't a problem for static libraries, but it is for dynamic