Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C++20 #6877

Merged
merged 69 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
9703b78
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 10, 2024
fe9464b
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
91e8c20
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
39e814a
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
8bf2d9e
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
f4b5004
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
f1f2cb2
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
4efea7c
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
d491b63
Check if it is possible to build project with C++20 on current CI
SiarheiFedartsou May 11, 2024
29b2640
Use clang
SiarheiFedartsou May 11, 2024
a7b4559
Enable other gcc compilers
SiarheiFedartsou May 11, 2024
c865cc5
Enable other gcc compilers
SiarheiFedartsou May 11, 2024
f2c1305
Enable clang-15
SiarheiFedartsou May 11, 2024
69c2231
Enable clang-15
SiarheiFedartsou May 11, 2024
18d82d3
Enable other clang compilers
SiarheiFedartsou May 11, 2024
08438be
Enable other clang compilers
SiarheiFedartsou May 11, 2024
5974436
Enable other clang compilers
SiarheiFedartsou May 11, 2024
bbf2eb4
Enable other clang compilers
SiarheiFedartsou May 11, 2024
4da40c8
Enable other clang compilers
SiarheiFedartsou May 11, 2024
be779c4
Enable other clang compilers
SiarheiFedartsou May 11, 2024
f3a9533
Enable other clang compilers
SiarheiFedartsou May 11, 2024
8baf4b1
Enable other clang compilers
SiarheiFedartsou May 11, 2024
0f99a37
Enable other clang compilers
SiarheiFedartsou May 11, 2024
ba97914
Enable other clang compilers
SiarheiFedartsou May 12, 2024
f57fcf2
Enable other clang compilers
SiarheiFedartsou May 12, 2024
f61e264
wip
SiarheiFedartsou May 21, 2024
f8a061b
wip
SiarheiFedartsou May 21, 2024
41f90ab
Merge branch 'master' into sf-cpp-20
SiarheiFedartsou May 21, 2024
e03c943
wip
SiarheiFedartsou May 21, 2024
71e4b1a
wip
SiarheiFedartsou May 21, 2024
4f9ddba
wip
SiarheiFedartsou May 22, 2024
3094523
wip
SiarheiFedartsou May 22, 2024
7468f2f
wip
SiarheiFedartsou May 23, 2024
7234fcd
wip
SiarheiFedartsou May 23, 2024
91e3943
wip
SiarheiFedartsou May 23, 2024
5408449
wip
SiarheiFedartsou May 23, 2024
8f7d492
wip
SiarheiFedartsou May 23, 2024
90a1f18
wip
SiarheiFedartsou May 23, 2024
8b13365
wip
SiarheiFedartsou May 23, 2024
e79fb0d
Merge branch 'master' into sf-cpp-20
SiarheiFedartsou May 23, 2024
fbe5f0f
wip
SiarheiFedartsou May 23, 2024
f0ac2e3
wip
SiarheiFedartsou May 24, 2024
923f8a8
Merge branch 'master' into sf-cpp-20
SiarheiFedartsou May 24, 2024
400732a
wip
SiarheiFedartsou May 24, 2024
1c3c56b
wip
SiarheiFedartsou May 24, 2024
541d4fa
wip
SiarheiFedartsou May 24, 2024
2fa4506
wip
SiarheiFedartsou May 24, 2024
99aa9cd
wip
SiarheiFedartsou May 24, 2024
405e7f2
wip
SiarheiFedartsou May 24, 2024
fa99143
wip
SiarheiFedartsou May 24, 2024
783fc23
wip
SiarheiFedartsou May 24, 2024
c7065ef
wip
SiarheiFedartsou May 24, 2024
33d50de
wip
SiarheiFedartsou May 24, 2024
ca6f3d7
wip
SiarheiFedartsou May 24, 2024
419b73b
wip
SiarheiFedartsou May 24, 2024
53a251c
wip
SiarheiFedartsou May 24, 2024
836eb8c
wip
SiarheiFedartsou May 24, 2024
e105c02
Merge branch 'master' into sf-cpp-20
SiarheiFedartsou May 24, 2024
969e4cd
wip
SiarheiFedartsou May 24, 2024
6c5249d
wip
SiarheiFedartsou May 24, 2024
e9ad8ba
wip
SiarheiFedartsou May 24, 2024
0449868
wip
SiarheiFedartsou May 24, 2024
f368348
wip
SiarheiFedartsou May 24, 2024
945e4d2
wip
SiarheiFedartsou May 24, 2024
9927826
Update warnings.cmake
SiarheiFedartsou May 24, 2024
d59e07a
Update warnings.cmake
SiarheiFedartsou May 25, 2024
2844267
Update warnings.cmake
SiarheiFedartsou May 25, 2024
e5a1a44
wip
SiarheiFedartsou May 25, 2024
0768998
wip
SiarheiFedartsou May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -82,6 +83,7 @@ Checks: >
-readability-make-member-function-const,
-readability-redundant-string-init,
-readability-non-const-parameter,
-readability-container-contains,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a ticket into the backlog to fix these warnings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, #6902

-readability-static-accessed-through-instance

WarningsAsErrors: '*'
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were problems with Boost from apt on Ubuntu 22.04, so I propose to install it manually for the time being.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a switch to 24.04 make this easier?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, with a switch to 24.04 I had another challenge: sol2 is not compiling with newest clang we would have to switch to on 24.04. There is already fix in LLVM, so I believe it is just easier to wait for a while until this fix will come to GitHub Actions runner image for 24.04 and switch.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is only going to make it to clang 19, unfortunately.

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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
7 changes: 6 additions & 1 deletion cmake/warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 3 additions & 3 deletions include/util/static_assert.hpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#ifndef OSRM_STATIC_ASSERT_HPP
#define OSRM_STATIC_ASSERT_HPP

#include <iterator>
#include <type_traits>

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
Expand Down
Loading