From fd5c0da57985a430912907d4a898ed1ddb854ead Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sat, 11 May 2019 10:23:08 +0200 Subject: [PATCH] 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. --- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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') -- 2.24.1