[libc-commits] [PATCH] D151498: [libc] Support LIBC_COPT_USE_C_ASSERT build flag

Roland McGrath via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 25 14:10:55 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG65c78933ae22: [libc] Support LIBC_COPT_USE_C_ASSERT build flag (authored by mcgrathr).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151498/new/

https://reviews.llvm.org/D151498

Files:
  libc/src/__support/libc_assert.h


Index: libc/src/__support/libc_assert.h
===================================================================
--- libc/src/__support/libc_assert.h
+++ libc/src/__support/libc_assert.h
@@ -9,6 +9,17 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_LIBC_ASSERT_H
 #define LLVM_LIBC_SRC_SUPPORT_LIBC_ASSERT_H
 
+#ifdef LIBC_COPT_USE_C_ASSERT
+
+// The build is configured to just use the public <assert.h> API
+// for libc's internal assertions.
+
+#include <assert.h>
+
+#define LIBC_ASSERT(COND) assert(COND)
+
+#else // Not LIBC_COPT_USE_C_ASSERT
+
 #include "src/__support/OSUtil/io.h"
 #include "src/__support/OSUtil/quick_exit.h"
 #include "src/__support/integer_to_string.h"
@@ -58,4 +69,6 @@
   } while (false)
 #endif // NDEBUG
 
+#endif // LIBC_COPT_USE_C_ASSERT
+
 #endif // LLVM_LIBC_SRC_SUPPORT_LIBC_ASSERT_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151498.525796.patch
Type: text/x-patch
Size: 802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230525/351c6ca4/attachment-0001.bin>


More information about the libc-commits mailing list