Skip to content

Commit b1aced3

Browse files
committed
Add headers consistency check
1 parent f88f51f commit b1aced3

File tree

10 files changed

+32
-1
lines changed

10 files changed

+32
-1
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ matrix:
7878
compiler: "gcc-6-release-i686"
7979
env: >
8080
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
81-
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
81+
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' CHECK_HEADERS=yes
8282
8383
- os: linux
8484
compiler: "gcc-4.9-release"
@@ -170,6 +170,7 @@ install:
170170
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
171171
sudo ldconfig
172172
fi
173+
- if [[ ${CHECK_HEADERS} == yes ]] ; then make check-headers ; fi
173174
- popd
174175
- mkdir example/build && pushd example/build
175176
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,3 +735,21 @@ if (ENABLE_FUZZING)
735735

736736
add_subdirectory(fuzz)
737737
endif ()
738+
739+
740+
## add headers sanity check target that includes all headers independently
741+
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
742+
file(GLOB_RECURSE headers_to_check
743+
${PROJECT_BINARY_DIR}/*.hpp
744+
${PROJECT_SOURCE_DIR}/include/*.hpp)
745+
foreach(header ${headers_to_check})
746+
get_filename_component(filename ${header} NAME_WE)
747+
set(filename "${check_headers_dir}/${filename}.cpp")
748+
if (NOT EXISTS ${filename})
749+
file(WRITE ${filename} "#include \"${header}\"\n")
750+
endif()
751+
list(APPEND sources ${filename})
752+
endforeach()
753+
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
754+
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
755+

include/engine/datafacade/contiguous_internalmem_datafacade_base.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "extractor/guidance/turn_instruction.hpp"
88
#include "extractor/guidance/turn_lane_types.hpp"
99
#include "extractor/profile_properties.hpp"
10+
#include "storage/shared_datatype.hpp"
1011
#include "util/guidance/bearing_class.hpp"
1112
#include "util/guidance/entry_class.hpp"
1213
#include "util/guidance/turn_lanes.hpp"

include/extractor/guidance/road_classification.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <cmath>
55
#include <cstdint>
6+
#include <cstdlib>
67
#include <string>
78

89
#include "extractor/guidance/constants.hpp"

include/extractor/internal_extractor_edge.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <boost/assert.hpp>
99

1010
#include "extractor/guidance/road_classification.hpp"
11+
#include "extractor/guidance/turn_lane_types.hpp"
1112
#include "osrm/coordinate.hpp"
1213
#include <utility>
1314

include/util/container.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef CONTAINER_HPP
22
#define CONTAINER_HPP
33

4+
#include <utility>
5+
46
namespace osrm
57
{
68
namespace util

include/util/dist_table_wrapper.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef DIST_TABLE_WRAPPER_H
22
#define DIST_TABLE_WRAPPER_H
33

4+
#include "util/typedefs.hpp"
5+
46
#include <algorithm>
57
#include <boost/assert.hpp>
68
#include <cstddef>

include/util/fingerprint_impl.hpp.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "util/fingerprint.hpp"
12
#include "util/exception.hpp"
23
#include "util/exception_utils.hpp"
34

include/util/geojson_debug_logger.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <mutex>
66
#include <string>
77

8+
#include "util/exception.hpp"
89
#include "util/json_container.hpp"
910
#include "util/json_renderer.hpp"
1011
#include "util/log.hpp"

include/util/geojson_debug_policy_toolkit.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#ifndef OSRM_GEOJSON_DEBUG_POLICY_TOOLKIT_HPP
22
#define OSRM_GEOJSON_DEBUG_POLICY_TOOLKIT_HPP
33

4+
#include "extractor/external_memory_node.hpp"
5+
#include "util/coordinate.hpp"
46
#include "util/json_container.hpp"
57

68
#include <algorithm>
9+
#include <iterator>
710

811
#include <boost/optional.hpp>
912

0 commit comments

Comments
 (0)