Skip to content

Commit fad0fc3

Browse files
author
MarcoFalke
committed
Refine travis check for duplicate includes
This partially reverts commit c36b720.
1 parent 8d651ae commit fad0fc3

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

contrib/devtools/lint-includes.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ for HEADER_FILE in $(filter_suffix h); do
1919
echo
2020
EXIT_CODE=1
2121
fi
22-
CPP_FILE=${HEADER_FILE/%\.h/.cpp}
23-
if [[ ! -e $CPP_FILE ]]; then
24-
continue
25-
fi
26-
DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES=$(grep -hE "^#include " <(sort -u < "${HEADER_FILE}") <(sort -u < "${CPP_FILE}") | grep -E "^#include " | sort | uniq -d)
27-
if [[ ${DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES} != "" ]]; then
28-
echo "Include(s) from ${HEADER_FILE} duplicated in ${CPP_FILE}:"
29-
echo "${DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES}"
30-
echo
31-
EXIT_CODE=1
32-
fi
3322
done
3423
for CPP_FILE in $(filter_suffix cpp); do
3524
DUPLICATE_INCLUDES_IN_CPP_FILE=$(grep -E "^#include " < "${CPP_FILE}" | sort | uniq -d)

doc/developer-notes.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,7 @@ Source code organization
569569
- *Rationale*: Shorter and simpler header files are easier to read, and reduce compile time
570570
571571
- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
572-
definitions from, even if those headers are already included indirectly through other headers. One exception
573-
is that a `.cpp` file does not need to re-include the includes already included in its corresponding `.h` file.
572+
definitions from, even if those headers are already included indirectly through other headers.
574573
575574
- *Rationale*: Excluding headers because they are already indirectly included results in compilation
576575
failures when those indirect dependencies change. Furthermore, it obscures what the real code

0 commit comments

Comments
 (0)