[libc] Support LIBC_COPT_USE_C_ASSERT build flag

In this mode, LIBC_ASSERT is just standard C assert.

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D151498

GitOrigin-RevId: 65c78933ae22a9a26b56ed763f5827765ce7eadf
diff --git a/src/__support/libc_assert.h b/src/__support/libc_assert.h
index d8a1d5f..3aa74ec 100644
--- a/src/__support/libc_assert.h
+++ b/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