Module: Mesa Branch: main Commit: 1980827aeb40725a57db6c2d79cc5323898631b9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1980827aeb40725a57db6c2d79cc5323898631b9
Author: Thomas H.P. Andersen <[email protected]> Date: Tue Sep 6 00:25:50 2022 +0200 util: avoid deprecated builtin has_trivial_destructor >From clang 16 has_trivial_destructor is deprecated. Use the replacement __is_trivially_destructible if it is available. Fixes new warnings with clang 16 like: ../src/compiler/glsl/list.h:58:4: warning: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Wdeprecated-builtins] ../src/util/ralloc.h:551:4: note: expanded from macro 'DECLARE_RZALLOC_CXX_OPERATORS' DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, rzalloc_size) ^ ../src/util/ralloc.h:542:12: note: expanded from macro 'DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE' if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \ ^ ../src/util/macros.h:233:44: note: expanded from macro 'HAS_TRIVIAL_DESTRUCTOR' Reviewed-by: Eric Engestrom <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18423> --- src/util/macros.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index f726483ee20..4175a795a8f 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -228,8 +228,10 @@ do { \ * performs no action and all member variables and base classes are * trivially destructible themselves. */ -# if (defined(__clang__) && defined(__has_feature)) -# if __has_feature(has_trivial_destructor) +# if defined(__clang__) +# if __has_builtin(__is_trivially_destructible) +# define HAS_TRIVIAL_DESTRUCTOR(T) __is_trivially_destructible(T) +# elif (defined(__has_feature) && __has_feature(has_trivial_destructor)) # define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) # endif # elif defined(__GNUC__)
