meson: detect availability of attributes using cc.has_function_attribute()

Alternative to fabc22f599

As suggested in https://github.com/systemd/systemd/pull/41174#discussion_r2966411375
This commit is contained in:
Mike Yuan
2026-03-25 21:54:21 +01:00
committed by Daan De Meyer
parent f3d385da2a
commit aa71035a20
3 changed files with 30 additions and 22 deletions
+7 -4
View File
@@ -80,10 +80,13 @@ endif
efi_conf = configuration_data()
# import several configs from userspace
foreach name : ['HAVE_ATTRIBUTE_RETAIN',
'HAVE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT',
'HAVE_WARNING_ZERO_LENGTH_BOUNDS',
]
foreach name : ['HAVE_WARNING_ZERO_LENGTH_BOUNDS',
'HAVE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT']
efi_conf.set(name, conf.get(name))
endforeach
foreach attr : possible_c_attributes
name = 'HAVE_ATTRIBUTE_' + attr.to_upper()
efi_conf.set(name, conf.get(name))
endforeach