Removed SPDLOG_NO_TLS and updated cmake

This commit is contained in:
gabime 2023-07-28 18:38:35 +03:00
parent e1ee0c62a7
commit a38add8456
4 changed files with 2 additions and 26 deletions

View File

@ -26,6 +26,7 @@ endif()
# Compiler config # Compiler config
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# make sure __cplusplus is defined when using msvc and enable parallel build # make sure __cplusplus is defined when using msvc and enable parallel build
if(MSVC) if(MSVC)
@ -115,7 +116,6 @@ endif()
option(SPDLOG_PREVENT_CHILD_FD "Prevent from child processes to inherit log file descriptors" OFF) option(SPDLOG_PREVENT_CHILD_FD "Prevent from child processes to inherit log file descriptors" OFF)
option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each log call if thread id is not needed" OFF) option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each log call if thread id is not needed" OFF)
option(SPDLOG_NO_TLS "prevent spdlog from using thread local storage" OFF)
option( option(
SPDLOG_NO_ATOMIC_LEVELS SPDLOG_NO_ATOMIC_LEVELS
"prevent spdlog from using of std::atomic log levels (use only if your code never modifies log levels concurrently" "prevent spdlog from using of std::atomic log levels (use only if your code never modifies log levels concurrently"
@ -237,7 +237,6 @@ foreach(
SPDLOG_CLOCK_COARSE SPDLOG_CLOCK_COARSE
SPDLOG_PREVENT_CHILD_FD SPDLOG_PREVENT_CHILD_FD
SPDLOG_NO_THREAD_ID SPDLOG_NO_THREAD_ID
SPDLOG_NO_TLS
SPDLOG_NO_ATOMIC_LEVELS SPDLOG_NO_ATOMIC_LEVELS
SPDLOG_DISABLE_DEFAULT_LOGGER SPDLOG_DISABLE_DEFAULT_LOGGER
SPDLOG_USE_STD_FORMAT) SPDLOG_USE_STD_FORMAT)

View File

@ -58,13 +58,6 @@
#endif #endif
// disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS
# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
# define SPDLOG_NO_TLS 1
# endif
#endif
#ifndef SPDLOG_FUNCTION #ifndef SPDLOG_FUNCTION
# define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__) # define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
#endif #endif
@ -138,11 +131,7 @@ template<class T>
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
template<typename Char> template<typename Char>
# if FMT_VERSION >= 90101
using fmt_runtime_string = fmt::runtime_format_string<Char>; using fmt_runtime_string = fmt::runtime_format_string<Char>;
# else
using fmt_runtime_string = fmt::basic_runtime<Char>;
# endif
// clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the condition from basic_format_string here, // clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the condition from basic_format_string here,
// in addition, fmt::basic_runtime<Char> is only convertible to basic_format_string<Char> but not basic_string_view<Char> // in addition, fmt::basic_runtime<Char> is only convertible to basic_format_string<Char> but not basic_string_view<Char>

View File

@ -385,12 +385,9 @@ SPDLOG_INLINE 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_INLINE size_t thread_id() noexcept SPDLOG_INLINE size_t thread_id() noexcept
{ {
#if defined(SPDLOG_NO_TLS) // cache thread id in tls
return _thread_id();
#else // cache thread id in tls
static thread_local const size_t tid = _thread_id(); static thread_local const size_t tid = _thread_id();
return tid; return tid;
#endif
} }
// 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.

View File

@ -36,15 +36,6 @@
// #define SPDLOG_NO_THREAD_ID // #define SPDLOG_NO_THREAD_ID
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to prevent spdlog from using thread local storage.
//
// WARNING: if your program forks, UNCOMMENT this flag to prevent undefined
// thread ids in the children logs.
//
// #define SPDLOG_NO_TLS
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Uncomment to avoid spdlog's usage of atomic log levels // Uncomment to avoid spdlog's usage of atomic log levels
// Use only if your code never modifies a logger's log levels concurrently by // Use only if your code never modifies a logger's log levels concurrently by