From ae3fa15c11944348783d854e315ac347218a0ffe Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Fri, 1 Mar 2024 16:01:18 +0100 Subject: [PATCH] Fix build for gcc 11 Make sure that the function pointer checks in the dispatch macros are done at compilation time, as gcc 11 raised warnings for the current solution. --- intrinsiccv/include/intrinsiccv/dispatch.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/intrinsiccv/include/intrinsiccv/dispatch.h b/intrinsiccv/include/intrinsiccv/dispatch.h index 1147cd4e5..6c5d91675 100644 --- a/intrinsiccv/include/intrinsiccv/dispatch.h +++ b/intrinsiccv/include/intrinsiccv/dispatch.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates // // SPDX-License-Identifier: Apache-2.0 @@ -6,6 +6,7 @@ #define INTRINSICCV_DISPATCH_H #include +#include #include "intrinsiccv/config.h" #include "sys/ifunc.h" @@ -42,9 +43,10 @@ static inline bool hwcaps_has_sme2(HwCaps hwcaps) { #endif #ifdef INTRINSICCV_HAVE_SVE2 -#define INTRINSICCV_SVE2_RESOLVE_IFUNC(sve2_impl) \ - if (sve2_impl && hwcaps_has_sve2(hwcaps)) { \ - return sve2_impl; \ +#define INTRINSICCV_SVE2_RESOLVE_IFUNC(sve2_impl) \ + if (!std::is_null_pointer_v && \ + hwcaps_has_sve2(hwcaps)) { \ + return sve2_impl; \ } #else @@ -52,9 +54,10 @@ static inline bool hwcaps_has_sme2(HwCaps hwcaps) { #endif #ifdef INTRINSICCV_HAVE_SME2 -#define INTRINSICCV_SME2_RESOLVE_IFUNC(sme2_impl) \ - if (sme2_impl && hwcaps_has_sme2(hwcaps)) { \ - return sme2_impl; \ +#define INTRINSICCV_SME2_RESOLVE_IFUNC(sme2_impl) \ + if (!std::is_null_pointer_v && \ + hwcaps_has_sme2(hwcaps)) { \ + return sme2_impl; \ } #else #define INTRINSICCV_SME2_RESOLVE_IFUNC(sme2_impl) -- GitLab