-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to spdlog 1.12 and fmt 10.1.1 (#473)
Authors: - Keith Kraus (https://github.com/kkraus14) - Bradley Dice (https://github.com/bdice) Approvers: - Bradley Dice (https://github.com/bdice) URL: #473
- Loading branch information
Showing
3 changed files
with
52 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
diff --git a/include/spdlog/common.h b/include/spdlog/common.h | ||
index 0a262eb2..29ef2324 100644 | ||
--- a/include/spdlog/common.h | ||
+++ b/include/spdlog/common.h | ||
@@ -62,17 +62,26 @@ | ||
|
||
// visual studio up to 2013 does not support noexcept nor constexpr | ||
#if defined(_MSC_VER) && (_MSC_VER < 1900) | ||
-# define SPDLOG_NOEXCEPT _NOEXCEPT | ||
-# define SPDLOG_CONSTEXPR | ||
-# define SPDLOG_CONSTEXPR_FUNC inline | ||
+ #define SPDLOG_NOEXCEPT _NOEXCEPT | ||
+ #define SPDLOG_CONSTEXPR | ||
#else | ||
-# define SPDLOG_NOEXCEPT noexcept | ||
-# define SPDLOG_CONSTEXPR constexpr | ||
-# if __cplusplus >= 201402L | ||
-# define SPDLOG_CONSTEXPR_FUNC constexpr | ||
-# else | ||
-# define SPDLOG_CONSTEXPR_FUNC inline | ||
-# endif | ||
+ #define SPDLOG_NOEXCEPT noexcept | ||
+ #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 | ||
+ #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__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters