Skip to content

Conversation

@jmmartinez
Copy link
Contributor

Reverts #136133

@jmmartinez jmmartinez requested a review from Artem-B June 19, 2025 07:11
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics labels Jun 19, 2025
@jmmartinez jmmartinez requested a review from yxsamliu June 19, 2025 07:11
@llvmbot
Copy link
Member

llvmbot commented Jun 19, 2025

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-clang

Author: Juan Manuel Martinez Caamaño (jmmartinez)

Changes

Reverts llvm/llvm-project#136133


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

2 Files Affected:

  • (modified) clang/lib/Headers/CMakeLists.txt (-1)
  • (removed) clang/lib/Headers/cuda_wrappers/bits/c++config.h (-51)
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index c96d209c1fc0c..c1c9d2e8c7b79 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -341,7 +341,6 @@ set(cuda_wrapper_files
 )
 
 set(cuda_wrapper_bits_files
-  cuda_wrappers/bits/c++config.h
   cuda_wrappers/bits/shared_ptr_base.h
   cuda_wrappers/bits/basic_string.h
   cuda_wrappers/bits/basic_string.tcc
diff --git a/clang/lib/Headers/cuda_wrappers/bits/c++config.h b/clang/lib/Headers/cuda_wrappers/bits/c++config.h
deleted file mode 100644
index eafa13a9cc640..0000000000000
--- a/clang/lib/Headers/cuda_wrappers/bits/c++config.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// libstdc++ uses the non-constexpr function std::__glibcxx_assert_fail()
-// to trigger compilation errors when the __glibcxx_assert(cond) macro
-// is used in a constexpr context.
-// Compilation fails when using code from the libstdc++ (such as std::array) on
-// device code, since these assertions invoke a non-constexpr host function from
-// device code.
-//
-// To work around this issue, we declare our own device version of the function
-
-#ifndef __CLANG_CUDA_WRAPPERS_BITS_CPP_CONFIG
-#define __CLANG_CUDA_WRAPPERS_BITS_CPP_CONFIG
-
-#include_next <bits/c++config.h>
-
-#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_BEGIN_NAMESPACE_STD
-#else
-namespace std {
-#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#endif
-
-#ifdef _GLIBCXX_VERBOSE_ASSERT
-__attribute__((device, noreturn)) inline void
-__glibcxx_assert_fail(const char *file, int line, const char *function,
-                      const char *condition) noexcept {
-  if (file && function && condition)
-    __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", file, line,
-                     function, condition);
-  else if (function)
-    __builtin_printf("%s: Undefined behavior detected.\n", function);
-  __builtin_abort();
-}
-#endif
-
-#endif
-__attribute__((device, noreturn, __always_inline__,
-               __visibility__("default"))) inline void
-__glibcxx_assert_fail(...) noexcept {
-  __builtin_abort();
-}
-#ifdef _LIBCPP_END_NAMESPACE_STD
-_LIBCPP_END_NAMESPACE_STD
-#else
-#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
-_GLIBCXX_END_NAMESPACE_VERSION
-#endif
-} // namespace std
-#endif
-
-#endif

@jmmartinez jmmartinez merged commit 52ff58c into main Jun 19, 2025
11 checks passed
@jmmartinez jmmartinez deleted the revert-136133-glibcxx_assert branch June 19, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants