Use C++20 (#6877)
This commit is contained in:
parent
8306ed8ae3
commit
b7a990d0b5
@ -54,6 +54,7 @@ Checks: >
|
||||
performance-*,
|
||||
-performance-noexcept-move-constructor,
|
||||
-performance-no-int-to-ptr,
|
||||
-performance-type-promotion-in-math-fn,
|
||||
readability-*,
|
||||
-readability-avoid-const-params-in-decls,
|
||||
-readability-braces-around-statements,
|
||||
@ -82,6 +83,7 @@ Checks: >
|
||||
-readability-make-member-function-const,
|
||||
-readability-redundant-string-init,
|
||||
-readability-non-const-parameter,
|
||||
-readability-container-contains,
|
||||
-readability-static-accessed-through-instance
|
||||
|
||||
WarningsAsErrors: '*'
|
||||
|
31
.github/workflows/osrm-backend.yml
vendored
31
.github/workflows/osrm-backend.yml
vendored
@ -396,7 +396,36 @@ jobs:
|
||||
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
|
||||
echo "JOBS=$((`sysctl -n hw.ncpu` + 1))" >> $GITHUB_ENV
|
||||
fi
|
||||
# See: https://github.com/actions/toolkit/issues/946#issuecomment-1590016041
|
||||
# We need it to be able to access system folders while restoring cached Boost below
|
||||
- name: Give tar root ownership
|
||||
if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
|
||||
run: sudo chown root /bin/tar && sudo chmod u+s /bin/tar
|
||||
- name: Cache Boost
|
||||
if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
|
||||
id: cache-boost
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/usr/local/include/boost
|
||||
/usr/local/lib/libboost*
|
||||
key: v1-boost-${{ runner.os }}-${{ runner.arch }}-${{ matrix.runs-on }}
|
||||
restore-keys: |
|
||||
v1-boost-${{ runner.os }}-${{ runner.arch }}-${{ matrix.runs-on }}
|
||||
|
||||
- name: Install Boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
|
||||
run: |
|
||||
BOOST_VERSION="1.85.0"
|
||||
BOOST_VERSION_UNDERSCORE="${BOOST_VERSION//./_}"
|
||||
wget -q https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDERSCORE}.tar.gz
|
||||
tar xzf boost_${BOOST_VERSION_UNDERSCORE}.tar.gz
|
||||
cd boost_${BOOST_VERSION_UNDERSCORE}
|
||||
sudo ./bootstrap.sh
|
||||
sudo ./b2 install
|
||||
cd ..
|
||||
sudo rm -rf boost_${BOOST_VERSION_UNDERSCORE}*
|
||||
|
||||
- name: Install dev dependencies
|
||||
run: |
|
||||
python3 -m pip install "conan<2.0.0" || python3 -m pip install "conan<2.0.0" --break-system-packages
|
||||
@ -417,7 +446,7 @@ jobs:
|
||||
# Linux dev packages
|
||||
if [ "${ENABLE_CONAN}" != "ON" ]; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
|
||||
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev
|
||||
if [[ "${CCOMPILER}" != clang-* ]]; then
|
||||
sudo apt-get install -y ${CXXCOMPILER}
|
||||
fi
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
|
@ -78,4 +78,9 @@ add_warning(switch-bool)
|
||||
add_warning(tautological-compare)
|
||||
add_warning(trampolines)
|
||||
# these warnings are not enabled by default
|
||||
# no_warning(name-of-warning)
|
||||
# no_warning(name-of-warning)
|
||||
no_warning(deprecated-comma-subscript)
|
||||
no_warning(comma-subscript)
|
||||
no_warning(ambiguous-reversed-operator)
|
||||
no_warning(restrict)
|
||||
no_warning(free-nonheap-object)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef OSRM_STATIC_ASSERT_HPP
|
||||
#define OSRM_STATIC_ASSERT_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace osrm::util
|
||||
@ -8,14 +9,13 @@ namespace osrm::util
|
||||
|
||||
template <typename It, typename Value> inline void static_assert_iter_value()
|
||||
{
|
||||
using IterValueType = typename std::iterator_traits<It>::value_type;
|
||||
static_assert(std::is_same<IterValueType, Value>::value, "");
|
||||
static_assert(std::is_same_v<std::iter_value_t<It>, Value>, "");
|
||||
}
|
||||
|
||||
template <typename It, typename Category> inline void static_assert_iter_category()
|
||||
{
|
||||
using IterCategoryType = typename std::iterator_traits<It>::iterator_category;
|
||||
static_assert(std::is_base_of<Category, IterCategoryType>::value, "");
|
||||
static_assert(std::is_base_of_v<Category, IterCategoryType>, "");
|
||||
}
|
||||
|
||||
} // namespace osrm::util
|
||||
|
Loading…
Reference in New Issue
Block a user