mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-14 06:59:57 -05:00
spa: utils: cleanup: fix __has_attribute() usage
Unknown preprocessor symbols are replaced with 0 in preprocessor
conditionals, so if `__has_attribute()` is not supported, then
the condition will be the following:
if 0 && 0(__cleanup__)
which is syntactically incorrect.
So split the condition and only check `__has_attribute()` if
it exists.
Fixes: 65d949558b ("spa: utils: add scope based resource cleanup")
Fixes #4962
This commit is contained in:
parent
62022ce623
commit
d3368ee0d5
1 changed files with 6 additions and 2 deletions
|
|
@ -46,9 +46,13 @@ __extension__ ({ \
|
|||
|
||||
/* ========================================================================== */
|
||||
|
||||
#if defined(__has_attribute) && __has_attribute(__cleanup__)
|
||||
|
||||
#ifdef __has_attribute
|
||||
#if __has_attribute(__cleanup__)
|
||||
#define spa_cleanup(func) __attribute__((__cleanup__(func)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef spa_cleanup
|
||||
|
||||
#define SPA_DEFINE_AUTO_CLEANUP(name, type, ...) \
|
||||
typedef __typeof__(type) _spa_auto_cleanup_type_ ## name; \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue