mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Match SPDLOG_CONSTEXPR_FUNC to FMT_CONSTEXPR (#2901)
* Modify the condition of SPDLOG_CONSTEXPR_FUNC to match that of fmt
This commit is contained in:
parent
508d20f0fa
commit
0c4fb032e4
@ -65,12 +65,21 @@
|
|||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||||
#define SPDLOG_NOEXCEPT _NOEXCEPT
|
#define SPDLOG_NOEXCEPT _NOEXCEPT
|
||||||
#define SPDLOG_CONSTEXPR
|
#define SPDLOG_CONSTEXPR
|
||||||
#define SPDLOG_CONSTEXPR_FUNC inline
|
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_NOEXCEPT noexcept
|
#define SPDLOG_NOEXCEPT noexcept
|
||||||
#define SPDLOG_CONSTEXPR constexpr
|
#define SPDLOG_CONSTEXPR constexpr
|
||||||
#if __cplusplus >= 201402L
|
#endif
|
||||||
|
|
||||||
|
// If building with std::format, can just use constexpr, otherwise if building with fmt
|
||||||
|
// SPDLOG_CONSTEXPR_FUNC needs to be set the same as FMT_CONSTEXPR to avoid situations where
|
||||||
|
// a constexpr function in spdlog could end up calling a non-constexpr function in fmt
|
||||||
|
// depending on the compiler
|
||||||
|
// If fmt determines it can't use constexpr, we should inline the function instead
|
||||||
|
#ifdef SPDLOG_USE_STD_FORMAT
|
||||||
#define SPDLOG_CONSTEXPR_FUNC constexpr
|
#define SPDLOG_CONSTEXPR_FUNC constexpr
|
||||||
|
#else // Being built with fmt
|
||||||
|
#if FMT_USE_CONSTEXPR
|
||||||
|
#define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_CONSTEXPR_FUNC inline
|
#define SPDLOG_CONSTEXPR_FUNC inline
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user