diff --git a/tools/check-stdint.sh b/tools/check-stdint.sh new file mode 100755 index 00000000..66dc1f1f --- /dev/null +++ b/tools/check-stdint.sh @@ -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 \ No newline at end of file