[Mlir-commits] [lld] [flang] [compiler-rt] [clang] [libcxx] [libc] [clang-tools-extra] [mlir] [llvm] [libc++][hardening] Don't trigger redundant checks in the fast mode. (PR #77176)

Louis Dionne llvmlistbot at llvm.org
Mon Jan 22 12:26:37 PST 2024


================
@@ -350,6 +363,9 @@ _LIBCPP_HARDENING_MODE_DEBUG
 #    define _LIBCPP_ASSERT_PEDANTIC(expression, message)                 _LIBCPP_ASSUME(expression)
 #    define _LIBCPP_ASSERT_INTERNAL(expression, message)                 _LIBCPP_ASSUME(expression)
 #    define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message)            _LIBCPP_ASSUME(expression)
+// TODO(hardening): if `_LIBCPP_ASSUME` becomes functional again (it's currently a no-op), this would essentially
+// discard the assumption.
+#    define _LIBCPP_REDUNDANT_ASSERTION(expression)                      ((void)0)
----------------
ldionne wrote:

```suggestion
#    define _LIBCPP_REDUNDANT_ASSERTION(assertion)                      ((void)0)
```

To make it clear that this is an assertion, not the boolean expression itself. This makes the usage of the macro clearer. And similarly below.

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


More information about the Mlir-commits mailing list