From 7d31693fddd017a5b2e9750f5d9c6b5e4debf181 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Thu, 5 Oct 2023 15:57:51 +0200 Subject: [PATCH] support C++23 --- .github/workflows/android.yml | 2 +- .github/workflows/emscripten.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows.yml | 4 ++-- src/logging.cc | 8 ++++++++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e860d0a3f..0d5434576 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: true matrix: - std: [14, 17, 20] + std: [14, 17, 20, 23] abi: [arm64-v8a, armeabi-v7a, x86_64, x86] build_type: [Debug, Release] diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 4bbb6dc56..ed21ecb19 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -15,7 +15,7 @@ jobs: matrix: build_type: [Release, Debug] lib: [static] - std: [14, 17, 20] + std: [14, 17, 20, 23] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9d29f597b..f0d74b192 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,7 +14,7 @@ jobs: matrix: build_type: [Release, Debug] lib: [shared, static] - std: [14, 17, 20] + std: [14, 17, 20, 23] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 51cf7ffb6..9244bb759 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - std: [14, 17, 20] + std: [14, 17, 20, 23] include: - generator: Ninja - build_type: Debug diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 158e8d1db..c3e792468 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,7 +19,7 @@ jobs: build_type: [Debug, Release] lib: [shared, static] msvc: [VS-16-2019, VS-17-2022] - std: [14, 17, 20] + std: [14, 17, 20, 23] include: - msvc: VS-16-2019 os: windows-2019 @@ -138,7 +138,7 @@ jobs: matrix: build_type: [Debug] lib: [shared, static] - std: [14, 17, 20] + std: [14, 17, 20, 23] sys: [mingw32, mingw64] include: - sys: mingw32 diff --git a/src/logging.cc b/src/logging.cc index 0a5df057b..9dd7dcd3b 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -33,8 +33,10 @@ #include #include +#include #include #include + #ifdef HAVE_UNISTD_H # include // For _exit. #endif @@ -1552,9 +1554,15 @@ static LogMessage::LogMessageData fatal_msg_data_shared; // allocations). static thread_local bool thread_data_available = true; +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L +// std::aligned_storage is deprecated in C++23 +alignas(LogMessage::LogMessageData) static std::byte + thread_msg_data[sizeof(LogMessage::LogMessageData)]; +#else // !(defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L) static thread_local std::aligned_storage< sizeof(LogMessage::LogMessageData), alignof(LogMessage::LogMessageData)>::type thread_msg_data; +#endif // defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L #endif // defined(GLOG_THREAD_LOCAL_STORAGE) LogMessage::LogMessageData::LogMessageData()