diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2020-11-28 18:16:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-01 11:06:53 +0100 |
commit | e85aad6acc07bdf9f1dfcc72bee8b4cb2c80b1ee (patch) | |
tree | 0c793505ae017660dc09648284a78e70554863d5 /Meta | |
parent | e1baf9ec92033e6c4a6f00db965021db6db7183d (diff) | |
download | serenity-e85aad6acc07bdf9f1dfcc72bee8b4cb2c80b1ee.zip |
Meta: Always check completeness of ALL_THE_DEBUG_MACROS
Diffstat (limited to 'Meta')
-rwxr-xr-x | Meta/check-debug-flags.sh | 36 | ||||
-rwxr-xr-x | Meta/lint-ci.sh | 1 |
2 files changed, 37 insertions, 0 deletions
diff --git a/Meta/check-debug-flags.sh b/Meta/check-debug-flags.sh new file mode 100755 index 0000000000..af384e592b --- /dev/null +++ b/Meta/check-debug-flags.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -eo pipefail + +script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +cd "${script_path}/.." + +MISSING_FLAGS=n + +while IFS= read -r FLAG; do + # 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 -qP "set\(CMAKE_CXX_FLAGS \".* -D${FLAG}" CMakeLists.txt ; then + echo "ALL_THE_DEBUG_MACROS probably doesn't include ${FLAG}" + MISSING_FLAGS=y + fi +done < <( + git ls-files -- \ + '*.cpp' \ + '*.h' \ + ':!:Kernel/FileSystem/ext2_fs.h' \ + ':!:Libraries/LibELF/exec_elf.h' \ + | xargs grep -P '^ *#.*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 in CMakeLists.txt." + 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 the ALL_THE_DEBUG_MACROS section." + exit 1 +fi diff --git a/Meta/lint-ci.sh b/Meta/lint-ci.sh index b5b3887515..8b2cb76756 100755 --- a/Meta/lint-ci.sh +++ b/Meta/lint-ci.sh @@ -6,6 +6,7 @@ script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) cd "${script_path}/.." || exit 1 for cmd in \ + Meta/check-debug-flags.sh \ Meta/check-style.sh \ Meta/lint-executable-resources.sh \ Meta/lint-ipc-ids.sh \ |