Skip to content

Commit

Permalink
Upgrade to C++17 (#3878)
Browse files Browse the repository at this point in the history
* kick ci with fresh cache

* building everything locally worked with c++17

* remove deprecated std::iterator inheritance; upgarde libosmium

* not sure about the other consts#

* changelog

* update version

* changelog
  • Loading branch information
nilsnolde committed Jan 3, 2023
1 parent 1a48cb0 commit ea7d44a
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Expand Up @@ -51,8 +51,8 @@ jobs:
- run: git submodule sync && git submodule update --init
- restore_cache:
keys:
- ccache-debug-linux-x86_64-v2-{{ .Branch }}-{{ checksum "conanfile.txt" }}
- ccache-debug-linux-x86_64-v2-{{ checksum "conanfile.txt" }}
- ccache-debug-linux-x86_64-v3-{{ .Branch }}-{{ checksum "conanfile.txt" }}
- ccache-debug-linux-x86_64-v3-{{ checksum "conanfile.txt" }}
- run: mkdir build
- run: |
# NOTE: -Werror disabled in CI, as we currently have >4k warnings.
Expand All @@ -71,7 +71,7 @@ jobs:
# Note: we save the cache here before doing linting so that if linting fails, we can rebuild quickly
# for follow-up fixes
- save_cache:
key: ccache-debug-linux-x86_64-v2-{{ .Branch }}-{{ checksum "conanfile.txt" }}-{{ epoch }}
key: ccache-debug-linux-x86_64-v3-{{ .Branch }}-{{ checksum "conanfile.txt" }}-{{ epoch }}
paths:
- ~/.ccache
- ~/.conan
Expand Down Expand Up @@ -99,8 +99,8 @@ jobs:
- run: git submodule sync && git submodule update --init
- restore_cache:
keys:
- ccache-release-linux-x86_64-v2-{{ .Branch }}-{{ checksum "conanfile.txt" }}
- ccache-release-linux-x86_64-v2-{{ checksum "conanfile.txt" }}
- ccache-release-linux-x86_64-v3-{{ .Branch }}-{{ checksum "conanfile.txt" }}
- ccache-release-linux-x86_64-v3-{{ checksum "conanfile.txt" }}
- run: mkdir build
- run: |
cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DENABLE_PYTHON_BINDINGS=On \
Expand All @@ -114,7 +114,7 @@ jobs:
- run: make -C build -j8 benchmarks
- run: make -C build -j8 run-benchmarks
- save_cache:
key: ccache-release-linux-x86_64-v2-{{ .Branch }}-{{ checksum "conanfile.txt" }}-{{ epoch }}
key: ccache-release-linux-x86_64-v3-{{ .Branch }}-{{ checksum "conanfile.txt" }}-{{ epoch }}
paths:
- ~/.ccache
- ~/.conan
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
@@ -1,8 +1,14 @@
## Release Date: 2022-??-?? Valhalla 3.3.0
## Release Date: 2022-??-?? Valhalla 3.3.1
* **Removed**
* **Bug Fix**
* **Enhancement**

## Release Date: 2022-01-03 Valhalla 3.3.0
* **Removed**
* **Bug Fix**
* **Enhancement**
* CHANGED: Upgraded from C++14 to C++17. [#3878](https://github.com/valhalla/valhalla/pull/3878)

## Release Date: 2022-01-03 Valhalla 3.2.1
* **Removed**
* **Bug Fix**
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -17,7 +17,7 @@ set(VALHALLA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VALHALLA_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
list(INSERT CMAKE_MODULE_PATH 0 ${VALHALLA_SOURCE_DIR}/cmake)

set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ language version to use (default is 14)")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ language version to use (default is 17)")
option(ENABLE_TOOLS "Enable Valhalla tools" ON)
option(ENABLE_DATA_TOOLS "Enable Valhalla data tools" ON)
option(ENABLE_SERVICES "Enable Valhalla services" ON)
Expand Down
1 change: 1 addition & 0 deletions src/baldr/tz_alt.cpp
Expand Up @@ -357,6 +357,7 @@ CONSTDATA auto max_day = date::December/31;

#if USE_OS_TZDB

// TODO: still the right macro?
CONSTCD14 const sys_seconds min_seconds = sys_days(min_year/min_day);

#endif // USE_OS_TZDB
Expand Down
2 changes: 1 addition & 1 deletion third_party/libosmium
Submodule libosmium updated 314 files
4 changes: 4 additions & 0 deletions valhalla/baldr/datetime.h
Expand Up @@ -12,6 +12,10 @@
#include <unordered_map>
#include <vector>

// date emits a warning otherwise for C++17, see
// https://github.com/valhalla/valhalla/pull/3878#issuecomment-1365487437
#define HAS_UNCAUGHT_EXCEPTIONS 1

#include <date/date.h>
#include <date/tz.h>

Expand Down
8 changes: 7 additions & 1 deletion valhalla/meili/routing.h
Expand Up @@ -305,8 +305,14 @@ find_shortest_path(baldr::GraphReader& reader,
const float max_time);

// Route path iterator. Methods to assist recovering route paths from Labels.
class RoutePathIterator : public std::iterator<std::forward_iterator_tag, const Label> {
class RoutePathIterator {
public:
using iterator_category = std::forward_iterator_tag;
using value_type = const Label;
using difference_type = std::ptrdiff_t;
using pointer = const Label*;
using reference = const Label&;

// Construct a route path iterator.
RoutePathIterator(const LabelSet* labelset, const uint32_t label_idx)
: labelset_(labelset), label_idx_(label_idx) {
Expand Down
7 changes: 6 additions & 1 deletion valhalla/meili/viterbi_search.h
Expand Up @@ -46,8 +46,13 @@ class StateLabel {
class IViterbiSearch;

// TODO test it
class StateIdIterator : public std::iterator<std::forward_iterator_tag, StateId> {
class StateIdIterator {
public:
using iterator_category = std::forward_iterator_tag;
using value_type = StateId;
using difference_type = std::ptrdiff_t;
using pointer = StateId*;
using reference = StateId&;
StateIdIterator(IViterbiSearch& vs,
StateId::Time time,
const StateId& stateid,
Expand Down
4 changes: 2 additions & 2 deletions valhalla/valhalla.h
@@ -1,5 +1,5 @@
#pragma once

#define VALHALLA_VERSION_MAJOR 3
#define VALHALLA_VERSION_MINOR 2
#define VALHALLA_VERSION_PATCH 1
#define VALHALLA_VERSION_MINOR 3
#define VALHALLA_VERSION_PATCH 0

0 comments on commit ea7d44a

Please sign in to comment.