diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f95fb58..a4a02096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ endif() # Compiler config # --------------------------------------------------------------------------------------- set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # make sure __cplusplus is defined when using msvc and enable parallel build if(MSVC) @@ -115,7 +116,6 @@ endif() 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_TLS "prevent spdlog from using thread local storage" OFF) option( SPDLOG_NO_ATOMIC_LEVELS "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_PREVENT_CHILD_FD SPDLOG_NO_THREAD_ID - SPDLOG_NO_TLS SPDLOG_NO_ATOMIC_LEVELS SPDLOG_DISABLE_DEFAULT_LOGGER SPDLOG_USE_STD_FORMAT) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 7df7e3cd..e3c97772 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -58,13 +58,6 @@ #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 # define SPDLOG_FUNCTION static_cast(__FUNCTION__) #endif @@ -138,11 +131,7 @@ template using remove_cvref_t = typename std::remove_cv::type>::type; template -# if FMT_VERSION >= 90101 using fmt_runtime_string = fmt::runtime_format_string; -# else -using fmt_runtime_string = fmt::basic_runtime; -# endif // 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 is only convertible to basic_format_string but not basic_string_view diff --git a/include/spdlog/details/os-inl.h b/include/spdlog/details/os-inl.h index b6aaac43..12b59f72 100644 --- a/include/spdlog/details/os-inl.h +++ b/include/spdlog/details/os-inl.h @@ -385,12 +385,9 @@ SPDLOG_INLINE size_t _thread_id() noexcept // Return current thread id as size_t (from thread local storage) SPDLOG_INLINE size_t thread_id() noexcept { -#if defined(SPDLOG_NO_TLS) - return _thread_id(); -#else // cache thread id in tls + // cache thread id in tls static thread_local const size_t tid = _thread_id(); return tid; -#endif } // This is avoid msvc issue in sleep_for that happens if the clock changes. diff --git a/include/spdlog/tweakme.h b/include/spdlog/tweakme.h index b3ef0d68..8b11176f 100644 --- a/include/spdlog/tweakme.h +++ b/include/spdlog/tweakme.h @@ -36,15 +36,6 @@ // #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 // Use only if your code never modifies a logger's log levels concurrently by