meson: use cc.has_function_attribute instead of open coding

It's less code, and also allows meson to short circuit for compilers is
knows don't support this.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
main
Dylan Baker 2022-01-19 11:12:43 -08:00
parent f9539d4128
commit 38c568775e
1 changed files with 2 additions and 4 deletions

View File

@ -23,7 +23,7 @@ project(
['c'], ['c'],
version : '2.4.109', version : '2.4.109',
license : 'MIT', license : 'MIT',
meson_version : '>= 0.48', meson_version : '>= 0.52',
default_options : ['buildtype=debugoptimized', 'c_std=c99'], default_options : ['buildtype=debugoptimized', 'c_std=c99'],
) )
@ -257,9 +257,7 @@ with_man_pages = get_option('man-pages')
prog_rst2man = find_program('rst2man', 'rst2man.py', required: with_man_pages == 'true') prog_rst2man = find_program('rst2man', 'rst2man.py', required: with_man_pages == 'true')
with_man_pages = with_man_pages != 'false' and prog_rst2man.found() with_man_pages = with_man_pages != 'false' and prog_rst2man.found()
config.set10('HAVE_VISIBILITY', config.set10('HAVE_VISIBILITY', cc.has_function_attribute('visibility:hidden'))
cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
name : 'compiler supports __attribute__(("hidden"))'))
foreach t : [ foreach t : [
[with_exynos, 'EXYNOS'], [with_exynos, 'EXYNOS'],