From: Joel Rosdahl Date: Fri, 18 Jun 2021 18:47:17 +0000 (+0200) Subject: Require C++14-compatible compiler to build ccache X-Git-Tag: v4.4~196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4eec5d64e3bbf7aecbbf8fc58c9f44563fda187c;p=thirdparty%2Fccache.git Require C++14-compatible compiler to build ccache Ccache 4.0 introduced a requirement on a C++11-compatible compiler. The language version was primarily chosen to support CentOS 7. The time has now come to bump to C++14, to among other things get access to generic lambda expressions and improved constexpr functions. Another side effect is to get usable support for std::regex due to requiring a newer GCC than 4.8 which lacks such support. --- diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8e9ed6c36..9c6d5b123 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,10 +22,6 @@ jobs: fail-fast: false matrix: config: - - os: ubuntu-18.04 - compiler: gcc - version: "4.8" # results in 4.8.5 - - os: ubuntu-18.04 compiler: gcc version: "5" @@ -155,14 +151,14 @@ jobs: fail-fast: false matrix: config: - - name: Linux GCC debug + C++14 + in source + tracing + - name: Linux GCC debug + in source + tracing os: ubuntu-18.04 CC: gcc CXX: g++ ENABLE_CACHE_CLEANUP_TESTS: 1 BUILDDIR: . CCACHE_LOC: . - CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug -DENABLE_TRACING=1 -DCMAKE_CXX_STANDARD=14 + CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug -DENABLE_TRACING=1 apt_get: elfutils libzstd-dev - name: Linux GCC 32-bit diff --git a/CMakeLists.txt b/CMakeLists.txt index 75342b531..3554e8f65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,10 @@ else() endif() set(CMAKE_PROJECT_DESCRIPTION "a fast C/C++ compiler cache") -if(NOT "${CMAKE_CXX_STANDARD}") - set(CMAKE_CXX_STANDARD 11) +if(MSVC) + set(CMAKE_CXX_STANDARD 17) # Need support for std::filesystem +else() + set(CMAKE_CXX_STANDARD 14) endif() set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) @@ -29,7 +31,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8) - OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.4) + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5) OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)) message( FATAL_ERROR @@ -38,7 +40,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSIO endif() if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4) - OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)) + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)) message( WARNING "The compiler you are using is rather old.\n" diff --git a/cmake/CodeAnalysis.cmake b/cmake/CodeAnalysis.cmake index 4e639a786..1380fab0b 100644 --- a/cmake/CodeAnalysis.cmake +++ b/cmake/CodeAnalysis.cmake @@ -13,7 +13,7 @@ if(ENABLE_CPPCHECK) -q --enable=all --force - --std=c++11 + --std=c++14 -I ${CMAKE_SOURCE_DIR} --template="cppcheck: warning: {id}:{file}:{line}: {message}" -i src/third_party) diff --git a/cmake/DevModeWarnings.cmake b/cmake/DevModeWarnings.cmake index 7ff5411b8..ee464763c 100644 --- a/cmake/DevModeWarnings.cmake +++ b/cmake/DevModeWarnings.cmake @@ -82,8 +82,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") CCACHE_COMPILER_WARNINGS "-Wno-zero-as-null-pointer-constant") add_compile_flag_if_supported( CCACHE_COMPILER_WARNINGS "-Wno-undefined-func-template") - add_compile_flag_if_supported( - CCACHE_COMPILER_WARNINGS "-Wno-return-std-move-in-c++11") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") list( APPEND diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake index 46854f3c0..b0fa8b5f7 100644 --- a/cmake/StandardSettings.cmake +++ b/cmake/StandardSettings.cmake @@ -56,6 +56,6 @@ elseif(MSVC) target_compile_options( standard_settings - INTERFACE /std:c++latest /Zc:preprocessor /Zc:__cplusplus /D_CRT_SECURE_NO_WARNINGS + INTERFACE /Zc:preprocessor /Zc:__cplusplus /D_CRT_SECURE_NO_WARNINGS ) endif() diff --git a/doc/INSTALL.md b/doc/INSTALL.md index a90a24f92..fab33f10c 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -7,7 +7,7 @@ Prerequisites To build ccache you need: - CMake 3.4.3 or newer. -- A C++11 compiler. See [Supported platforms, compilers and +- A C++14 compiler. See [Supported platforms, compilers and languages](https://ccache.dev/platform-compiler-language-support.html) for details. - A C99 compiler. diff --git a/dockerfiles/centos-7/Dockerfile b/dockerfiles/centos-7/Dockerfile index 89a122f04..dc1c9f9d5 100644 --- a/dockerfiles/centos-7/Dockerfile +++ b/dockerfiles/centos-7/Dockerfile @@ -1,6 +1,7 @@ FROM centos:7 RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ + && yum install -y centos-release-scl \ && yum install -y \ asciidoc \ autoconf \ @@ -8,6 +9,7 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n ccache \ clang \ cmake3 \ + devtoolset-8 \ elfutils \ gcc \ gcc-c++ \ @@ -19,3 +21,5 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n && yum clean all \ && cp /usr/bin/cmake3 /usr/bin/cmake \ && cp /usr/bin/ctest3 /usr/bin/ctest + +ENTRYPOINT ["scl", "enable", "devtoolset-8", "--"] diff --git a/misc/test-all-systems b/misc/test-all-systems index ebf6e6837..349d3fd1b 100755 --- a/misc/test-all-systems +++ b/misc/test-all-systems @@ -26,9 +26,6 @@ build debian-9 clang clang++ clang build debian-10 gcc g++ gcc build debian-10 clang clang++ clang -build ubuntu-14.04 gcc g++ gcc -DZSTD_FROM_INTERNET=ON -build ubuntu-14.04 gcc g++ clang -DZSTD_FROM_INTERNET=ON - build ubuntu-16.04 gcc g++ gcc build ubuntu-16.04 gcc g++ clang diff --git a/src/Logging.hpp b/src/Logging.hpp index 38553f25f..5c780ec15 100644 --- a/src/Logging.hpp +++ b/src/Logging.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Joel Rosdahl and other contributors +// Copyright (C) 2020-2021 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -39,13 +39,12 @@ } while (false) // Log a message (plus a newline character) described by a format string with at -// least one placeholder. `format` is compile-time checked if CMAKE_CXX_STANDARD -// >= 14. +// least one placeholder. `format` is checked at compile time. #define LOG(format_, ...) LOG_RAW(fmt::format(FMT_STRING(format_), __VA_ARGS__)) // Log a message (plus a newline character) described by a format string with at // least one placeholder without flushing and with a reused timestamp. `format` -// is compile-time checked if CMAKE_CXX_STANDARD >= 14. +// is checked at compile time. #define BULK_LOG(format_, ...) \ do { \ if (Logging::enabled()) { \