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

use static in FOLLY_SAFE_CHECK for clang+asan

Summary: Avoid enlarging data sections. The use of `static` causes data sections to be smaller in certain critical cases.

Reviewed By: cmds, luciang

Differential Revision: D27813138

fbshipit-source-id: 020b14927be5ac035d5f66e7cd652a58f8f820d0
parent e31125bc
......@@ -24,18 +24,27 @@
#include <folly/Preprocessor.h>
#include <folly/lang/CArray.h>
#if __GNUC__ && !__clang__ && FOLLY_SANITIZE_ADDRESS
// gcc+asan has a bug that discards sections when using `static` below
#define FOLLY_DETAIL_SAFE_CHECK_LINKAGE
#else
#define FOLLY_DETAIL_SAFE_CHECK_LINKAGE static
#endif
#define FOLLY_DETAIL_SAFE_CHECK_IMPL(d, p, expr, expr_s, ...) \
if ((!d || ::folly::kIsDebug || ::folly::kIsSanitize) && \
!static_cast<bool>(expr)) { \
constexpr auto __folly_detail_safe_assert_fun = __PRETTY_FUNCTION__; \
constexpr ::folly::detail::safe_assert_arg __folly_detail_safe_assert_arg{ \
FOLLY_PP_STRINGIZE(expr_s), \
__FILE__, \
__LINE__, \
__folly_detail_safe_assert_fun, \
::folly::detail::safe_assert_msg_types<decltype( \
::folly::detail::safe_assert_msg_types_seq_of( \
__VA_ARGS__))>::value.data}; \
FOLLY_DETAIL_SAFE_CHECK_LINKAGE constexpr auto \
__folly_detail_safe_assert_fun = __PRETTY_FUNCTION__; \
FOLLY_DETAIL_SAFE_CHECK_LINKAGE constexpr ::folly::detail::safe_assert_arg \
__folly_detail_safe_assert_arg{ \
FOLLY_PP_STRINGIZE(expr_s), \
__FILE__, \
__LINE__, \
__folly_detail_safe_assert_fun, \
::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__); \
} \
......
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