From 1f05b23b4f9a5ba2a3414f6d06675c93d707f84f Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 4 Aug 2022 11:27:20 +0800 Subject: [PATCH] util: Disable usage of __attribute__((__const__)) when the compiler is clang Clang didn't implement __attribute__((__const__)) properly for release build. The issue tracker is: https://github.com/llvm/llvm-project/issues/56993 Closes #6781 Closes #6782 Signed-off-by: Yonggang Luo Reviewed-by: Jason Ekstrand Part-of: --- src/util/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 652ba63ac5a..88a4c519b17 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -140,7 +140,7 @@ do { \ * value. As a result, calls to it can be CSEed. Note that using memory * pointed to by the arguments is not allowed for const functions. */ -#ifdef HAVE_FUNC_ATTRIBUTE_CONST +#if !defined(__clang__) && defined(HAVE_FUNC_ATTRIBUTE_CONST) #define ATTRIBUTE_CONST __attribute__((__const__)) #else #define ATTRIBUTE_CONST