scripts/clean-includes: Do all our exclusions with REGEXFILE

We currently have two mechanisms for excluding files:
 * the REGEXFILE which excludes by regex
 * special cases in the "loop over each file" which make
   us skip the file

Roll all the "skip this" cases into REGEXFILE, so we use
a single mechanism for identifying which files to exclude.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260116124005.925382-5-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell
2026-01-16 12:40:03 +00:00
parent 8a4a5c68c4
commit 3398e2a23f

View File

@@ -104,6 +104,15 @@ grep -v '^#' >"$REGEXFILE" <<EOT
^ebpf/rss.bpf.skeleton.h
# These files just include some other .c file and have no content themselves
^linux-user/(mips64|x86_64)/(cpu_loop|signal).c
# These are autogenerated headers
^include/standard-headers/
# osdep.h itself and its friends are expected to include system headers
^include/qemu/osdep.h
^include/qemu/compiler.h
^include/glib-compat.h
^include/system/os-(posix|win32).h
# This is for use by plugins, which are standalone binaries
^include/qemu/qemu-plugin.h
EOT
# We assume there are no files in the tree with spaces in their name
@@ -137,21 +146,6 @@ for f in "$@"; do
*.c)
MODE=c
;;
*include/qemu/osdep.h | \
*include/qemu/compiler.h | \
*include/qemu/qemu-plugin.h | \
*include/glib-compat.h | \
*include/system/os-posix.h | \
*include/system/os-win32.h | \
*include/standard-headers/ )
# Removing include lines from osdep.h itself would be counterproductive.
echo "SKIPPING $f (special case header)"
continue
;;
*include/standard-headers/*)
echo "SKIPPING $f (autogenerated header)"
continue
;;
*.h)
MODE=h
;;