From f4cc92c73de43a1455f63cb734ad161d9c03a4a8 Mon Sep 17 00:00:00 2001 From: Tony Liao Date: Fri, 13 Dec 2024 14:20:24 -0800 Subject: [PATCH] Remove stale references to C++14. The main branch was upgraded to use C++17 after the 29.0 branch cut, in commit https://github.com/protocolbuffers/protobuf/commit/fe535930d3183b46d7e088683cbe8c49285715f8 There are still stale references to C++14 in the code, build chain, and READMEs. This commit cleans up the stale configs and settings. PiperOrigin-RevId: 706000867 --- .github/workflows/test_cpp.yml | 3 +-- CMakeLists.txt | 2 +- cmake/README.md | 14 ++++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index f9a468e1cf799..c88eae04cd836 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -45,8 +45,7 @@ jobs: cache_key: Bazel7 image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" targets: "//src/... //third_party/utf8_range/..." - # TODO: remove -Wno-unreachable-code" when dropping C++14 - - config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --per_file_copt=.*/absl/strings/string_view.h@-Wno-unreachable-code --cxxopt="-Wno-self-assign-overloaded" } + - config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --cxxopt="-Wno-self-assign-overloaded" } cache_key: Bazel7bzlmod image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" targets: "//src/... //third_party/utf8_range/..." diff --git a/CMakeLists.txt b/CMakeLists.txt index cfc5ccbca3dfb..9595238c93a12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,7 +186,7 @@ set(protobuf_LINK_LIBATOMIC false) if (NOT MSVC) include(CheckCXXSourceCompiles) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++14) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++17) check_cxx_source_compiles(" #include int main() { diff --git a/cmake/README.md b/cmake/README.md index 7f210450c9027..bbf64364055d4 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -12,16 +12,18 @@ the same actions can be performed using appropriate GUI tools. ## C++ Version -By default, CMake will use whatever C++ version is the system default. Since -protobuf requires C++14 or newer, sometimes you will need to explicitly override -this. For example, the following: +By default, CMake will use whatever C++ version is the system default. Since +protobuf requires C++17 or newer, sometimes you will need to explicitly override +this. For example, the following: ``` -cmake . -DCMAKE_CXX_STANDARD=14 +cmake . -DCMAKE_CXX_STANDARD=17 cmake --build . ``` -will build protobuf using C++14 (see [CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external} for all available options). +will build protobuf using C++17 (see +[CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external} +for all available options). # Windows Builds @@ -118,7 +120,7 @@ For example: ```console C:\Path\to\build\protobuf> cmake -S. -Bcmake-out \ -DCMAKE_INSTALL_PREFIX=/tmp/protobuf \ - -DCMAKE_CXX_STANDARD=14 \ + -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_PREFIX_PATH=/tmp/absl # Path to where I installed Abseil ```