About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <jasuarez@igalia.com>2025-08-21 12:06:21 +0200
committerMarge Bot <marge-bot@fdo.invalid>2025-08-21 12:09:04 +0000
commit1c2aa6f5c34ffe389e34032b18987c2ec927473a (patch)
treeb787b1449ec7665f2e7856096a310db2904e5358 /meson.build
parente24db36f20e476203235810874297206a3788e61 (diff)
meson: check for no_sanitize function attributes
Meson doesn't support for checking no_sanitize attributes, so we do it manually through testing. Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build16
1 files changed, 16 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 173c4f007d9..b03df2879b9 100644
--- a/meson.build
+++ b/meson.build
@@ -1047,6 +1047,22 @@ endforeach
if cc.has_function_attribute('visibility:hidden')
pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY'
endif
+
+_no_sanitize_flags = []
+if ['address', 'address,undefined'].contains(get_option('b_sanitize'))
+ _no_sanitize_flags += ['address']
+endif
+if ['undefined', 'address,undefined'].contains(get_option('b_sanitize'))
+ _no_sanitize_flags += ['vptr']
+endif
+foreach flag: _no_sanitize_flags
+ if cc.compiles('__attribute__((no_sanitize("@0@"))) int foo(void) { return 0; }'.format(flag),
+ name : 'no_sanitize(@0@)'.format(flag),
+ werror: true)
+ pre_args += '-DHAVE_FUNC_ATTRIBUTE_NO_SANITIZE_@0@'.format(flag.to_upper())
+ endif
+endforeach
+
if cc.compiles('__uint128_t foo(void) { return 0; }',
name : '__uint128_t')
pre_args += '-DHAVE_UINT128'