[libc-commits] [libc] [libc] Allow user-defined LIBC_ASSERT macro. (PR #168087)

via libc-commits libc-commits at lists.llvm.org
Fri Nov 14 08:46:11 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (lntue)

<details>
<summary>Changes</summary>

By only defining it if LIBC_ASSERT macro is not defined.

Fixes https://github.com/llvm/llvm-project/issues/162392

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


1 Files Affected:

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


``````````diff
diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h
index ada1795ccb80a..6e0b5bd3d68b4 100644
--- a/libc/src/__support/libc_assert.h
+++ b/libc/src/__support/libc_assert.h
@@ -14,9 +14,11 @@
 // The build is configured to just use the public <assert.h> API
 // for libc's internal assertions.
 
+#ifndef LIBC_ASSERT
 #include <assert.h>
 
 #define LIBC_ASSERT(COND) assert(COND)
+#endif // LIBC_ASSERT
 
 #else // Not LIBC_COPT_USE_C_ASSERT
 

``````````

</details>


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


More information about the libc-commits mailing list