Add linter for #ifdef

This commit is contained in:
Matt Johnston 2020-05-24 13:15:24 +08:00
parent 331d4a714f
commit 545cc62671
3 changed files with 13 additions and 1 deletions

View File

@ -236,7 +236,7 @@ $(STATIC_LTC): $(OPTION_HEADERS)
$(STATIC_LTM): $(OPTION_HEADERS) $(STATIC_LTM): $(OPTION_HEADERS)
$(MAKE) -C libtommath $(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: ltc-clean:
$(MAKE) -C libtomcrypt clean $(MAKE) -C libtomcrypt clean
@ -262,6 +262,9 @@ distclean: clean tidy
tidy: tidy:
-rm -f *~ *.gcov */*~ -rm -f *~ *.gcov */*~
lint:
cd $(srcdir); ./dropbear_lint.sh
## Fuzzing targets ## Fuzzing targets
# list of fuzz targets # list of fuzz targets

8
dropbear_lint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
EXITCODE=0
# #ifdef instead of #if
grep '#ifdef DROPBEAR' -I *.c *.h && EXITCODE=1
exit $EXITCODE

View File

@ -30,6 +30,7 @@ fi
hg archive "$RELDIR" || exit 2 hg archive "$RELDIR" || exit 2
(cd "$RELDIR" && autoconf && autoheader) || exit 2 (cd "$RELDIR" && autoconf && autoheader) || exit 2
(cd "$RELDIR" && make lint) || exit 2
rm -r "$RELDIR/autom4te.cache" || exit 2 rm -r "$RELDIR/autom4te.cache" || exit 2