diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2023-02-08 10:40:06 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-02-08 10:40:06 +0000 |
commit | ae2b5d8381a73b27f35f19c988d45c78bb4d5768 (patch) | |
tree | 52fbaee4e3420dd719804d837983c0275b3369c8 /scripts | |
parent | 6b433719eabf0abc74cff0cfd5687f0137c4198a (diff) | |
parent | a67dfa660b0dd944c8fedfac02806de75b0c08b1 (diff) | |
download | qemu-ae2b5d8381a73b27f35f19c988d45c78bb4d5768.zip qemu-ae2b5d8381a73b27f35f19c988d45c78bb4d5768.tar.gz qemu-ae2b5d8381a73b27f35f19c988d45c78bb4d5768.tar.bz2 |
Merge tag 'pull-include-2023-02-06-v2' of https://repo.or.cz/qemu/armbru into staging
Header cleanup patches for 2023-02-06
# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmPjQRUSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTWHwQAI5D2HTRt3peFSPg/tFuYqSGtOobzM5x
# xdZxjWCtGV+dZ4TsyQ7yJkQ2i6aPjs0LzmTnTIsmf+p1OJSthvp4fQUzfXQauiJy
# OnNA76v7WjiXB8u8tcXtEkkHNmccp8n4KMjk33TfK/HQVx7lZ2EFurlCkvBr5wki
# FuDVad6R43ChmvBWdCUOi6G1IklAihm8AN4lBJu3iC7U8bjW4FmLLMitcu5OyKgt
# v9V4XFAe4eYUIPZ6uH5Lpr5m/qtrRXLe9KOdRUR2vDVL18Cf6Zl7mrUNtv7iV5TI
# hBOA12ZP5XXf81FXl7e8y3Xi2KXvb/el0wQ7SvtE7XB3Pdbfa5WSGKOc3VxYLmBA
# 4xUnEbzAogrrruovdk1bmh2LnVzCH66m72xaLCHBvjOU3M6V2B0eeaZ35FxNuFcB
# toHPAjeuzWkDAscVYcYKuPwnkNOMNqHxEdihrgy6mYLr6nauIYr7Lqgs3SqGqpct
# /HGy683+J+AqnHFTk1MTRftDxqk/Nku6ntAxLXndkpm3uDvu+iV5d3BfK3A9t7d1
# A2Y983DU6SiVwpMIv2eDL8sXYxuwIs56ZmPYIcSbqzpCXtdFqwWOTeFET/4vD+8t
# V3YKJ27jmWQ9bxbLHGPPYSKheuCVBIGsqxouE/Pbj5nXRKm/TeGp+20a4dWdE08r
# 2WTLAQbVQGD4
# =5TPW
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 08 Feb 2023 06:28:37 GMT
# gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg: issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* tag 'pull-include-2023-02-06-v2' of https://repo.or.cz/qemu/armbru:
Drop duplicate #include
Don't include headers already included by qemu/osdep.h
Fix non-first inclusions of qemu/osdep.h
accel: Clean up includes
block: Clean up includes
riscv: Clean up includes
target/hexagon: Clean up includes
net: Clean up includes
migration: Clean up includes
qga: Clean up includes
hw/tricore: Clean up includes
hw/input: Clean up includes
hw/cxl: Clean up includes
crypto: Clean up includes
bsd-user: Clean up includes
scripts/clean-includes: Improve --git commit message
scripts/clean-includes: Skip symbolic links
scripts/clean-includes: Don't claim duplicate headers found when not
scripts/clean-includes: Fully skip / ignore files
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/clean-includes | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/scripts/clean-includes b/scripts/clean-includes index d37bd4f..58e1607 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -111,7 +111,12 @@ cat >"$COCCIFILE" <<EOT ) EOT +files= for f in "$@"; do + if [ -L "$f" ]; then + echo "SKIPPING $f (symbolic link)" + continue + fi case "$f" in *.c.inc) # These aren't standalone C source files @@ -144,6 +149,7 @@ for f in "$@"; do continue ;; esac + files="$files $f" if [ "$MODE" = "c" ]; then # First, use Coccinelle to add qemu/osdep.h before the first existing include @@ -174,25 +180,30 @@ for f in "$@"; do done -if [ "$DUPHEAD" = "yes" ]; then - egrep "^[[:space:]]*#[[:space:]]*include" "$@" | tr -d '[:blank:]' \ - | sort | uniq -c | awk '{if ($1 > 1) print $0}' - if [ $? -eq 0 ]; then +if [ "$DUPHEAD" = "yes" ] && [ -n "$files" ]; then + if egrep "^[[:space:]]*#[[:space:]]*include" $files | tr -d '[:blank:]' \ + | sort | uniq -c | grep -v '^ *1 '; then echo "Found duplicate header file includes. Please check the above files manually." exit 1 fi fi if [ "$GIT" = "yes" ]; then - git add -- "$@" + git add -- $files git commit --signoff -F - <<EOF $GITSUBJ: Clean up includes -Clean up includes so that osdep.h is included first and headers -which it implies are not included manually. - This commit was created with scripts/clean-includes. +All .c should include qemu/osdep.h first. The script performs three +related cleanups: + +* Ensure .c files include qemu/osdep.h first. +* Including it in a .h is redundant, since the .c already includes + it. Drop such inclusions. +* Likewise, including headers qemu/osdep.h includes is redundant. + Drop these, too. + EOF fi |