Commit a99615fe authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

support FOLLY_SAFE_CHECK with no message args

Summary:
Permit calls of the form:

```lang=c++
FOLLY_SAFE_DCHECK(expr);
```

Reviewed By: ot

Differential Revision: D27843903

fbshipit-source-id: 23869720822fcdba0845c42279855b101c8e2b36
parent dbfa7c45
......@@ -47,7 +47,8 @@
::folly::detail::safe_assert_msg_types_seq_of( \
__VA_ARGS__))>::value.data}; \
::folly::detail::safe_assert_terminate<p>( \
__folly_detail_safe_assert_arg, __VA_ARGS__); \
__folly_detail_safe_assert_arg FOLLY_PP_DETAIL_APPEND_VA_ARG( \
__VA_ARGS__)); \
} \
} while (false)
......
......@@ -49,6 +49,16 @@ TEST(SafeAssert, AssertionFailure) {
EXPECT_DEATH(fail(), "Message: hello");
}
TEST(SafeAssert, AssertionFailureVariadicFormattedArgs) {
FOLLY_SAFE_CHECK(true);
EXPECT_DEATH( //
([] { FOLLY_SAFE_CHECK(false); }()), //
"Assertion failure: false");
EXPECT_DEATH( //
([] { FOLLY_SAFE_CHECK(false, 17ull, " < ", 18ull); }()), //
"Message: 17 < 18");
}
TEST(SafeAssert, AssertionFailureErrno) {
EXPECT_DEATH(
([] { FOLLY_SAFE_PCHECK((errno = EINVAL) && false, "hello"); }()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment