Replaced SPDLOG_CONSTEXPR and SPDLOG_NOEXCEPT macros with c++20 keywords

This commit is contained in:
gabime 2023-07-28 18:27:05 +03:00
parent d7db2cf3aa
commit e1ee0c62a7
12 changed files with 69 additions and 91 deletions

View File

@ -20,17 +20,17 @@ constexpr
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES; static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) noexcept
{ {
return level_string_views[l]; return level_string_views[l];
} }
SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) noexcept
{ {
return short_level_names[l]; return short_level_names[l];
} }
SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) noexcept
{ {
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name); auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
if (it != std::end(level_string_views)) if (it != std::end(level_string_views))
@ -64,7 +64,7 @@ SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
#endif #endif
} }
SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT SPDLOG_INLINE const char *spdlog_ex::what() const noexcept
{ {
return msg_.c_str(); return msg_.c_str();
} }

View File

@ -57,28 +57,6 @@
# define SPDLOG_FMT_STRING(format_string) format_string # define SPDLOG_FMT_STRING(format_string) format_string
#endif #endif
// 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
#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
#if defined(__GNUC__) || defined(__clang__)
# define SPDLOG_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
# define SPDLOG_DEPRECATED __declspec(deprecated)
#else
# define SPDLOG_DEPRECATED
#endif
// disable thread local on msvc 2013 // disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS #ifndef SPDLOG_NO_TLS
@ -245,9 +223,9 @@ enum level_enum : int
} }
#endif #endif
SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) noexcept;
SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) noexcept;
SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT; SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) noexcept;
} // namespace level } // namespace level
@ -279,7 +257,7 @@ class SPDLOG_API spdlog_ex : public std::exception
public: public:
explicit spdlog_ex(std::string msg); explicit spdlog_ex(std::string msg);
spdlog_ex(const std::string &msg, int last_errno); spdlog_ex(const std::string &msg, int last_errno);
const char *what() const SPDLOG_NOEXCEPT override; const char *what() const noexcept override;
private: private:
std::string msg_; std::string msg_;
@ -290,14 +268,14 @@ private:
struct source_loc struct source_loc
{ {
SPDLOG_CONSTEXPR source_loc() = default; constexpr source_loc() = default;
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in) constexpr source_loc(const char *filename_in, int line_in, const char *funcname_in)
: filename{filename_in} : filename{filename_in}
, line{line_in} , line{line_in}
, funcname{funcname_in} , funcname{funcname_in}
{} {}
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT constexpr bool empty() const noexcept
{ {
return line == 0; return line == 0;
} }
@ -325,23 +303,23 @@ namespace details {
// to_string_view // to_string_view
SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(const memory_buf_t &buf) SPDLOG_NOEXCEPT constexpr spdlog::string_view_t to_string_view(const memory_buf_t &buf) noexcept
{ {
return spdlog::string_view_t{buf.data(), buf.size()}; return spdlog::string_view_t{buf.data(), buf.size()};
} }
SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(spdlog::string_view_t str) SPDLOG_NOEXCEPT constexpr spdlog::string_view_t to_string_view(spdlog::string_view_t str) noexcept
{ {
return str; return str;
} }
#if defined(SPDLOG_WCHAR_FILENAMES) #if defined(SPDLOG_WCHAR_FILENAMES)
SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(const wmemory_buf_t &buf) SPDLOG_NOEXCEPT constexpr spdlog::wstring_view_t to_string_view(const wmemory_buf_t &buf) noexcept
{ {
return spdlog::wstring_view_t{buf.data(), buf.size()}; return spdlog::wstring_view_t{buf.data(), buf.size()};
} }
SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str) SPDLOG_NOEXCEPT constexpr spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str) noexcept
{ {
return str; return str;
} }
@ -355,7 +333,7 @@ inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, Args
} }
#elif __cpp_lib_format >= 202207L #elif __cpp_lib_format >= 202207L
template<typename T, typename... Args> template<typename T, typename... Args>
SPDLOG_CONSTEXPR_FUNC std::basic_string_view<T> to_string_view(std::basic_format_string<T, Args...> fmt) SPDLOG_NOEXCEPT constexpr std::basic_string_view<T> to_string_view(std::basic_format_string<T, Args...> fmt) noexcept
{ {
return fmt.get(); return fmt.get();
} }

View File

@ -34,12 +34,12 @@ public:
// move cannot be default, // move cannot be default,
// since we need to reset head_, tail_, etc to zero in the moved object // since we need to reset head_, tail_, etc to zero in the moved object
circular_q(circular_q &&other) SPDLOG_NOEXCEPT circular_q(circular_q &&other) noexcept
{ {
copy_moveable(std::move(other)); copy_moveable(std::move(other));
} }
circular_q &operator=(circular_q &&other) SPDLOG_NOEXCEPT circular_q &operator=(circular_q &&other) noexcept
{ {
copy_moveable(std::move(other)); copy_moveable(std::move(other));
return *this; return *this;
@ -128,7 +128,7 @@ public:
private: private:
// copy from other&& and reset it to disabled state // copy from other&& and reset it to disabled state
void copy_moveable(circular_q &&other) SPDLOG_NOEXCEPT void copy_moveable(circular_q &&other) noexcept
{ {
max_items_ = other.max_items_; max_items_ = other.max_items_;
head_ = other.head_; head_ = other.head_;

View File

@ -29,7 +29,7 @@ template<typename T>
inline void append_int(T n, memory_buf_t &dest) inline void append_int(T n, memory_buf_t &dest)
{ {
// Buffer should be large enough to hold all digits (digits10 + 1) and a sign // Buffer should be large enough to hold all digits (digits10 + 1) and a sign
SPDLOG_CONSTEXPR const auto BUF_SIZE = std::numeric_limits<T>::digits10 + 2; constexpr const auto BUF_SIZE = std::numeric_limits<T>::digits10 + 2;
char buf[BUF_SIZE]; char buf[BUF_SIZE];
auto [ptr, ec] = std::to_chars(buf, buf + BUF_SIZE, n, 10); auto [ptr, ec] = std::to_chars(buf, buf + BUF_SIZE, n, 10);
@ -52,7 +52,7 @@ inline void append_int(T n, memory_buf_t &dest)
#endif #endif
template<typename T> template<typename T>
SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) constexpr unsigned int count_digits_fallback(T n)
{ {
// taken from fmt: https://github.com/fmtlib/fmt/blob/8.0.1/include/fmt/format.h#L899-L912 // taken from fmt: https://github.com/fmtlib/fmt/blob/8.0.1/include/fmt/format.h#L899-L912
unsigned int count = 1; unsigned int count = 1;

View File

@ -26,7 +26,7 @@ SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
update_string_views(); update_string_views();
} }
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)} SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) noexcept : log_msg{other}, buffer{std::move(other.buffer)}
{ {
update_string_views(); update_string_views();
} }
@ -40,7 +40,7 @@ SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &ot
return *this; return *this;
} }
SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) noexcept
{ {
log_msg::operator=(other); log_msg::operator=(other);
buffer = std::move(other.buffer); buffer = std::move(other.buffer);

View File

@ -20,9 +20,9 @@ public:
log_msg_buffer() = default; log_msg_buffer() = default;
explicit log_msg_buffer(const log_msg &orig_msg); explicit log_msg_buffer(const log_msg &orig_msg);
log_msg_buffer(const log_msg_buffer &other); log_msg_buffer(const log_msg_buffer &other);
log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT; log_msg_buffer(log_msg_buffer &&other) noexcept;
log_msg_buffer &operator=(const log_msg_buffer &other); log_msg_buffer &operator=(const log_msg_buffer &other);
log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT; log_msg_buffer &operator=(log_msg_buffer &&other) noexcept;
}; };
} // namespace details } // namespace details

View File

@ -74,7 +74,7 @@ namespace spdlog {
namespace details { namespace details {
namespace os { namespace os {
SPDLOG_INLINE spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT SPDLOG_INLINE spdlog::log_clock::time_point now() noexcept
{ {
#if defined __linux__ && defined SPDLOG_CLOCK_COARSE #if defined __linux__ && defined SPDLOG_CLOCK_COARSE
@ -87,7 +87,7 @@ SPDLOG_INLINE spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT
return log_clock::now(); return log_clock::now();
#endif #endif
} }
SPDLOG_INLINE std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT SPDLOG_INLINE std::tm localtime(const std::time_t &time_tt) noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -100,13 +100,13 @@ SPDLOG_INLINE std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
return tm; return tm;
} }
SPDLOG_INLINE std::tm localtime() SPDLOG_NOEXCEPT SPDLOG_INLINE std::tm localtime() noexcept
{ {
std::time_t now_t = ::time(nullptr); std::time_t now_t = ::time(nullptr);
return localtime(now_t); return localtime(now_t);
} }
SPDLOG_INLINE std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT SPDLOG_INLINE std::tm gmtime(const std::time_t &time_tt) noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -119,7 +119,7 @@ SPDLOG_INLINE std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
return tm; return tm;
} }
SPDLOG_INLINE std::tm gmtime() SPDLOG_NOEXCEPT SPDLOG_INLINE std::tm gmtime() noexcept
{ {
std::time_t now_t = ::time(nullptr); std::time_t now_t = ::time(nullptr);
return gmtime(now_t); return gmtime(now_t);
@ -166,7 +166,7 @@ SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename
return *fp == nullptr; return *fp == nullptr;
} }
SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT SPDLOG_INLINE int remove(const filename_t &filename) noexcept
{ {
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
return ::_wremove(filename.c_str()); return ::_wremove(filename.c_str());
@ -175,12 +175,12 @@ SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT
#endif #endif
} }
SPDLOG_INLINE int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT SPDLOG_INLINE int remove_if_exists(const filename_t &filename) noexcept
{ {
return path_exists(filename) ? remove(filename) : 0; return path_exists(filename) ? remove(filename) : 0;
} }
SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename2) noexcept
{ {
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
return ::_wrename(filename1.c_str(), filename2.c_str()); return ::_wrename(filename1.c_str(), filename2.c_str());
@ -190,7 +190,7 @@ SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename
} }
// Return true if path exists (file or directory) // Return true if path exists (file or directory)
SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT SPDLOG_INLINE bool path_exists(const filename_t &filename) noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32
# ifdef SPDLOG_WCHAR_FILENAMES # ifdef SPDLOG_WCHAR_FILENAMES
@ -334,7 +334,7 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm)
// Return current thread id as size_t // Return current thread id as size_t
// It exists because the std::this_thread::get_id() is much slower(especially // It exists because the std::this_thread::get_id() is much slower(especially
// under VS 2013) // under VS 2013)
SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT SPDLOG_INLINE size_t _thread_id() noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32
return static_cast<size_t>(::GetCurrentThreadId()); return static_cast<size_t>(::GetCurrentThreadId());
@ -383,7 +383,7 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
} }
// Return current thread id as size_t (from thread local storage) // Return current thread id as size_t (from thread local storage)
SPDLOG_INLINE size_t thread_id() SPDLOG_NOEXCEPT SPDLOG_INLINE size_t thread_id() noexcept
{ {
#if defined(SPDLOG_NO_TLS) #if defined(SPDLOG_NO_TLS)
return _thread_id(); return _thread_id();
@ -395,7 +395,7 @@ SPDLOG_INLINE size_t thread_id() SPDLOG_NOEXCEPT
// This is avoid msvc issue in sleep_for that happens if the clock changes. // This is avoid msvc issue in sleep_for that happens if the clock changes.
// See https://github.com/gabime/spdlog/issues/609 // See https://github.com/gabime/spdlog/issues/609
SPDLOG_INLINE void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT SPDLOG_INLINE void sleep_for_millis(unsigned int milliseconds) noexcept
{ {
#if defined(_WIN32) #if defined(_WIN32)
::Sleep(milliseconds); ::Sleep(milliseconds);
@ -419,7 +419,7 @@ SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
} }
#endif #endif
SPDLOG_INLINE int pid() SPDLOG_NOEXCEPT SPDLOG_INLINE int pid() noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -431,7 +431,7 @@ SPDLOG_INLINE int pid() SPDLOG_NOEXCEPT
// Determine if the terminal supports colors // Determine if the terminal supports colors
// Based on: https://github.com/agauniyal/rang/ // Based on: https://github.com/agauniyal/rang/
SPDLOG_INLINE bool is_color_terminal() SPDLOG_NOEXCEPT SPDLOG_INLINE bool is_color_terminal() noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32
return true; return true;
@ -462,7 +462,7 @@ SPDLOG_INLINE bool is_color_terminal() SPDLOG_NOEXCEPT
// Determine if the terminal attached // Determine if the terminal attached
// Source: https://github.com/agauniyal/rang/ // Source: https://github.com/agauniyal/rang/
SPDLOG_INLINE bool in_terminal(FILE *file) SPDLOG_NOEXCEPT SPDLOG_INLINE bool in_terminal(FILE *file) noexcept
{ {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -10,15 +10,15 @@ namespace spdlog {
namespace details { namespace details {
namespace os { namespace os {
SPDLOG_API spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT; SPDLOG_API spdlog::log_clock::time_point now() noexcept;
SPDLOG_API std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT; SPDLOG_API std::tm localtime(const std::time_t &time_tt) noexcept;
SPDLOG_API std::tm localtime() SPDLOG_NOEXCEPT; SPDLOG_API std::tm localtime() noexcept;
SPDLOG_API std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT; SPDLOG_API std::tm gmtime(const std::time_t &time_tt) noexcept;
SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT; SPDLOG_API std::tm gmtime() noexcept;
// eol definition // eol definition
#if !defined(SPDLOG_EOL) #if !defined(SPDLOG_EOL)
@ -29,7 +29,7 @@ SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT;
# endif # endif
#endif #endif
SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL; constexpr static const char *default_eol = SPDLOG_EOL;
// folder separator // folder separator
#if !defined(SPDLOG_FOLDER_SEPS) #if !defined(SPDLOG_FOLDER_SEPS)
@ -40,23 +40,23 @@ SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
# endif # endif
#endif #endif
SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS; constexpr static const char folder_seps[] = SPDLOG_FOLDER_SEPS;
SPDLOG_CONSTEXPR static const filename_t::value_type folder_seps_filename[] = SPDLOG_FILENAME_T(SPDLOG_FOLDER_SEPS); constexpr static const filename_t::value_type folder_seps_filename[] = SPDLOG_FILENAME_T(SPDLOG_FOLDER_SEPS);
// fopen_s on non windows for writing // fopen_s on non windows for writing
SPDLOG_API bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode); SPDLOG_API bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode);
// Remove filename. return 0 on success // Remove filename. return 0 on success
SPDLOG_API int remove(const filename_t &filename) SPDLOG_NOEXCEPT; SPDLOG_API int remove(const filename_t &filename) noexcept;
// Remove file if exists. return 0 on success // Remove file if exists. return 0 on success
// Note: Non atomic (might return failure to delete if concurrently deleted by other process/thread) // Note: Non atomic (might return failure to delete if concurrently deleted by other process/thread)
SPDLOG_API int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT; SPDLOG_API int remove_if_exists(const filename_t &filename) noexcept;
SPDLOG_API int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT; SPDLOG_API int rename(const filename_t &filename1, const filename_t &filename2) noexcept;
// Return if file exists. // Return if file exists.
SPDLOG_API bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT; SPDLOG_API bool path_exists(const filename_t &filename) noexcept;
// Return file size according to open FILE* object // Return file size according to open FILE* object
SPDLOG_API size_t filesize(FILE *f); SPDLOG_API size_t filesize(FILE *f);
@ -67,26 +67,26 @@ SPDLOG_API int utc_minutes_offset(const std::tm &tm = details::os::localtime());
// Return current thread id as size_t // Return current thread id as size_t
// It exists because the std::this_thread::get_id() is much slower(especially // It exists because the std::this_thread::get_id() is much slower(especially
// under VS 2013) // under VS 2013)
SPDLOG_API size_t _thread_id() SPDLOG_NOEXCEPT; SPDLOG_API size_t _thread_id() noexcept;
// Return current thread id as size_t (from thread local storage) // Return current thread id as size_t (from thread local storage)
SPDLOG_API size_t thread_id() SPDLOG_NOEXCEPT; SPDLOG_API size_t thread_id() noexcept;
// This is avoid msvc issue in sleep_for that happens if the clock changes. // This is avoid msvc issue in sleep_for that happens if the clock changes.
// See https://github.com/gabime/spdlog/issues/609 // See https://github.com/gabime/spdlog/issues/609
SPDLOG_API void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT; SPDLOG_API void sleep_for_millis(unsigned int milliseconds) noexcept;
SPDLOG_API std::string filename_to_str(const filename_t &filename); SPDLOG_API std::string filename_to_str(const filename_t &filename);
SPDLOG_API int pid() SPDLOG_NOEXCEPT; SPDLOG_API int pid() noexcept;
// Determine if the terminal supports colors // Determine if the terminal supports colors
// Source: https://github.com/agauniyal/rang/ // Source: https://github.com/agauniyal/rang/
SPDLOG_API bool is_color_terminal() SPDLOG_NOEXCEPT; SPDLOG_API bool is_color_terminal() noexcept;
// Determine if the terminal attached // Determine if the terminal attached
// Source: https://github.com/agauniyal/rang/ // Source: https://github.com/agauniyal/rang/
SPDLOG_API bool in_terminal(FILE *file) SPDLOG_NOEXCEPT; SPDLOG_API bool in_terminal(FILE *file) noexcept;
#if defined(SPDLOG_WCHAR_FILENAMES) && defined(_WIN32) #if defined(SPDLOG_WCHAR_FILENAMES) && defined(_WIN32)
SPDLOG_API void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target); SPDLOG_API void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target);

View File

@ -121,7 +121,7 @@ struct formatter<spdlog::details::dump_info<T>, char>
// parse the format string flags // parse the format string flags
template<typename ParseContext> template<typename ParseContext>
SPDLOG_CONSTEXPR_FUNC auto parse(ParseContext &ctx) -> decltype(ctx.begin()) constexpr auto parse(ParseContext &ctx) -> decltype(ctx.begin())
{ {
auto it = ctx.begin(); auto it = ctx.begin();
while (it != ctx.end() && *it != '}') while (it != ctx.end() && *it != '}')
@ -158,8 +158,8 @@ struct formatter<spdlog::details::dump_info<T>, char>
template<typename FormatContext, typename Container> template<typename FormatContext, typename Container>
auto format(const spdlog::details::dump_info<Container> &the_range, FormatContext &ctx) const -> decltype(ctx.out()) auto format(const spdlog::details::dump_info<Container> &the_range, FormatContext &ctx) const -> decltype(ctx.out())
{ {
SPDLOG_CONSTEXPR const char *hex_upper = "0123456789ABCDEF"; constexpr const char *hex_upper = "0123456789ABCDEF";
SPDLOG_CONSTEXPR const char *hex_lower = "0123456789abcdef"; constexpr const char *hex_lower = "0123456789abcdef";
const char *hex_chars = use_uppercase ? hex_upper : hex_lower; const char *hex_chars = use_uppercase ? hex_upper : hex_lower;
#if !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION < 60000 #if !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION < 60000

View File

@ -23,7 +23,7 @@ SPDLOG_INLINE logger::logger(const logger &other)
, custom_err_handler_(other.custom_err_handler_) , custom_err_handler_(other.custom_err_handler_)
{} {}
SPDLOG_INLINE logger::logger(logger &&other) SPDLOG_NOEXCEPT : name_(std::move(other.name_)), SPDLOG_INLINE logger::logger(logger &&other) noexcept : name_(std::move(other.name_)),
sinks_(std::move(other.sinks_)), sinks_(std::move(other.sinks_)),
level_(other.level_.load(std::memory_order_relaxed)), level_(other.level_.load(std::memory_order_relaxed)),
flush_level_(other.flush_level_.load(std::memory_order_relaxed)), flush_level_(other.flush_level_.load(std::memory_order_relaxed)),
@ -31,13 +31,13 @@ SPDLOG_INLINE logger::logger(logger &&other) SPDLOG_NOEXCEPT : name_(std::move(o
{} {}
SPDLOG_INLINE logger &logger::operator=(logger other) SPDLOG_NOEXCEPT SPDLOG_INLINE logger &logger::operator=(logger other) noexcept
{ {
this->swap(other); this->swap(other);
return *this; return *this;
} }
SPDLOG_INLINE void logger::swap(spdlog::logger &other) SPDLOG_NOEXCEPT SPDLOG_INLINE void logger::swap(spdlog::logger &other) noexcept
{ {
name_.swap(other.name_); name_.swap(other.name_);
sinks_.swap(other.sinks_); sinks_.swap(other.sinks_);

View File

@ -72,9 +72,9 @@ public:
virtual ~logger() = default; virtual ~logger() = default;
logger(const logger &other); logger(const logger &other);
logger(logger &&other) SPDLOG_NOEXCEPT; logger(logger &&other) noexcept;
logger &operator=(logger other) SPDLOG_NOEXCEPT; logger &operator=(logger other) noexcept;
void swap(spdlog::logger &other) SPDLOG_NOEXCEPT; void swap(spdlog::logger &other) noexcept;
template<typename... Args> template<typename... Args>
void log(source_loc loc, level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args) void log(source_loc loc, level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args)

View File

@ -51,12 +51,12 @@ struct local_alloc_t
{ {
HLOCAL hlocal_; HLOCAL hlocal_;
SPDLOG_CONSTEXPR local_alloc_t() SPDLOG_NOEXCEPT : hlocal_(nullptr) {} constexpr local_alloc_t() noexcept : hlocal_(nullptr) {}
local_alloc_t(local_alloc_t const &) = delete; local_alloc_t(local_alloc_t const &) = delete;
local_alloc_t &operator=(local_alloc_t const &) = delete; local_alloc_t &operator=(local_alloc_t const &) = delete;
~local_alloc_t() SPDLOG_NOEXCEPT ~local_alloc_t() noexcept
{ {
if (hlocal_) if (hlocal_)
{ {