summaryrefslogtreecommitdiff
path: root/tools/include_check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/include_check.sh')
-rwxr-xr-xtools/include_check.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/include_check.sh b/tools/include_check.sh
index 70abada1640d..a9a9873ca7df 100755
--- a/tools/include_check.sh
+++ b/tools/include_check.sh
@@ -1,15 +1,22 @@
-#!/bin/sh
+#!/bin/sh -u
# Copyright (c) 2019 Yubico AB. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# SPDX-License-Identifier: BSD-2-Clause
+SKIP='(webauthn.h)'
+
check() {
- for f in $(find $1 -maxdepth 1 -name '*.h'); do
- echo "#include \"$f\"" | \
- cc $CFLAGS -Isrc -xc -c - -o /dev/null 2>&1
- echo "$f $CFLAGS $?"
+ try="cc $CFLAGS -Isrc -xc -c - -o /dev/null 2>&1"
+ git ls-files "$1" | grep '.*\.h$' | while read -r header; do
+ if echo "$header" | grep -Eq "$SKIP"; then
+ echo "Skipping $header"
+ else
+ body="#include \"$header\""
+ echo "echo $body | $try"
+ echo "$body" | eval "$try"
+ fi
done
}