[libc-commits] [libc] [libc] Use `<assert.h>` in overlay mode for LIBC_ASSERT (PR #99875)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 22 06:51:40 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
This uses `internal::exit` which is not built in overlay mode, leading
to linker errors. Fix this to just use `assert.h`.


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


1 Files Affected:

- (modified) libc/src/__support/libc_assert.h (+3-1) 


``````````diff
diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h
index e3235199780c2..72a59f9c0e578 100644
--- a/libc/src/__support/libc_assert.h
+++ b/libc/src/__support/libc_assert.h
@@ -10,7 +10,7 @@
 #define LLVM_LIBC_SRC___SUPPORT_LIBC_ASSERT_H
 
 #include "src/__support/macros/config.h"
-#ifdef LIBC_COPT_USE_C_ASSERT
+#if defined(LIBC_COPT_USE_C_ASSERT) || !defined(LIBC_FULL_BUILD)
 
 // The build is configured to just use the public <assert.h> API
 // for libc's internal assertions.
@@ -69,6 +69,8 @@ LIBC_INLINE void report_assertion_failure(const char *assertion,
 #define __LIBC_MACRO_TO_STR_INDIR(y) __LIBC_MACRO_TO_STR(y)
 #define __LIBC_LINE_STR__ __LIBC_MACRO_TO_STR_INDIR(__LINE__)
 
+#ifdef 
+
 #define LIBC_ASSERT(COND)                                                      \
   do {                                                                         \
     if (!(COND)) {                                                             \

``````````

</details>


https://github.com/llvm/llvm-project/pull/99875


More information about the libc-commits mailing list