-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify the condition of SPDLOG_CONSTEXPR_FUNC to match that of fmt #2859
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,15 +64,21 @@ | |
#if defined(_MSC_VER) && (_MSC_VER < 1900) | ||
# define SPDLOG_NOEXCEPT _NOEXCEPT | ||
# define SPDLOG_CONSTEXPR | ||
# define SPDLOG_CONSTEXPR_FUNC inline | ||
#else | ||
# define SPDLOG_NOEXCEPT noexcept | ||
# define SPDLOG_CONSTEXPR constexpr | ||
# if __cplusplus >= 201402L | ||
# define SPDLOG_CONSTEXPR_FUNC constexpr | ||
# else | ||
# define SPDLOG_CONSTEXPR_FUNC inline | ||
# endif | ||
#endif | ||
|
||
#ifndef __has_feature | ||
# define __has_feature(x) 0 | ||
#endif | ||
|
||
#if (__has_feature(cxx_relaxed_constexpr) || (defined(_MSC_VER) && (_MSC_VER >= 1912)) || \ | ||
(defined(__GNUC__) && __GNUC__ >= 6 && defined(__cplusplus) && __cplusplus >= 201402L)) && \ | ||
!defined(__ICL) && !defined(__INTEL_COMPILER) && !defined(__NVCC__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be simplified greatly. No need to check the defined(..), only the comparisons since undefined macro values equal to 0. See https://stackoverflow.com/questions/5085392/what-is-the-value-of-an-undefined-constant-used-in-if Also please add comment describing the purpose of those checks.It will be hard to understand why without description. |
||
# define SPDLOG_CONSTEXPR_FUNC constexpr | ||
#else | ||
# define SPDLOG_CONSTEXPR_FUNC inline | ||
#endif | ||
|
||
#if defined(__GNUC__) || defined(__clang__) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't define standard macros, even if to 0. It will surely break users code.