From 84b618ed1a4576951ddda07da54e7b4311121a5e Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Tue, 6 Dec 2016 16:14:25 +0100 Subject: [PATCH] Add headers consistency check --- .travis.yml | 3 ++- CMakeLists.txt | 18 ++++++++++++++++++ .../contiguous_internalmem_datafacade_base.hpp | 1 + .../extractor/guidance/road_classification.hpp | 1 + include/extractor/internal_extractor_edge.hpp | 1 + include/util/container.hpp | 2 ++ include/util/dist_table_wrapper.hpp | 2 ++ include/util/fingerprint_impl.hpp.in | 1 + include/util/geojson_debug_logger.hpp | 1 + include/util/geojson_debug_policy_toolkit.hpp | 3 +++ 10 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 494f839c4..e7041cd84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,7 +78,7 @@ matrix: compiler: "gcc-6-release-i686" env: > TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' - CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' + CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' CHECK_HEADERS=yes - os: linux compiler: "gcc-4.9-release" @@ -170,6 +170,7 @@ install: if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo ldconfig fi + - if [[ ${CHECK_HEADERS} == yes ]] ; then make check-headers ; fi - popd - mkdir example/build && pushd example/build - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d92b1670..c18c48b2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -751,3 +751,21 @@ if (ENABLE_FUZZING) add_subdirectory(fuzz) endif () + + +## add headers sanity check target that includes all headers independently +set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers") +file(GLOB_RECURSE headers_to_check + ${PROJECT_BINARY_DIR}/*.hpp + ${PROJECT_SOURCE_DIR}/include/*.hpp) +foreach(header ${headers_to_check}) + get_filename_component(filename ${header} NAME_WE) + set(filename "${check_headers_dir}/${filename}.cpp") + if (NOT EXISTS ${filename}) + file(WRITE ${filename} "#include \"${header}\"\n") + endif() + list(APPEND sources ${filename}) +endforeach() +add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources}) +set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir}) + diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade_base.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade_base.hpp index 07df63c2c..3956d493a 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade_base.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade_base.hpp @@ -7,6 +7,7 @@ #include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_lane_types.hpp" #include "extractor/profile_properties.hpp" +#include "storage/shared_datatype.hpp" #include "util/guidance/bearing_class.hpp" #include "util/guidance/entry_class.hpp" #include "util/guidance/turn_lanes.hpp" diff --git a/include/extractor/guidance/road_classification.hpp b/include/extractor/guidance/road_classification.hpp index 8b8d417ed..2f24fc6ce 100644 --- a/include/extractor/guidance/road_classification.hpp +++ b/include/extractor/guidance/road_classification.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include "extractor/guidance/constants.hpp" diff --git a/include/extractor/internal_extractor_edge.hpp b/include/extractor/internal_extractor_edge.hpp index 012c3c7bc..42fea6e42 100644 --- a/include/extractor/internal_extractor_edge.hpp +++ b/include/extractor/internal_extractor_edge.hpp @@ -8,6 +8,7 @@ #include #include "extractor/guidance/road_classification.hpp" +#include "extractor/guidance/turn_lane_types.hpp" #include "osrm/coordinate.hpp" #include diff --git a/include/util/container.hpp b/include/util/container.hpp index bd85e9c9c..91b1cccb1 100644 --- a/include/util/container.hpp +++ b/include/util/container.hpp @@ -1,6 +1,8 @@ #ifndef CONTAINER_HPP #define CONTAINER_HPP +#include + namespace osrm { namespace util diff --git a/include/util/dist_table_wrapper.hpp b/include/util/dist_table_wrapper.hpp index b73796b1c..143bd56ac 100644 --- a/include/util/dist_table_wrapper.hpp +++ b/include/util/dist_table_wrapper.hpp @@ -1,6 +1,8 @@ #ifndef DIST_TABLE_WRAPPER_H #define DIST_TABLE_WRAPPER_H +#include "util/typedefs.hpp" + #include #include #include diff --git a/include/util/fingerprint_impl.hpp.in b/include/util/fingerprint_impl.hpp.in index a8efc7b7b..aaca9e06d 100644 --- a/include/util/fingerprint_impl.hpp.in +++ b/include/util/fingerprint_impl.hpp.in @@ -1,3 +1,4 @@ +#include "util/fingerprint.hpp" #include "util/exception.hpp" #include "util/exception_utils.hpp" diff --git a/include/util/geojson_debug_logger.hpp b/include/util/geojson_debug_logger.hpp index 226a31cf7..546595093 100644 --- a/include/util/geojson_debug_logger.hpp +++ b/include/util/geojson_debug_logger.hpp @@ -5,6 +5,7 @@ #include #include +#include "util/exception.hpp" #include "util/json_container.hpp" #include "util/json_renderer.hpp" #include "util/log.hpp" diff --git a/include/util/geojson_debug_policy_toolkit.hpp b/include/util/geojson_debug_policy_toolkit.hpp index 1afcc6fb3..c79e0d22a 100644 --- a/include/util/geojson_debug_policy_toolkit.hpp +++ b/include/util/geojson_debug_policy_toolkit.hpp @@ -1,9 +1,12 @@ #ifndef OSRM_GEOJSON_DEBUG_POLICY_TOOLKIT_HPP #define OSRM_GEOJSON_DEBUG_POLICY_TOOLKIT_HPP +#include "extractor/external_memory_node.hpp" +#include "util/coordinate.hpp" #include "util/json_container.hpp" #include +#include #include