mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Move ignore_unused to detail
This commit is contained in:
@ -333,11 +333,6 @@ struct monostate {
|
|||||||
constexpr monostate() {}
|
constexpr monostate() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Suppress "unused variable" warnings with the method described in
|
|
||||||
// https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/.
|
|
||||||
// (void)var does not work on many Intel compilers.
|
|
||||||
template <typename... T> FMT_CONSTEXPR void ignore_unused(const T&...) {}
|
|
||||||
|
|
||||||
// An enable_if helper to be used in template parameters which results in much
|
// An enable_if helper to be used in template parameters which results in much
|
||||||
// shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed
|
// shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed
|
||||||
// to workaround a bug in MSVC 2019 (see #1140 and #1186).
|
// to workaround a bug in MSVC 2019 (see #1140 and #1186).
|
||||||
@ -349,6 +344,11 @@ template <typename... T> FMT_CONSTEXPR void ignore_unused(const T&...) {}
|
|||||||
|
|
||||||
FMT_BEGIN_DETAIL_NAMESPACE
|
FMT_BEGIN_DETAIL_NAMESPACE
|
||||||
|
|
||||||
|
// Suppress "unused variable" warnings with the method described in
|
||||||
|
// https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/.
|
||||||
|
// (void)var does not work on many Intel compilers.
|
||||||
|
template <typename... T> FMT_CONSTEXPR void ignore_unused(const T&...) {}
|
||||||
|
|
||||||
constexpr FMT_INLINE auto is_constant_evaluated() FMT_NOEXCEPT -> bool {
|
constexpr FMT_INLINE auto is_constant_evaluated() FMT_NOEXCEPT -> bool {
|
||||||
#ifdef __cpp_lib_is_constant_evaluated
|
#ifdef __cpp_lib_is_constant_evaluated
|
||||||
return std::is_constant_evaluated();
|
return std::is_constant_evaluated();
|
||||||
@ -367,7 +367,7 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
|
|||||||
# ifdef NDEBUG
|
# ifdef NDEBUG
|
||||||
// FMT_ASSERT is not empty to avoid -Werror=empty-body.
|
// FMT_ASSERT is not empty to avoid -Werror=empty-body.
|
||||||
# define FMT_ASSERT(condition, message) \
|
# define FMT_ASSERT(condition, message) \
|
||||||
::fmt::ignore_unused((condition), (message))
|
::fmt::detail::ignore_unused((condition), (message))
|
||||||
# else
|
# else
|
||||||
# define FMT_ASSERT(condition, message) \
|
# define FMT_ASSERT(condition, message) \
|
||||||
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
|
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
|
||||||
|
Reference in New Issue
Block a user