Lines Matching +full:- +full:eq
1 #!/bin/sh -e
14 # the top-level directory.
17 # clean-includes [--git subjectprefix] [--check-dup-head] file ...
19 # clean-includes [--git subjectprefix] [--check-dup-head] --all
21 # If the --git subjectprefix option is given, then after making
26 # If --check-dup-head is specified, additionally check for duplicate
29 # Using --all will cause clean-includes to run on the whole source
41 # The following one-liner may be handy for finding files to run this on.
45 # for i in $(git ls-tree --name-only HEAD) ; do test -f $i && \
46 # grep -E '^# *include' $i | head -1 | grep 'osdep.h' ; test $? != 0 && \
53 # Extended regular expression defining files to ignore when using --all
54 …tests/fp|tests/plugin|tests/uefi-test-tools|pc-bios|subprojects|contrib/plugins|tools/ebpf|ebpf/rs…
59 "--git")
60 if [ $# -eq 1 ]; then
61 echo "--git option requires an argument"
69 "--check-dup-head")
73 "--")
83 if [ $# -eq 0 ]; then
84 echo "Usage: clean-includes [--git subjectprefix] [--check-dup-head] [--all | foo.c ...]"
89 if [ "$1" = "--all" ]; then
91 set -- $(git ls-files '*.[ch]' | grep -E -v "$XDIRREGEX")
97 COCCIFILE="$(mktemp --suffix=.cocci)"
99 trap 'rm -f -- "$COCCIFILE"' INT TERM HUP EXIT
116 if [ -L "$f" ]; then
131 *include/qemu/qemu-plugin.h | \
132 *include/glib-compat.h | \
133 *include/system/os-posix.h | \
134 *include/system/os-win32.h | \
135 *include/standard-headers/ )
140 *include/standard-headers/*)
148 echo "WARNING: ignoring $f (cannot handle non-C files)"
158 spatch --in-place --no-show-diff --cocci-file "$COCCIFILE" "$f"
161 perl -n -i -e 'print if !/#include "qemu\/osdep.h"/ || !$n++;' "$f"
164 perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ ||
165 ! (grep { $_ eq $1 } qw ("qemu/osdep.h"))' "$f"
169 perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ ||
170 ! (grep { $_ eq $1 } qw (
171 "config-host.h" "config-target.h" "qemu/compiler.h"
177 "system/os-posix.h, system/os-win32.h "glib-compat.h"
183 if [ "$DUPHEAD" = "yes" ] && [ -n "$files" ]; then
184 if egrep "^[[:space:]]*#[[:space:]]*include" $files | tr -d '[:blank:]' \
185 | sort | uniq -c | grep -v '^ *1 '; then
192 git add -- $files
193 git commit --signoff -F - <<EOF
196 This commit was created with scripts/clean-includes.