mirror of https://gerrit.osmocom.org/osmo-ci
scripts: add a script for checking presence of <endian.h>
Change-Id: I6a1e7fc2e96f42fc596f47b4d7f1ac6c61d834b6
This commit is contained in:
parent
3dad8b5e7f
commit
f6974d89c8
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Usage: ./verify_endian_header.sh $(find . -name "*.[hc]")
|
||||||
|
|
||||||
|
HEADER="osmocom/core/endian.h"
|
||||||
|
COUNT=0
|
||||||
|
|
||||||
|
for f in $*; do
|
||||||
|
# Obviously, ignore the header file defining the macros
|
||||||
|
if [ $(basename $f) = $(basename $HEADER) ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Match files using either of OSMO_IS_{LITTLE,BIG}_ENDIAN
|
||||||
|
if grep -q "OSMO_IS_\(LITTLE\|BIG\)_ENDIAN" $f; then
|
||||||
|
# The header file must be included
|
||||||
|
if ! grep -q "#include <$HEADER>" $f; then
|
||||||
|
echo "File '$f' does not #include <$HEADER>"
|
||||||
|
COUNT=$((COUNT + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $COUNT
|
Loading…
Reference in New Issue