Skip to content

Commit 363cc09

Browse files
BenWiederhakeawesomekling
authored andcommitted
Meta: Fix debug-flag detection
Detection broke when we moved from '#ifdef DEBUG_FOO dbgln()' to 'dbgln<DEBUG_FOO>()'. This patch makes detection more general, which sadly runs into more false-positives. No rotten code was found, hooray! :^)
1 parent c2e5bc4 commit 363cc09

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Meta/CMake/all_the_debug_macros.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,15 @@ set(SYSCALL_1_DEBUG ON)
170170

171171
# False positive: DEBUG is a flag but it works differently.
172172
# set(DEBUG ON)
173+
# False positive: DT_DEBUG is a flag, but for a bitset, not a feature.
174+
# set(DT_DEBUG ON)
175+
# False positive: GUI_DND_DEBUG is a flag, but passed as an envvar.
176+
# set(GUI_DND_DEBUG ON)
177+
# False positive: GUI_FOCUS_DEBUG is a flag, but passed as an envvar.
178+
# set(GUI_FOCUS_DEBUG ON)
173179
# False positive: LOG_DEBUG is a flag, but for a bitset, not a feature.
174180
# set(LOG_DEBUG ON)
181+
# False positive: UHCI_USBCMD_SOFTWARE_DEBUG is a flag, but for a bitset, not a feature.
182+
# set(UHCI_USBCMD_SOFTWARE_DEBUG ON)
175183
# Clogs up build: The WrapperGenerator stuff is run at compile time.
176184
# set(WRAPPER_GENERATOR_DEBUG ON)

Meta/check-debug-flags.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ while IFS= read -r FLAG; do
1212
# There are (basically) no false positives, but there might be false negatives,
1313
# for example we intentionally don't check for commented-out lines here.
1414
if ! grep -qP "set\(${FLAG}" Meta/CMake/all_the_debug_macros.cmake ; then
15-
echo "ALL_THE_DEBUG_MACROS probably doesn't include ${FLAG}"
15+
echo "'all_the_debug_macros.cmake' is missing ${FLAG}"
1616
MISSING_FLAGS=y
1717
fi
1818
done < <(
@@ -22,16 +22,16 @@ done < <(
2222
'*.in' \
2323
':!:Kernel/FileSystem/ext2_fs.h' \
2424
':!:Userland/Libraries/LibELF/exec_elf.h' \
25-
| xargs grep -P '^ *#.*DEBUG' \
25+
| xargs grep -P '(_DEBUG|DEBUG_)' \
2626
| sed -re 's,^.*[^a-zA-Z0-9_]([a-zA-Z0-9_]*DEBUG[a-zA-Z0-9_]*).*$,\1,' \
2727
| sort \
2828
| uniq
2929
)
3030

3131
if [ "n" != "${MISSING_FLAGS}" ] ; then
32-
echo "Some flags are missing for the ALL_THE_DEBUG_MACROS feature in CMakeLists.txt."
32+
echo "Some flags are missing for the ALL_THE_DEBUG_MACROS feature."
3333
echo "If you just added a new SOMETHING_DEBUG flag, that's great!"
3434
echo "We want to enable all of these in automated builds, so that the code doesn't rot."
35-
echo "Please add it to the ALL_THE_DEBUG_MACROS section."
35+
echo "Please add it to Meta/CMake/all_the_debug_macros.cmake"
3636
exit 1
3737
fi

0 commit comments

Comments
 (0)