Skip to content

Commit 59b531f

Browse files
Migrate to C++17. Update sol2 to 3.3.0.
1 parent 19d2ec5 commit 59b531f

File tree

413 files changed

+30281
-386658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

413 files changed

+30281
-386658
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- API:
44
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
55
- Build:
6+
- CHANGED: Migrate to C++17. Update sol2 to 3.3.0. [#6279](https://github.com/Project-OSRM/osrm-backend/pull/6279)
67
- CHANGED: Configure CMake to not build flatbuffers tests and samples. [#6274](https://github.com/Project-OSRM/osrm-backend/pull/6274)
78
- CHANGED: Enable more clang-tidy checks. [#6270](https://github.com/Project-OSRM/osrm-backend/pull/6270)
89
- CHANGED: Configure clang-tidy job on CI. [#6261](https://github.com/Project-OSRM/osrm-backend/pull/6261)

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cmake_minimum_required(VERSION 3.2)
22

3+
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
5+
36
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
47
message(FATAL_ERROR "In-source builds are not allowed.
58
Please create a directory and run cmake from there, passing the path to this source directory as the last argument.
@@ -145,7 +148,7 @@ endif()
145148

146149
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
147150
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
148-
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/)
151+
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2-3.3.0/include)
149152
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/variant/include)
150153

151154
set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework)
@@ -413,8 +416,8 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
413416

414417
# Activate C++1y
415418
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
416-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
417-
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++14")
419+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
420+
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++17")
418421
endif()
419422

420423
# Configuring other platform dependencies

include/extractor/scripting_environment_lua.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <mutex>
1313
#include <string>
1414

15-
#include <sol.hpp>
15+
#include <sol/sol.hpp>
1616

1717
namespace osrm
1818
{

src/extractor/scripting_environment_lua.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -945,10 +945,6 @@ Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
945945
auto &context = GetSol2Context();
946946
BOOST_ASSERT(context.state.lua_state() != nullptr);
947947
std::vector<std::string> strings;
948-
if (!context.profile_table[table_name])
949-
{
950-
return strings;
951-
}
952948
sol::table table = context.profile_table[table_name];
953949
if (table.valid())
954950
{
@@ -967,10 +963,6 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
967963

968964
auto &context = GetSol2Context();
969965
BOOST_ASSERT(context.state.lua_state() != nullptr);
970-
if (!context.profile_table[table_name])
971-
{
972-
return string_lists;
973-
}
974966
sol::table table = context.profile_table[table_name];
975967
if (!table.valid())
976968
{
@@ -1171,14 +1163,14 @@ void LuaScriptingContext::ProcessNode(const osmium::Node &node,
11711163
{
11721164
case 4:
11731165
case 3:
1174-
node_function(profile_table, node, result, relations);
1166+
node_function(profile_table, std::cref(node), result, relations);
11751167
break;
11761168
case 2:
1177-
node_function(profile_table, node, result);
1169+
node_function(profile_table, std::cref(node), result);
11781170
break;
11791171
case 1:
11801172
case 0:
1181-
node_function(node, result);
1173+
node_function(std::cref(node), result);
11821174
break;
11831175
}
11841176
}
@@ -1193,14 +1185,14 @@ void LuaScriptingContext::ProcessWay(const osmium::Way &way,
11931185
{
11941186
case 4:
11951187
case 3:
1196-
way_function(profile_table, way, result, relations);
1188+
way_function(profile_table, std::cref(way), std::ref(result), std::cref(relations));
11971189
break;
11981190
case 2:
1199-
way_function(profile_table, way, result);
1191+
way_function(profile_table, std::cref(way), std::ref(result));
12001192
break;
12011193
case 1:
12021194
case 0:
1203-
way_function(way, result);
1195+
way_function(std::cref(way), std::ref(result));
12041196
break;
12051197
}
12061198
}
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// sol2
2-
31
// The MIT License (MIT)
42

5-
// Copyright (c) 2013-2018 Rapptz, ThePhD and contributors
3+
// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors
64

75
// Permission is hereby granted, free of charge, to any person obtaining a copy of
86
// this software and associated documentation files (the "Software"), to deal in
@@ -21,34 +19,35 @@
2119
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2220
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2321

24-
#ifndef SOL_PROTECT_HPP
25-
#define SOL_PROTECT_HPP
22+
// This file was generated with a script.
23+
// Generated 2022-06-25 08:14:19.336233 UTC
24+
// This header was generated with sol v3.3.0 (revision eba86625)
25+
// https://github.com/ThePhD/sol2
26+
27+
#ifndef SOL_SINGLE_CONFIG_HPP
28+
#define SOL_SINGLE_CONFIG_HPP
29+
30+
// beginning of sol/config.hpp
31+
32+
/* Base, empty configuration file!
2633
27-
#include "traits.hpp"
28-
#include <utility>
34+
To override, place a file in your include paths of the form:
2935
30-
namespace sol {
36+
. (your include path here)
37+
| sol (directory, or equivalent)
38+
| config.hpp (your config.hpp file)
3139
32-
template <typename T>
33-
struct protect_t {
34-
T value;
40+
So that when sol2 includes the file
3541
36-
template <typename Arg, typename... Args, meta::disable<std::is_same<protect_t, meta::unqualified_t<Arg>>> = meta::enabler>
37-
protect_t(Arg&& arg, Args&&... args)
38-
: value(std::forward<Arg>(arg), std::forward<Args>(args)...) {
39-
}
42+
#include <sol/config.hpp>
4043
41-
protect_t(const protect_t&) = default;
42-
protect_t(protect_t&&) = default;
43-
protect_t& operator=(const protect_t&) = default;
44-
protect_t& operator=(protect_t&&) = default;
45-
};
44+
it gives you the configuration values you desire. Configuration values can be
45+
seen in the safety.rst of the doc/src, or at
46+
https://sol2.readthedocs.io/en/latest/safety.html ! You can also pass them through
47+
the build system, or the command line options of your compiler.
4648
47-
template <typename T>
48-
auto protect(T&& value) {
49-
return protect_t<std::decay_t<T>>(std::forward<T>(value));
50-
}
49+
*/
5150

52-
} // namespace sol
51+
// end of sol/config.hpp
5352

54-
#endif // SOL_PROTECT_HPP
53+
#endif // SOL_SINGLE_CONFIG_HPP

0 commit comments

Comments
 (0)