[v2,1/4] Disable __USE_EXTERN_INLINES for clang

Message ID 20221102145559.1962008-2-adhemerval.zanella@linaro.org
State Superseded
Headers
Series Initial fixes for clang build support |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Netto Nov. 2, 2022, 2:55 p.m. UTC
  From: Fangrui Song <maskray@google.com>

clang does not allow to redefine attributes after function declaration.
Although it work for external usage, its breaks the build for internal
symbol that glibc provides as optimization (for instance bsearch
with stdlib-bsearch.h or __cmsg_nxthdr).

Disable such optimization for clang while building glibc.
---
 include/features.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/include/features.h b/include/features.h
index 123de9fd47..4a3fe34267 100644
--- a/include/features.h
+++ b/include/features.h
@@ -502,7 +502,7 @@ 
 /* Decide whether we can define 'extern inline' functions in headers.  */
 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
     && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
-    && defined __extern_inline
+    && defined __extern_inline && !(defined __clang__ && defined _LIBC)
 # define __USE_EXTERN_INLINES	1
 #endif