Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lambdas from assert expressions #4256

Merged
merged 2 commits into from Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions libs/assertion/include/hpx/assertion.hpp
Expand Up @@ -57,12 +57,12 @@ namespace hpx { namespace assertion {
#else
/// \cond NOINTERNAL
#define HPX_ASSERT_(expr, msg) \
::hpx::assertion::detail::evaluate_assert( \
[&]() -> bool { return !!(expr); }, \
::hpx::assertion::source_location{__FILE__, \
static_cast<unsigned>(__LINE__), HPX_ASSERT_CURRENT_FUNCTION}, \
HPX_PP_STRINGIZE(expr), [&]() { return msg; }); \
/**/
(!!(expr) ? void() : \
::hpx::assertion::detail::handle_assert( \
::hpx::assertion::source_location{__FILE__, \
static_cast<unsigned>(__LINE__), \
HPX_ASSERT_CURRENT_FUNCTION}, \
HPX_PP_STRINGIZE(expr), msg)) /**/

#if defined(HPX_DEBUG)
#if defined(HPX_COMPUTE_DEVICE_CODE)
Expand Down
14 changes: 2 additions & 12 deletions libs/assertion/include/hpx/assertion/evaluate_assert.hpp
Expand Up @@ -16,18 +16,8 @@

namespace hpx { namespace assertion { namespace detail {
/// \cond NOINTERNAL
HPX_EXPORT void handle_assert(
source_location const& loc, const char* expr, std::string const& msg);

template <typename Expr, typename Msg>
HPX_FORCEINLINE void evaluate_assert(Expr const& expr,
source_location const& loc, const char* expr_string, Msg const& msg)
{
if (!expr())
{
handle_assert(loc, expr_string, msg());
}
}
HPX_EXPORT void handle_assert(source_location const& loc, const char* expr,
std::string const& msg) noexcept;
/// \endcond
}}} // namespace hpx::assertion::detail

Expand Down
2 changes: 1 addition & 1 deletion libs/assertion/src/assertion.cpp
Expand Up @@ -29,7 +29,7 @@ namespace hpx { namespace assertion {

namespace detail {
void handle_assert(source_location const& loc, const char* expr,
std::string const& msg)
std::string const& msg) noexcept
{
if (get_handler() == nullptr)
{
Expand Down