Add a script to manually check files with stdint.h types

This commit is contained in:
apio 2022-11-20 18:54:39 +01:00
parent 2df0bc4238
commit f982152caa

42
tools/check-stdint.sh Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -e
source $(dirname $0)/env.sh
cd $LUNA_ROOT
SOURCES=($(find kernel/src -type f | grep -v "\.asm" | grep -v "bootboot.h"))
SOURCES+=($(find luna -type f | grep -v "CMakeLists.txt" | grep -v "Types.h" | grep -v "PlacementNew.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
fi