summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-05-11 10:23:08 +0200
committerMatt Turner <mattst88@gmail.com>2019-06-10 16:42:59 +0000
commitfd5c0da57985a430912907d4a898ed1ddb854ead (patch)
tree38ee57c9919e039f2e5411184342118dc20a04d4
parent4851d4e20f66f540cd61fb69851df17671fc90d2 (diff)
meson: fix TLS support under mingw
GCC on Windows complains that "__declspec(thread)" doesn't work, but still compiles it, so the meson check doesn't work. The warning printed by gcc: "warning: 'thread' attribute directive ignored [-Wattributes]" Pass -Werror=attributes to make the check fail instead. This fixes the test suite (minus gtk tests) on Windows with mingw.
-rw-r--r--meson.build6
1 files changed, 5 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 3a1a4c2..2118abf 100644
--- a/meson.build
+++ b/meson.build
@@ -408,8 +408,12 @@ foreach h : ['sys/mman.h', 'fenv.h', 'unistd.h']
endif
endforeach
+# gcc on Windows only warns that __declspec(thread) isn't supported,
+# passing -Werror=attributes makes it fail.
if (host_machine.system() == 'windows' and
- cc.compiles('int __declspec(thread) foo;', name : 'TLS via __declspec(thread)'))
+ cc.compiles('int __declspec(thread) foo;',
+ args : cc.get_supported_arguments(['-Werror=attributes']),
+ name : 'TLS via __declspec(thread)'))
config.set('TLS', '__declspec(thread)')
elif cc.compiles('int __thread foo;', name : 'TLS via __thread')
config.set('TLS', '__thread')