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

fix FOLLY_SAFE_CHECK under some gcc versions

Summary: For reasons unknown, some gcc versions disliked the previous code with the constexpr pointer variable, even though most supported compilers and versions accepted it.

Reviewed By: aary, luciang

Differential Revision: D27083528

fbshipit-source-id: b225a3f211a9b51b248cc079cf11e4e25ae30460
parent f8c901f5
......@@ -24,20 +24,21 @@
#include <folly/Preprocessor.h>
#include <folly/lang/CArray.h>
#define FOLLY_DETAIL_SAFE_CHECK_IMPL(d, p, expr, expr_s, ...) \
if ((!d || ::folly::kIsDebug || ::folly::kIsSanitize) && \
!static_cast<bool>(expr)) { \
static constexpr auto __folly_detail_safe_assert_arg = \
::folly::detail::safe_assert_arg{ \
FOLLY_PP_STRINGIZE(expr_s), \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
::folly::detail::safe_assert_msg_types_ptr<decltype( \
::folly::detail::safe_assert_msg_types_seq_of(__VA_ARGS__))>}; \
::folly::detail::safe_assert_terminate<p>( \
__folly_detail_safe_assert_arg, __VA_ARGS__); \
} \
#define FOLLY_DETAIL_SAFE_CHECK_IMPL(d, p, expr, expr_s, ...) \
if ((!d || ::folly::kIsDebug || ::folly::kIsSanitize) && \
!static_cast<bool>(expr)) { \
static constexpr ::folly::detail::safe_assert_arg \
__folly_detail_safe_assert_arg{ \
FOLLY_PP_STRINGIZE(expr_s), \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
::folly::detail::safe_assert_msg_types<decltype( \
::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_SAFE_CHECK
......@@ -112,9 +113,6 @@ template <safe_assert_msg_type... A>
constexpr
typename safe_assert_msg_types<safe_assert_msg_type_s<A...>>::value_type
safe_assert_msg_types<safe_assert_msg_type_s<A...>>::value;
template <typename S>
static constexpr safe_assert_msg_type const* safe_assert_msg_types_ptr =
safe_assert_msg_types<S>::value.data;
struct safe_assert_arg {
char const* expr;
......
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