Refactor CMake code related to compiler warnings, enable some additional warnings (#6355)

This commit is contained in:
Siarhei Fedartsou
2022-09-30 11:42:36 +02:00
committed by GitHub
parent 3c5d99b4cb
commit 902bfc7806
23 changed files with 142 additions and 93 deletions
+1 -1
View File
@@ -667,7 +667,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
auto &edge = edge_iterator->result;
edge.weight = std::max<EdgeWeight>(1, std::round(segment.weight * weight_multiplier));
edge.duration = std::max<EdgeWeight>(1, std::round(segment.duration * 10.));
edge.distance = accurate_distance;
edge.distance = static_cast<float>(accurate_distance);
// assign new node id
const auto node_id = mapExternalToInternalNodeID(
+3
View File
@@ -17,6 +17,9 @@ add_nodejs_module(node_osrm node_osrm.cpp)
set_target_properties(node_osrm PROPERTIES CXX_STANDARD 17)
# TODO: we disable clang-tidy for this target, because it causes errors in third-party NodeJs related headers
set_target_properties(node_osrm PROPERTIES CXX_CLANG_TIDY "")
# TODO: we turn off some warnings for this target, because it causes errors in third-party NodeJs related headers
target_no_warning(node_osrm suggest-destructor-override)
target_no_warning(node_osrm suggest-override)
target_link_libraries(node_osrm osrm)
+4 -7
View File
@@ -141,15 +141,14 @@ inline void async(const Nan::FunctionCallbackInfo<v8::Value> &info,
struct Worker final : Nan::AsyncWorker
{
using Base = Nan::AsyncWorker;
Worker(std::shared_ptr<osrm::OSRM> osrm_,
ParamPtr params_,
ServiceMemFn service,
Nan::Callback *callback,
PluginParameters pluginParams_)
: Base(callback, "osrm:async"), osrm{std::move(osrm_)}, service{std::move(service)},
params{std::move(params_)}, pluginParams{std::move(pluginParams_)}
: Nan::AsyncWorker(callback, "osrm:async"), osrm{std::move(osrm_)},
service{std::move(service)}, params{std::move(params_)}, pluginParams{
std::move(pluginParams_)}
{
}
@@ -244,14 +243,12 @@ inline void asyncForTiles(const Nan::FunctionCallbackInfo<v8::Value> &info,
struct Worker final : Nan::AsyncWorker
{
using Base = Nan::AsyncWorker;
Worker(std::shared_ptr<osrm::OSRM> osrm_,
ParamPtr params_,
ServiceMemFn service,
Nan::Callback *callback,
PluginParameters pluginParams_)
: Base(callback, "osrm:asyncForTiles"), osrm{std::move(osrm_)},
: Nan::AsyncWorker(callback, "osrm:asyncForTiles"), osrm{std::move(osrm_)},
service{std::move(service)}, params{std::move(params_)}, pluginParams{
std::move(pluginParams_)}
{
-1
View File
@@ -249,7 +249,6 @@ catch (const osrm::RuntimeError &e)
{
util::DumpMemoryStats();
util::Log(logERROR) << e.what();
return EXIT_FAILURE;
return e.GetCode();
}
catch (const std::bad_alloc &e)
-31
View File
@@ -1,31 +0,0 @@
#ifdef GLIBC_WORKAROUND
#include <stdexcept>
// https://github.com/bitcoin/bitcoin/pull/4042
// allows building against libstdc++-dev-4.9 while avoiding
// GLIBCXX_3.4.20 dep
// This is needed because libstdc++ itself uses this API - its not
// just an issue of your code using it, ughhh
// Note: only necessary on Linux
#ifdef __linux__
#define _ENABLE_GLIBC_WORKAROUND
#warning building with workaround
#else
#warning not building with workaround
#endif
#ifdef _ENABLE_GLIBC_WORKAROUND
namespace std
{
void __throw_out_of_range_fmt(const char *, ...) __attribute__((__noreturn__));
void __throw_out_of_range_fmt(const char *err, ...)
{
// Safe and over-simplified version. Ignore the format and print it as-is.
__throw_out_of_range(err);
}
} // namespace std
#endif // _ENABLE_GLIBC_WORKAROUND
#endif // GLIBC_WORKAROUND