notify: fix ABI incompatibility with NDEBUG on Windows

On MSVC (not with GCC/clang), adding `static` changes the mangled symbol name, so we shouldn't add that when building with NDEBUG.  On GCC/clang, it doesn't, but adding `const` does, and C++11 rules make `constexpr` methods implicitly `const`, so I've removed the `constexpr` variants from NotifyCategoryProxy for now.  Hopefully the compiler is still smart enough to compile out any references when compiling with NDEBUG.
This commit is contained in:
rdb 2019-09-15 20:24:31 +02:00
parent 72b1814331
commit d7681b23d3
3 changed files with 10 additions and 11 deletions

View File

@ -55,8 +55,8 @@ PUBLISHED:
INLINE bool is_spam() const;
INLINE bool is_debug() const;
#else
constexpr static bool is_spam() { return false; }
constexpr static bool is_debug() { return false; }
constexpr bool is_spam() const { return false; }
constexpr bool is_debug() const { return false; }
#endif
INLINE bool is_info() const;
INLINE bool is_warning() const;

View File

@ -65,26 +65,30 @@ is_on(NotifySeverity severity) {
/**
*
*/
#ifdef NOTIFY_DEBUG
template<class GetCategory>
INLINE bool NotifyCategoryProxy<GetCategory>::
is_spam() {
#ifdef NOTIFY_DEBUG
// Instruct the compiler to optimize for the usual case.
return UNLIKELY(get_unsafe_ptr()->is_spam());
}
#else
return false;
#endif
}
/**
*
*/
#ifdef NOTIFY_DEBUG
template<class GetCategory>
INLINE bool NotifyCategoryProxy<GetCategory>::
is_debug() {
#ifdef NOTIFY_DEBUG
// Instruct the compiler to optimize for the usual case.
return UNLIKELY(get_unsafe_ptr()->is_debug());
}
#else
return false;
#endif
}
/**
*

View File

@ -71,13 +71,8 @@ public:
INLINE bool is_on(NotifySeverity severity);
#if defined(NOTIFY_DEBUG) || defined(CPPPARSER)
INLINE bool is_spam();
INLINE bool is_debug();
#else
constexpr static bool is_spam() { return false; }
constexpr static bool is_debug() { return false; }
#endif
INLINE bool is_info();
INLINE bool is_warning();
INLINE bool is_error();