ladybird/Meta/check-debug-flags.sh
Linus Groh 6ca03b915e Kernel: Support all Intel-defined CPUID feature flags for EAX=1
We're now able to detect all the regular CPUID feature flags from
ECX/EDX for EAX=1 :^)

None of the new ones are being used for anything yet, but they will show
up in /proc/cpuinfo and subsequently lscpu and SystemMonitor.

Note that I replaced the periods from the SSE 4.1 and 4.2 instructions
with underscores, which matches the internal enum names, Linux's
/proc/cpuinfo and the general pattern of replacing special characters
with underscores to limit feature names to [a-z0-9_].

The enum member stringification has been moved to a new function for
better re-usability and to avoid cluttering up Processor.cpp.
2022-03-27 18:54:56 +02:00

42 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "${script_path}/.."
MISSING_FLAGS=n
while IFS= read -r FLAG; do
# Ignore false positives that are not debug flags.
if [ "$FLAG" = "ELF_DEBUG" ] || [ "$FLAG" = "IA32_DEBUG_INTERFACE" ]; then
continue
fi
# We simply search whether the CMakeLists.txt *ever* sets the flag.
# There are (basically) no false positives, but there might be false negatives,
# for example we intentionally don't check for commented-out lines here.
if ! grep -qF "set(${FLAG}" Meta/CMake/all_the_debug_macros.cmake ; then
echo "'all_the_debug_macros.cmake' is missing ${FLAG}"
MISSING_FLAGS=y
fi
done < <(
git ls-files -- \
'*.cpp' \
'*.h' \
'*.in' \
':!:Kernel/FileSystem/ext2_fs.h' \
| xargs grep -E '(_DEBUG|DEBUG_)' \
| sed -re 's,^.*[^a-zA-Z0-9_]([a-zA-Z0-9_]*DEBUG[a-zA-Z0-9_]*).*$,\1,' \
| sort \
| uniq
)
if [ "n" != "${MISSING_FLAGS}" ] ; then
echo "Some flags are missing for the ALL_THE_DEBUG_MACROS feature."
echo "If you just added a new SOMETHING_DEBUG flag, that's great!"
echo "We want to enable all of these in automated builds, so that the code doesn't rot."
echo "Please add it to Meta/CMake/all_the_debug_macros.cmake"
exit 1
fi