Module: Mesa
Branch: main
Commit: 1f05b23b4f9a5ba2a3414f6d06675c93d707f84f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f05b23b4f9a5ba2a3414f6d06675c93d707f84f

Author: Yonggang Luo <[email protected]>
Date:   Thu Aug  4 11:27:20 2022 +0800

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 <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18039>

---

 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

Reply via email to