Luna/tools/check-stdint.sh

45 lines
820 B
Bash
Executable File

#!/usr/bin/env bash
source $(dirname $0)/env.sh
cd $LUNA_ROOT
source tools/sources.sh
SOURCES=($(printf -- '%s\n' "${SOURCES[@]}" | grep -v libc | grep -v "Types.h" | grep -v "bootboot.h"))
SUCCESS=1
lint-file()
{
info="$(grep -Hnow $1 $3 | awk -v wrong="$1" -v right="$2" 'BEGIN { FS=":" }{ print $1 ":" $2 ": " wrong " -> " right }')"
if ! [ "$info" = "" ]
then
echo "$info"
SUCCESS=0
fi
}
for f in ${SOURCES[@]}
do
lint-file uint8_t u8 $f
lint-file uint16_t u16 $f
lint-file uint32_t u32 $f
lint-file uint64_t u64 $f
lint-file int8_t i8 $f
lint-file int16_t i16 $f
lint-file int32_t i32 $f
lint-file int64_t i64 $f
lint-file size_t usize $f
lint-file ssize_t isize $f
done
if [ "$SUCCESS" = "0" ]
then
exit 1
else
echo All files OK
fi