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
Closes #7170

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18798>
This commit is contained in:
Yonggang Luo
2022-08-04 11:27:20 +08:00
committed by Marge Bot
parent 5e73858b9e
commit 24af5a7f82

View File

@@ -140,7 +140,7 @@ do { \
* value. As a result, calls to it can be CSEed. Note that using memory * 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. * 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__)) #define ATTRIBUTE_CONST __attribute__((__const__))
#else #else
#define ATTRIBUTE_CONST #define ATTRIBUTE_CONST