Skip to content

Conversation

@lntue
Copy link
Contributor

@lntue lntue commented Jul 23, 2025

@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2025

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

https://lab.llvm.org/buildbot/#/builders/10/builds/10047/steps/5/logs/stdio


Full diff: https://github.com/llvm/llvm-project/pull/150322.diff

3 Files Affected:

  • (modified) libc/src/__support/CPP/type_traits/is_constant_evaluated.h (-4)
  • (modified) libc/src/__support/RPC/rpc_server.h (+5-1)
  • (modified) libc/src/__support/macros/attributes.h (-6)
diff --git a/libc/src/__support/CPP/type_traits/is_constant_evaluated.h b/libc/src/__support/CPP/type_traits/is_constant_evaluated.h
index 9339af46d6762..0bb2d0806cb0d 100644
--- a/libc/src/__support/CPP/type_traits/is_constant_evaluated.h
+++ b/libc/src/__support/CPP/type_traits/is_constant_evaluated.h
@@ -15,11 +15,7 @@ namespace LIBC_NAMESPACE_DECL {
 namespace cpp {
 
 LIBC_INLINE constexpr bool is_constant_evaluated() {
-#if LIBC_HAS_BUILTIN(__builtin_is_constant_evaluated)
   return __builtin_is_constant_evaluated();
-#else
-  return false;
-#endif
 }
 
 } // namespace cpp
diff --git a/libc/src/__support/RPC/rpc_server.h b/libc/src/__support/RPC/rpc_server.h
index dc3d8030caa47..beea4dd975ea7 100644
--- a/libc/src/__support/RPC/rpc_server.h
+++ b/libc/src/__support/RPC/rpc_server.h
@@ -15,13 +15,17 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_RPC_RPC_SERVER_H
 #define LLVM_LIBC_SRC___SUPPORT_RPC_RPC_SERVER_H
 
+#include "src/__support/macros/properties/compiler.h"
+
 // Workaround for missing __has_builtin in < GCC 10.
 #ifndef __has_builtin
 #define __has_builtin(x) 0
 #endif
 
 // Workaround for missing __builtin_is_constant_evaluated in < GCC 10.
-#ifndef __builtin_is_constant_evaluated
+// Also this builtin is defined for GCC 9.
+#if !(__has_builtin(__builtin_is_constant_evaluated) ||                        \
+      (defined(LIBC_COMPILER_IS_GCC) && (LIBC_COMPILER_GCC_VER >= 900)))
 #define __builtin_is_constant_evaluated(x) 0
 #endif
 
diff --git a/libc/src/__support/macros/attributes.h b/libc/src/__support/macros/attributes.h
index 62b0f7c3d6155..c6474673de85a 100644
--- a/libc/src/__support/macros/attributes.h
+++ b/libc/src/__support/macros/attributes.h
@@ -48,10 +48,4 @@
 #define LIBC_PREFERED_TYPE(TYPE)
 #endif
 
-#ifndef __has_builtin
-#define LIBC_HAS_BUILTIN(X) 0
-#else
-#define LIBC_HAS_BUILTIN(X) __has_builtin(X)
-#endif
-
 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H

@lntue lntue merged commit 49de210 into llvm:main Jul 23, 2025
16 of 21 checks passed
@lntue lntue deleted the gcc branch July 23, 2025 21:17
@Kewen12
Copy link
Contributor

Kewen12 commented Jul 23, 2025

Thanks! This fixes the build issue for us. https://lab.llvm.org/buildbot/#/builders/10/builds/10059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants