summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2020-12-30 11:31:08 +0100
committerAndrei Pavel <andrei@isc.org>2020-12-30 14:55:05 +0100
commitc3a44d65d3012eba75d95521a2e00f4345bc659a (patch)
treef895e8b12d28e70c8d2c55d2c7e72321798fbe2d
parent[#1602] add missing-config-h-include step to CI (diff)
downloadkea-c3a44d65d3012eba75d95521a2e00f4345bc659a.tar.xz
kea-c3a44d65d3012eba75d95521a2e00f4345bc659a.zip
[#1602] better comments
-rwxr-xr-xtools/add-config-h.sh2
-rwxr-xr-xtools/check-for-duplicate-includes.sh12
2 files changed, 8 insertions, 6 deletions
diff --git a/tools/add-config-h.sh b/tools/add-config-h.sh
index c6109a6d97..cb522c8777 100755
--- a/tools/add-config-h.sh
+++ b/tools/add-config-h.sh
@@ -70,7 +70,7 @@ root_path=$(cd "$(dirname "${0}")/.." && pwd)
# Get source files that are missing an '#include <config.h>' line.
get_source_files() {
- mandatory_commands cut find grep sed sort uniq
+ mandatory_commands cut find grep sed sort
# Get the files that are missing the include.
source_files=$(cd "${root_path}" && find . -type f | grep -Fv '.git' | \
diff --git a/tools/check-for-duplicate-includes.sh b/tools/check-for-duplicate-includes.sh
index 67a2c59542..05e6c7cc7b 100755
--- a/tools/check-for-duplicate-includes.sh
+++ b/tools/check-for-duplicate-includes.sh
@@ -50,16 +50,17 @@ while test ${#} -gt 0; do
esac; shift
done
-# Get source files that have duplicate '#include' lines.
+# Get the source files that have at least one '#include' line minus the
+# generated files.
get_source_files() {
- mandatory_commands cut find grep sed sort uniq
+ mandatory_commands cut find grep sed sort
- # Get the files that have duplicate includes.
+ # Get the files that have at least one include line.
source_files=$(cd "${root_path}" && find . -type f | grep -Fv '.git' | \
grep -E '\.cc$|\.h$' | xargs grep -El '#include' | \
cut -d ':' -f 1 | sort -uV)
- # Filter out generated files.
+ # Filter out the generated files.
for file in ${filtered_out}; do
source_files=$(printf '%s\n' "${source_files}" | grep -Fv "${file}" | sed '/^$/d')
done
@@ -102,8 +103,9 @@ root_path=$(cd "$(dirname "${0}")/.." && pwd)
# Generated files will be filtered out. Hardcoded list
filtered_out=$(cat "${root_path}/tools/.generated-files.txt")
+# Exceptions:
# src/lib/asiolink/asio_wrapper.h includes <boost/asio.hpp> in both
-# conditionals of an #ifdef. Make an exception for it.
+# conditionals of an #ifdef.
filtered_out="${filtered_out}
src/lib/asiolink/asio_wrapper.h
"