diff --git a/sprout/assert.hpp b/sprout/assert.hpp index 6a594af0..114404d6 100644 --- a/sprout/assert.hpp +++ b/sprout/assert.hpp @@ -31,17 +31,8 @@ #if defined(SPROUT_DISABLE_ASSERTS) || defined(NDEBUG) -namespace sprout { - namespace detail { - inline SPROUT_CONSTEXPR bool - assertion_disabled() SPROUT_NOEXCEPT { - return true; - } - } // namespace detail -} // namespace sprout - # define SPROUT_ASSERT(expr) \ - (sprout::detail::assertion_disabled()) + ((void)0) #elif defined(SPROUT_ENABLE_ASSERT_HANDLER) @@ -80,9 +71,10 @@ namespace sprout { } // namespace sprout # define SPROUT_ASSERT(expr) ( \ - sprout::detail::assertion_check( \ + (void)sprout::detail::assertion_check( \ (expr), SPROUT_ASSERTION_FAILED_FORMAT(expr, __FILE__, __LINE__), \ - #expr, "(unknown)"/*SPROUT_CURRENT_FUNCTION*/, __FILE__, __LINE__) \ + #expr, "(unknown)"/*SPROUT_CURRENT_FUNCTION*/, __FILE__, __LINE__ \ + ) \ ) #else @@ -103,7 +95,7 @@ namespace sprout { } // namespace sprout # define SPROUT_ASSERT(expr) \ - (sprout::detail::assertion_check((expr), SPROUT_ASSERTION_FAILED_FORMAT(expr, __FILE__, __LINE__))) + ((void)sprout::detail::assertion_check((expr), SPROUT_ASSERTION_FAILED_FORMAT(expr, __FILE__, __LINE__))) #endif @@ -114,7 +106,7 @@ namespace sprout { #if defined(SPROUT_DISABLE_ASSERTS) || defined(NDEBUG) # define SPROUT_ASSERT_MSG(expr, msg) \ - (sprout::detail::assertion_disabled()) + ((void)0) #elif defined(SPROUT_ENABLE_ASSERT_HANDLER) @@ -141,9 +133,10 @@ namespace sprout { } // namespace sprout # define SPROUT_ASSERT_MSG(expr, msg) ( \ - sprout::detail::assertion_check_msg( \ + (void)sprout::detail::assertion_check_msg( \ (expr), SPROUT_ASSERTION_FAILED_FORMAT(expr, __FILE__, __LINE__), \ - #expr, msg, "(unknown)"/*SPROUT_CURRENT_FUNCTION*/, __FILE__, __LINE__) \ + #expr, msg, "(unknown)"/*SPROUT_CURRENT_FUNCTION*/, __FILE__, __LINE__ \ + ) \ ) #else @@ -164,7 +157,7 @@ namespace sprout { } // namespace sprout # define SPROUT_ASSERT_MSG(expr, msg) \ - (sprout::detail::assertion_check_msg((expr), SPROUT_ASSERTION_FAILED_FORMAT(expr, __FILE__, __LINE__), msg)) + ((void)sprout::detail::assertion_check_msg((expr), SPROUT_ASSERTION_FAILED_FORMAT(expr, __FILE__, __LINE__), msg)) #endif @@ -184,11 +177,12 @@ namespace sprout { } // namespace sprout # define SPROUT_VERIFY(expr) \ - (sprout::detail::verification_disabled((expr))) + ((void)(sprout::detail::verification_disabled((expr)))) #else -# define SPROUT_VERIFY(expr) SPROUT_ASSERT(expr) +# define SPROUT_VERIFY(expr) \ + SPROUT_ASSERT(expr) #endif diff --git a/sprout/optional/optional.hpp b/sprout/optional/optional.hpp index bc60fd59..7420b2e8 100644 --- a/sprout/optional/optional.hpp +++ b/sprout/optional/optional.hpp @@ -120,12 +120,12 @@ namespace sprout { return get(); } SPROUT_CONSTEXPR reference_const_type get() const { - return SPROUT_ASSERT(is_initialized()) ? val.get() + return (SPROUT_ASSERT(is_initialized()), true) ? val.get() : val.get() ; } reference_type get() { - return SPROUT_ASSERT(is_initialized()) ? val.get() + return (SPROUT_ASSERT(is_initialized()), true) ? val.get() : val.get() ; } diff --git a/sprout/variant/variant.hpp b/sprout/variant/variant.hpp index 1f31b735..12b5e808 100644 --- a/sprout/variant/variant.hpp +++ b/sprout/variant/variant.hpp @@ -291,7 +291,7 @@ namespace sprout { I != sizeof...(Types), typename sprout::tuples::tuple_element::type const& >::type get_at() const { - return SPROUT_ASSERT(I == which_) ? sprout::tuples::get(tuple_) + return (SPROUT_ASSERT(I == which_), true) ? sprout::tuples::get(tuple_) : sprout::tuples::get(tuple_) ; } @@ -300,7 +300,7 @@ namespace sprout { I != sizeof...(Types), typename sprout::tuples::tuple_element::type& >::type get_at() { - return SPROUT_ASSERT(I == which_) ? sprout::tuples::get(tuple_) + return (SPROUT_ASSERT(I == which_), true) ? sprout::tuples::get(tuple_) : sprout::tuples::get(tuple_) ; }