diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2022-05-16 21:55:41 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2022-05-23 19:15:58 +0200 |
commit | a078662d9a2d219c4f68c4a298fdca09ebeecbcd (patch) | |
tree | 46c99ceace55ba6316f50a40c92044649aaa3bc4 | |
parent | ef7a5ac68a829ff81c28326134d3a3485b97d426 (diff) | |
download | ccache-a078662d9a2d219c4f68c4a298fdca09ebeecbcd.tar.gz |
build: Require C++17 compiler and CMake 3.15
A C++17-compatible compiler is now readily available on all systems we
target primarily, so it's time to bump to C++17.
Also, we want to use features in CMake 3.15 (see #1069), so bump that
too.
-rw-r--r-- | .github/workflows/build.yaml | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | cmake/CodeAnalysis.cmake | 2 | ||||
-rw-r--r-- | doc/INSTALL.md | 4 | ||||
-rw-r--r-- | dockerfiles/alpine-3.11/Dockerfile (renamed from dockerfiles/alpine-3.14/Dockerfile) | 2 | ||||
-rw-r--r-- | dockerfiles/alpine-3.15/Dockerfile (renamed from dockerfiles/alpine-3.8/Dockerfile) | 2 | ||||
-rw-r--r-- | dockerfiles/centos-7/Dockerfile | 5 | ||||
-rw-r--r-- | dockerfiles/centos-8/Dockerfile | 21 | ||||
-rw-r--r-- | dockerfiles/debian-10/Dockerfile | 20 | ||||
-rw-r--r-- | dockerfiles/fedora-36/Dockerfile (renamed from dockerfiles/fedora-32/Dockerfile) | 2 | ||||
-rw-r--r-- | dockerfiles/ubuntu-18.04/Dockerfile | 7 | ||||
-rwxr-xr-x | misc/test-all-systems | 22 | ||||
-rw-r--r-- | src/.clang-tidy | 3 | ||||
-rw-r--r-- | src/UmaskScope.hpp | 10 |
14 files changed, 37 insertions, 79 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f2e30f94..db828352 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,10 +24,6 @@ jobs: config: - os: ubuntu-18.04 compiler: gcc - version: "6" - - - os: ubuntu-18.04 - compiler: gcc version: "7" - os: ubuntu-18.04 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cb1aa53..aef9de4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) -if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15) - cmake_policy(SET CMP0091 NEW) # Needed by CMAKE_MSVC_RUNTIME_LIBRARY -endif() +cmake_policy(SET CMP0091 NEW) # Needed by CMAKE_MSVC_RUNTIME_LIBRARY project(ccache LANGUAGES C CXX ASM ASM_MASM) if(MSVC) @@ -12,11 +10,7 @@ else() endif() set(CMAKE_PROJECT_DESCRIPTION "a fast C/C++ compiler cache") -if(MSVC) - set(CMAKE_CXX_STANDARD 17) # Need support for std::filesystem -else() - set(CMAKE_CXX_STANDARD 14) -endif() +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/cmake/CodeAnalysis.cmake b/cmake/CodeAnalysis.cmake index 0d3cf024..7bba40d2 100644 --- a/cmake/CodeAnalysis.cmake +++ b/cmake/CodeAnalysis.cmake @@ -10,7 +10,7 @@ if(ENABLE_CPPCHECK) -q --enable=all --force - --std=c++14 + --std=c++17 -I ${CMAKE_SOURCE_DIR} --template="cppcheck: warning: {id}:{file}:{line}: {message}" -i src/third_party) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index e028e4d2..5ce8c2af 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -6,8 +6,8 @@ Prerequisites To build ccache you need: -- CMake 3.10 or newer. -- A C++14 compiler. See [Supported platforms, compilers and +- CMake 3.15 or newer. +- A C++17 compiler. See [Supported platforms, compilers and languages](https://ccache.dev/platform-compiler-language-support.html) for details. - A C99 compiler. diff --git a/dockerfiles/alpine-3.14/Dockerfile b/dockerfiles/alpine-3.11/Dockerfile index 7b795124..7bc1d29f 100644 --- a/dockerfiles/alpine-3.14/Dockerfile +++ b/dockerfiles/alpine-3.11/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14 +FROM alpine:3.11 RUN apk add --no-cache \ bash \ diff --git a/dockerfiles/alpine-3.8/Dockerfile b/dockerfiles/alpine-3.15/Dockerfile index 2aab3547..b97b38c6 100644 --- a/dockerfiles/alpine-3.8/Dockerfile +++ b/dockerfiles/alpine-3.15/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine:3.15 RUN apk add --no-cache \ bash \ diff --git a/dockerfiles/centos-7/Dockerfile b/dockerfiles/centos-7/Dockerfile index d5c4e489..29c3cd8b 100644 --- a/dockerfiles/centos-7/Dockerfile +++ b/dockerfiles/centos-7/Dockerfile @@ -3,13 +3,12 @@ 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 \ - asciidoctor \ autoconf \ bash \ ccache \ clang \ cmake3 \ - devtoolset-8 \ + devtoolset-11 \ elfutils \ gcc \ gcc-c++ \ @@ -21,4 +20,4 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n && cp /usr/bin/cmake3 /usr/bin/cmake \ && cp /usr/bin/ctest3 /usr/bin/ctest -ENTRYPOINT ["scl", "enable", "devtoolset-8", "--"] +ENTRYPOINT ["scl", "enable", "devtoolset-11", "--"] diff --git a/dockerfiles/centos-8/Dockerfile b/dockerfiles/centos-8/Dockerfile deleted file mode 100644 index 28e65df5..00000000 --- a/dockerfiles/centos-8/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM centos:8 - -# also run update due to https://bugs.centos.org/view.php?id=18212 -RUN dnf install -y epel-release \ - && dnf update -y \ - && dnf install -y \ - autoconf \ - bash \ - ccache \ - clang \ - cmake \ - diffutils \ - elfutils \ - gcc \ - gcc-c++ \ - hiredis-devel \ - libzstd-devel \ - make \ - python3 \ - redis \ - && dnf clean all diff --git a/dockerfiles/debian-10/Dockerfile b/dockerfiles/debian-10/Dockerfile deleted file mode 100644 index 54bd4439..00000000 --- a/dockerfiles/debian-10/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM debian:10 - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - bash \ - build-essential \ - ccache \ - clang \ - cmake \ - elfutils \ - gcc-multilib \ - libhiredis-dev \ - libzstd-dev \ - python3 \ - redis-server \ - redis-tools \ - && rm -rf /var/lib/apt/lists/* - -# Redirect all compilers to ccache. -RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done diff --git a/dockerfiles/fedora-32/Dockerfile b/dockerfiles/fedora-36/Dockerfile index c4431a7d..5817fca7 100644 --- a/dockerfiles/fedora-32/Dockerfile +++ b/dockerfiles/fedora-36/Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:32 +FROM fedora:36 RUN dnf install -y \ autoconf \ diff --git a/dockerfiles/ubuntu-18.04/Dockerfile b/dockerfiles/ubuntu-18.04/Dockerfile index 409f6dc3..02df590d 100644 --- a/dockerfiles/ubuntu-18.04/Dockerfile +++ b/dockerfiles/ubuntu-18.04/Dockerfile @@ -7,16 +7,21 @@ RUN apt-get update \ build-essential \ ccache \ clang \ - cmake \ docbook-xml \ docbook-xsl \ elfutils \ gcc-multilib \ + gpg \ libhiredis-dev \ libzstd-dev \ python3 \ redis-server \ redis-tools \ + wget \ + && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - >/usr/share/keyrings/kitware-archive-keyring.gpg \ + && echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' >/etc/apt/sources.list.d/kitware.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends cmake \ && rm -rf /var/lib/apt/lists/* # Redirect all compilers to ccache. diff --git a/misc/test-all-systems b/misc/test-all-systems index 3ab7d855..e5512346 100755 --- a/misc/test-all-systems +++ b/misc/test-all-systems @@ -20,9 +20,6 @@ build() { # NAME CC CXX TEST_CC CMAKE_PARAMS -build debian-10 gcc g++ gcc -build debian-10 clang clang++ clang - build debian-11 gcc g++ gcc build debian-11 clang clang++ clang @@ -32,17 +29,14 @@ build ubuntu-18.04 clang clang++ clang build ubuntu-20.04 gcc g++ gcc build ubuntu-20.04 clang clang++ clang -build centos-7 gcc g++ gcc -DWARNINGS_AS_ERRORS=false -DREDIS_STORAGE_BACKEND=OFF -build centos-7 gcc g++ clang -DWARNINGS_AS_ERRORS=false -DREDIS_STORAGE_BACKEND=OFF - -build centos-8 gcc g++ gcc -build centos-8 clang clang++ clang +build centos-7 gcc g++ gcc -DHIREDIS_FROM_INTERNET=ON +build centos-7 gcc g++ clang -DHIREDIS_FROM_INTERNET=ON -build fedora-32 gcc g++ gcc -build fedora-32 clang clang++ clang +build fedora-36 gcc g++ gcc +build fedora-36 clang clang++ clang -build alpine-3.8 gcc g++ gcc -build alpine-3.8 gcc g++ clang +build alpine-3.11 gcc g++ gcc +build alpine-3.11 gcc g++ clang -build alpine-3.14 gcc g++ gcc -build alpine-3.14 clang clang++ clang +build alpine-3.15 gcc g++ gcc +build alpine-3.15 clang clang++ clang diff --git a/src/.clang-tidy b/src/.clang-tidy index 3781fd60..803b4f56 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -17,13 +17,16 @@ Checks: '-*, -readability-qualified-auto, -readability-redundant-declaration, performance-*, + -performance-no-automatic-move, -performance-unnecessary-value-param, modernize-*, -modernize-avoid-c-arrays, + -modernize-concat-nested-namespaces, -modernize-pass-by-value, -modernize-return-braced-init-list, -modernize-use-auto, -modernize-use-default-member-init, + -modernize-use-nodiscard, -modernize-use-trailing-return-type, cppcoreguidelines-*, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, diff --git a/src/UmaskScope.hpp b/src/UmaskScope.hpp index 2a2f85a7..67338e5a 100644 --- a/src/UmaskScope.hpp +++ b/src/UmaskScope.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2021 Joel Rosdahl and other contributors +// Copyright (C) 2020-2022 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -50,7 +50,15 @@ inline UmaskScope::~UmaskScope() { #ifndef _WIN32 if (m_saved_umask) { + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 +# if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +# endif umask(*m_saved_umask); +# if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic pop +# endif } #endif } |