diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index bad5baecd..04729ec1b 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -335,7 +335,6 @@ jobs: BUILD_TYPE: Release CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -347,7 +346,6 @@ jobs: BUILD_TYPE: Debug CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -359,7 +357,6 @@ jobs: BUILD_TYPE: Release CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -371,7 +368,6 @@ jobs: BUILD_TYPE: Debug CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -384,7 +380,6 @@ jobs: BUILD_TYPE: Release CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -396,7 +391,6 @@ jobs: BUILD_TYPE: Debug CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -433,7 +427,6 @@ jobs: BUILD_TYPE: Release CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -445,7 +438,6 @@ jobs: BUILD_TYPE: Debug CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -482,7 +474,6 @@ jobs: BUILD_TYPE: Release CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -494,7 +485,6 @@ jobs: BUILD_TYPE: Debug CCOMPILER: clang-6.0 CXXCOMPILER: clang++-6.0 - ENABLE_GLIBC_WORKAROUND: ON ENABLE_CONAN: ON NODE_PACKAGE_TESTS_ONLY: ON @@ -513,7 +503,6 @@ jobs: ENABLE_ASSERTIONS: ${{ matrix.ENABLE_ASSERTIONS }} ENABLE_CLANG_TIDY: ${{ matrix.ENABLE_CLANG_TIDY }} ENABLE_COVERAGE: ${{ matrix.ENABLE_COVERAGE }} - ENABLE_GLIBC_WORKAROUND: ${{ matrix.ENABLE_GLIBC_WORKAROUND }} ENABLE_CONAN: ${{ matrix.ENABLE_CONAN }} ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }} NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }} @@ -671,8 +660,8 @@ jobs: -DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \ -DENABLE_CCACHE=ON \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF} \ "${APPLE_SILICON_FLAGS[@]}" + make --jobs=${JOBS} if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" && "${ENABLE_APPLE_SILICON}" != "ON" ]]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f0630b99..0ab646e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ option(ENABLE_LTO "Use LTO if available" OFF) option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF) option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON) option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF) -option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF) option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF) if (ENABLE_CLANG_TIDY) @@ -337,9 +336,9 @@ if (ENABLE_SANITIZER) endif() # Configuring compilers -set(OSRM_WARNING_FLAGS "-Werror=all -Werror=extra -Werror=uninitialized -Werror=unreachable-code -Werror=unused-variable -Werror=unreachable-code -Wno-error=cpp -Wpedantic") +include(cmake/warnings.cmake) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=2 -Wno-error=unused-local-typedef -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024 -Wno-unused-command-line-argument") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024") elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(COLOR_FLAG "-fdiagnostics-color=auto") check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG) @@ -347,7 +346,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(COLOR_FLAG "") endif() # using GCC - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=1 -Wno-error=maybe-uninitialized -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024") if(WIN32) # using mingw add_dependency_defines(-DWIN32) @@ -440,6 +439,8 @@ include_directories(SYSTEM ${CHEAPRULER_INCLUDE_DIR}) add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c") set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON) +target_no_warning(MICROTAR unused-variable) +target_no_warning(MICROTAR format) set(PROTOZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/protozero/include") include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR}) @@ -861,10 +862,6 @@ add_custom_target(uninstall add_subdirectory(unit_tests) add_subdirectory(src/benchmarks) -if (ENABLE_GLIBC_WORKAROUND) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLIBC_WORKAROUND") -endif() - if (ENABLE_NODE_BINDINGS) add_subdirectory(src/nodejs) endif() diff --git a/cmake/warnings.cmake b/cmake/warnings.cmake new file mode 100644 index 000000000..ad9cfb086 --- /dev/null +++ b/cmake/warnings.cmake @@ -0,0 +1,93 @@ +include (CheckCXXCompilerFlag) +include (CheckCCompilerFlag) + +# Try to add -Wflag if compiler supports it +macro (add_warning flag) + string(REPLACE "-" "_" underscored_flag ${flag}) + string(REPLACE "+" "x" underscored_flag ${underscored_flag}) + + check_cxx_compiler_flag("-W${flag}" SUPPORTS_CXXFLAG_${underscored_flag}) + check_c_compiler_flag("-W${flag}" SUPPORTS_CFLAG_${underscored_flag}) + + if (SUPPORTS_CXXFLAG_${underscored_flag}) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${flag}") + else() + message (STATUS "Flag -W${flag} is unsupported") + endif() + + if (SUPPORTS_CFLAG_${underscored_flag}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W${flag}") + else() + message(STATUS "Flag -W${flag} is unsupported") + endif() +endmacro() + +# Try to add -Wno flag if compiler supports it +macro (no_warning flag) + add_warning(no-${flag}) +endmacro () + + +# The same but only for specified target. +macro (target_add_warning target flag) + string (REPLACE "-" "_" underscored_flag ${flag}) + string (REPLACE "+" "x" underscored_flag ${underscored_flag}) + + check_cxx_compiler_flag("-W${flag}" SUPPORTS_CXXFLAG_${underscored_flag}) + + if (SUPPORTS_CXXFLAG_${underscored_flag}) + target_compile_options (${target} PRIVATE "-W${flag}") + else () + message (STATUS "Flag -W${flag} is unsupported") + endif () +endmacro () + +macro (target_no_warning target flag) + target_add_warning(${target} no-${flag}) +endmacro () + +add_warning(all) +add_warning(extra) +add_warning(pedantic) +add_warning(error) # treat all warnings as errors +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_warning(strict-overflow=2) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + add_warning(strict-overflow=1) +endif() +add_warning(suggest-override) +add_warning(suggest-destructor-override) +add_warning(unused) +add_warning(unreachable-code) +add_warning(delete-incomplete) +add_warning(duplicated-cond) +add_warning(disabled-optimization) +add_warning(init-self) +add_warning(bool-compare) +add_warning(logical-not-parentheses) +add_warning(logical-op) +add_warning(maybe-uninitialized) +add_warning(misleading-indentation) +# `no-` prefix is part of warning name(i.e. doesn't mean we are disabling it) +add_warning(no-return-local-addr) +add_warning(odr) +add_warning(pointer-arith) +add_warning(redundant-decls) +add_warning(reorder) +add_warning(shift-negative-value) +add_warning(sizeof-array-argument) +add_warning(switch-bool) +add_warning(tautological-compare) +add_warning(trampolines) +no_warning(c++17-extensions) +# TODO: these warnings are not enabled by default, but we consider them as useful and good to enable in the future +no_warning(implicit-int-conversion) +no_warning(implicit-float-conversion) +no_warning(unused-member-function) +no_warning(old-style-cast) +no_warning(non-virtual-dtor) +no_warning(float-conversion) +no_warning(sign-conversion) +no_warning(shorten-64-to-32) +no_warning(padded) +no_warning(missing-noreturn) \ No newline at end of file diff --git a/include/contractor/contract_excludable_graph.hpp b/include/contractor/contract_excludable_graph.hpp index dbfe87da7..2f49e68eb 100644 --- a/include/contractor/contract_excludable_graph.hpp +++ b/include/contractor/contract_excludable_graph.hpp @@ -56,7 +56,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_, // By not contracting all contractable nodes we avoid creating // a very dense core. This increases the overall graph sizes a little bit // but increases the final CH quality and contraction speed. - constexpr float BASE_CORE = 0.9; + constexpr float BASE_CORE = 0.9f; is_shared_core = contractGraph(contractor_graph, std::move(always_allowed), node_weights, BASE_CORE); diff --git a/include/engine/api/base_api.hpp b/include/engine/api/base_api.hpp index cc568fb57..086c787de 100644 --- a/include/engine/api/base_api.hpp +++ b/include/engine/api/base_api.hpp @@ -123,9 +123,9 @@ class BaseAPI const auto &snapped_location = candidatesSnappedLocation(candidates); const auto &input_location = candidatesInputLocation(candidates); - auto location = - fbresult::Position(static_cast(util::toFloating(snapped_location.lon)), - static_cast(util::toFloating(snapped_location.lat))); + auto location = fbresult::Position( + static_cast(static_cast(util::toFloating(snapped_location.lon))), + static_cast(static_cast(util::toFloating(snapped_location.lat)))); const auto toName = [this](const auto &phantom) { return facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)) @@ -156,8 +156,8 @@ class BaseAPI auto waypoint = std::make_unique(*builder); waypoint->add_location(&location); - waypoint->add_distance( - util::coordinate_calculation::greatCircleDistance(snapped_location, input_location)); + waypoint->add_distance(static_cast( + util::coordinate_calculation::greatCircleDistance(snapped_location, input_location))); waypoint->add_name(name_string); if (parameters.generate_hints) { diff --git a/include/engine/engine.hpp b/include/engine/engine.hpp index 4fe63ec05..451253df6 100644 --- a/include/engine/engine.hpp +++ b/include/engine/engine.hpp @@ -83,7 +83,7 @@ template class Engine final : public EngineInterface Engine(const Engine &) = delete; Engine &operator=(const Engine &) = delete; - virtual ~Engine() = default; + virtual ~Engine() override = default; Status Route(const api::RouteParameters ¶ms, api::ResultT &result) const override final { diff --git a/include/engine/routing_algorithms.hpp b/include/engine/routing_algorithms.hpp index f3610bbb2..0253ef13c 100644 --- a/include/engine/routing_algorithms.hpp +++ b/include/engine/routing_algorithms.hpp @@ -72,7 +72,7 @@ template class RoutingAlgorithms final : public RoutingAlgo { } - virtual ~RoutingAlgorithms() = default; + virtual ~RoutingAlgorithms() override = default; InternalManyRoutesResult AlternativePathSearch(const PhantomEndpointCandidates &endpoint_candidates, diff --git a/include/storage/shared_monitor.hpp b/include/storage/shared_monitor.hpp index 2084112d4..5a8d255d9 100644 --- a/include/storage/shared_monitor.hpp +++ b/include/storage/shared_monitor.hpp @@ -75,7 +75,7 @@ template struct SharedMonitor region = bi::mapped_region(shmem, bi::read_write); } - catch (const bi::interprocess_exception &exception) + catch (const bi::interprocess_exception &) { auto message = boost::format("No shared memory block '%1%' found, have you forgotten " "to run osrm-datastore?") % @@ -124,7 +124,7 @@ template struct SharedMonitor bi::shared_memory_object shmem_open = bi::shared_memory_object(bi::open_only, Data::name, bi::read_only); } - catch (const bi::interprocess_exception &exception) + catch (const bi::interprocess_exception &) { return false; } diff --git a/include/util/exception.hpp b/include/util/exception.hpp index 7a4b89ca4..3dee59ea4 100644 --- a/include/util/exception.hpp +++ b/include/util/exception.hpp @@ -106,7 +106,7 @@ class RuntimeError : public exception // This function exists to 'anchor' the class, and stop the compiler from // copying vtable and RTTI info into every object file that includes // this header. (Caught by -Wweak-vtables under Clang.) - virtual void anchor() const; + virtual void anchor() const override; const ErrorCode code; static std::string BuildMessage(const std::string &message, diff --git a/include/util/filtered_integer_range.hpp b/include/util/filtered_integer_range.hpp index ec0ac596b..4960c9560 100644 --- a/include/util/filtered_integer_range.hpp +++ b/include/util/filtered_integer_range.hpp @@ -87,11 +87,11 @@ template class filtered_range // convenience function to construct an integer range with type deduction template -filtered_range -filtered_irange(const Integer first, - const Integer last, - const Filter &filter, - typename std::enable_if::value>::type * = 0) noexcept +filtered_range filtered_irange( + const Integer first, + const Integer last, + const Filter &filter, + typename std::enable_if::value>::type * = nullptr) noexcept { return filtered_range(first, last, filter); } diff --git a/include/util/ieee754.hpp b/include/util/ieee754.hpp index 39180675f..28a90b500 100644 --- a/include/util/ieee754.hpp +++ b/include/util/ieee754.hpp @@ -89,8 +89,8 @@ struct DiyFp h++; return DiyFp(h, e + rhs.e + 64); #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) - unsigned __int128 p = - static_cast(f) * static_cast(rhs.f); + __extension__ using uint128 = unsigned __int128; + uint128 p = static_cast(f) * static_cast(rhs.f); uint64_t h = p >> 64; uint64_t l = static_cast(p); if (l & (uint64_t(1) << 63)) // rounding diff --git a/include/util/integer_range.hpp b/include/util/integer_range.hpp index c8f56b8f7..2b16cc8b4 100644 --- a/include/util/integer_range.hpp +++ b/include/util/integer_range.hpp @@ -86,7 +86,7 @@ template range irange(const Integer first, const Integer last, - typename std::enable_if::value>::type * = 0) noexcept + typename std::enable_if::value>::type * = nullptr) noexcept { return range(first, last); } diff --git a/include/util/packed_vector.hpp b/include/util/packed_vector.hpp index ae79c3014..2cff90164 100644 --- a/include/util/packed_vector.hpp +++ b/include/util/packed_vector.hpp @@ -49,14 +49,16 @@ template inline T get_lower_half_value(WordT word, WordT mask, std::uint8_t offset, - typename std::enable_if_t::value> * = 0) + typename std::enable_if_t::value> * = nullptr) { return static_cast((word & mask) >> offset); } template -inline T -get_lower_half_value(WordT word, WordT mask, std::uint8_t offset, typename T::value_type * = 0) +inline T get_lower_half_value(WordT word, + WordT mask, + std::uint8_t offset, + typename T::value_type * = nullptr) { return T{static_cast((word & mask) >> offset)}; } @@ -65,14 +67,16 @@ template inline T get_upper_half_value(WordT word, WordT mask, std::uint8_t offset, - typename std::enable_if_t::value> * = 0) + typename std::enable_if_t::value> * = nullptr) { return static_cast((word & mask) << offset); } template -inline T -get_upper_half_value(WordT word, WordT mask, std::uint8_t offset, typename T::value_type * = 0) +inline T get_upper_half_value(WordT word, + WordT mask, + std::uint8_t offset, + typename T::value_type * = nullptr) { static_assert(std::is_unsigned::value, "Only unsigned word types supported for now."); return T{static_cast((word & mask) << offset)}; diff --git a/include/util/query_heap.hpp b/include/util/query_heap.hpp index dc8a2ee53..bf5831bfb 100644 --- a/include/util/query_heap.hpp +++ b/include/util/query_heap.hpp @@ -63,8 +63,6 @@ template class ArrayStorage public: explicit ArrayStorage(std::size_t size) : positions(size, 0) {} - ~ArrayStorage() {} - Key &operator[](NodeID node) { return positions[node]; } Key peek_index(const NodeID node) const { return positions[node]; } diff --git a/include/util/static_graph.hpp b/include/util/static_graph.hpp index a38ba68d1..22cf48755 100644 --- a/include/util/static_graph.hpp +++ b/include/util/static_graph.hpp @@ -313,8 +313,8 @@ class StaticGraph } protected: - NodeIterator number_of_nodes; - EdgeIterator number_of_edges; + NodeIterator number_of_nodes = 0; + EdgeIterator number_of_edges = 0; Vector node_array; Vector edge_array; diff --git a/include/util/typedefs.hpp b/include/util/typedefs.hpp index b1e962e2e..c6519609d 100644 --- a/include/util/typedefs.hpp +++ b/include/util/typedefs.hpp @@ -118,7 +118,7 @@ static const EdgeDuration MAXIMAL_EDGE_DURATION = std::numeric_limits::max(); static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits::max(); static const EdgeDistance INVALID_EDGE_DISTANCE = std::numeric_limits::max(); -static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits::max(); +static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits::max(); using DatasourceID = std::uint8_t; diff --git a/src/extractor/extraction_containers.cpp b/src/extractor/extraction_containers.cpp index 4730441b1..5c3a07309 100644 --- a/src/extractor/extraction_containers.cpp +++ b/src/extractor/extraction_containers.cpp @@ -667,7 +667,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm auto &edge = edge_iterator->result; edge.weight = std::max(1, std::round(segment.weight * weight_multiplier)); edge.duration = std::max(1, std::round(segment.duration * 10.)); - edge.distance = accurate_distance; + edge.distance = static_cast(accurate_distance); // assign new node id const auto node_id = mapExternalToInternalNodeID( diff --git a/src/nodejs/CMakeLists.txt b/src/nodejs/CMakeLists.txt index 45bb431b4..30f4128ff 100644 --- a/src/nodejs/CMakeLists.txt +++ b/src/nodejs/CMakeLists.txt @@ -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) diff --git a/src/nodejs/node_osrm.cpp b/src/nodejs/node_osrm.cpp index 37944d60c..be4757879 100644 --- a/src/nodejs/node_osrm.cpp +++ b/src/nodejs/node_osrm.cpp @@ -141,15 +141,14 @@ inline void async(const Nan::FunctionCallbackInfo &info, struct Worker final : Nan::AsyncWorker { - using Base = Nan::AsyncWorker; - Worker(std::shared_ptr 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 &info, struct Worker final : Nan::AsyncWorker { - using Base = Nan::AsyncWorker; - Worker(std::shared_ptr 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_)} { diff --git a/src/tools/partition.cpp b/src/tools/partition.cpp index bbc8f10ad..6d1e82007 100644 --- a/src/tools/partition.cpp +++ b/src/tools/partition.cpp @@ -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) diff --git a/src/util/glibc_workaround.cpp b/src/util/glibc_workaround.cpp deleted file mode 100644 index ed185016f..000000000 --- a/src/util/glibc_workaround.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifdef GLIBC_WORKAROUND -#include - -// 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 \ No newline at end of file diff --git a/unit_tests/engine/offline_facade.cpp b/unit_tests/engine/offline_facade.cpp index 1c5dfa373..c0be492ac 100644 --- a/unit_tests/engine/offline_facade.cpp +++ b/unit_tests/engine/offline_facade.cpp @@ -119,7 +119,7 @@ class ContiguousInternalMemoryDataFacade ContiguousInternalMemoryDataFacade() {} - ~ContiguousInternalMemoryDataFacade() {} + ~ContiguousInternalMemoryDataFacade() override {} unsigned GetNumberOfNodes() const { return 0; } diff --git a/unit_tests/util/packed_vector.cpp b/unit_tests/util/packed_vector.cpp index 11aedb68d..5de71755e 100644 --- a/unit_tests/util/packed_vector.cpp +++ b/unit_tests/util/packed_vector.cpp @@ -28,11 +28,11 @@ BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test) std::mt19937 rng; rng.seed(1337); - std::uniform_int_distribution dist(0, max_id); + std::uniform_int_distribution dist(0, max_id); for (std::size_t i = 0; i < num_test_cases; i++) { - OSMNodeID r{static_cast(dist(rng))}; // max 33-bit uint + OSMNodeID r{dist(rng)}; // max 33-bit uint packed_ids.push_back(r); original_ids.push_back(r);