summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2020-05-24 13:15:24 +0800
committerMatt Johnston <matt@ucc.asn.au>2020-05-24 13:15:24 +0800
commit1353f081d446f98b7c2e40f25f4dc7ed1298458c (patch)
tree410af1a9ee8e6e91a319e9ddba39a3c73035be26
parent62206fee241f03f3656ebd1c7aa1d80990cddb34 (diff)
downloaddropbear-1353f081d446f98b7c2e40f25f4dc7ed1298458c.tar.gz
Add linter for #ifdef
-rw-r--r--Makefile.in5
-rwxr-xr-xdropbear_lint.sh8
-rwxr-xr-xrelease.sh1
3 files changed, 13 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index aaf7b3b..76379d2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -236,7 +236,7 @@ $(STATIC_LTC): $(OPTION_HEADERS)
$(STATIC_LTM): $(OPTION_HEADERS)
$(MAKE) -C libtommath
-.PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
+.PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean lint
ltc-clean:
$(MAKE) -C libtomcrypt clean
@@ -262,6 +262,9 @@ distclean: clean tidy
tidy:
-rm -f *~ *.gcov */*~
+lint:
+ cd $(srcdir); ./dropbear_lint.sh
+
## Fuzzing targets
# list of fuzz targets
diff --git a/dropbear_lint.sh b/dropbear_lint.sh
new file mode 100755
index 0000000..25a4b7d
--- /dev/null
+++ b/dropbear_lint.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+EXITCODE=0
+
+# #ifdef instead of #if
+grep '#ifdef DROPBEAR' -I *.c *.h && EXITCODE=1
+
+exit $EXITCODE
diff --git a/release.sh b/release.sh
index 525cef3..ea3aa1d 100755
--- a/release.sh
+++ b/release.sh
@@ -30,6 +30,7 @@ fi
hg archive "$RELDIR" || exit 2
(cd "$RELDIR" && autoconf && autoheader) || exit 2
+(cd "$RELDIR" && make lint) || exit 2
rm -r "$RELDIR/autom4te.cache" || exit 2