Skip to content

Commit

Permalink
don't need to inline, simplify to always use FMT_CONSTEXPR if it's de…
Browse files Browse the repository at this point in the history
…fined
  • Loading branch information
kkraus14 committed Oct 12, 2023
1 parent 2421b09 commit 1897f70
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions include/spdlog/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,13 @@
#define SPDLOG_CONSTEXPR constexpr
#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
// 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
#ifdef FMT_CONSTEXPR
#define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
#else
#define SPDLOG_CONSTEXPR_FUNC constexpr
#else // Being built with fmt
#if FMT_USE_CONSTEXPR
#define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR
#else
#define SPDLOG_CONSTEXPR_FUNC inline
#endif
#endif

#if defined(__GNUC__) || defined(__clang__)
Expand Down

0 comments on commit 1897f70

Please sign in to comment.