From f746a59a5c41ce1c8c2ee889fb38c95f898c3a95 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 19 Apr 2024 08:36:16 -0700 Subject: [PATCH] Cleanup FMT_ASSERT --- include/fmt/base.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 26d7da2bfe30..5acd3e648707 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -371,17 +371,17 @@ template constexpr auto const_check(T value) -> T { return value; } FMT_NORETURN FMT_API void assert_fail(const char* file, int line, const char* message); -#ifndef FMT_ASSERT -# ifdef NDEBUG +#if defined(FMT_ASSERT) +// Use the provided definition. +#elif defined(NDEBUG) // FMT_ASSERT is not empty to avoid -Wempty-body. -# define FMT_ASSERT(condition, message) \ - fmt::detail::ignore_unused((condition), (message)) -# else -# define FMT_ASSERT(condition, message) \ - ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \ - ? (void)0 \ - : fmt::detail::assert_fail(__FILE__, __LINE__, (message))) -# endif +# define FMT_ASSERT(condition, message) \ + fmt::detail::ignore_unused((condition), (message)) +#else +# define FMT_ASSERT(condition, message) \ + ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \ + ? (void)0 \ + : fmt::detail::assert_fail(__FILE__, __LINE__, (message))) #endif #ifdef FMT_USE_INT128