diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2020-08-21 12:42:49 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2020-08-21 12:42:49 +0100 |
| commit | 7fd51e68c34fcefdb4d6fd646ed3346f780f89f4 (patch) | |
| tree | b4c90dc51c2babb9850d29d0e3349891b2988172 /scripts/check_sparse.py | |
| parent | 1d806cef0e38b5db8347a8e12f214d543204a314 (diff) | |
| parent | a14f0bf1657adef0328a3a756637b93f53ec0220 (diff) | |
| download | focaccia-qemu-7fd51e68c34fcefdb4d6fd646ed3346f780f89f4.tar.gz focaccia-qemu-7fd51e68c34fcefdb4d6fd646ed3346f780f89f4.zip | |
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
New build system, with "fake in-tree builds" support. Missing: * converting configure tests * converting unit tests * converting some remaining parts of the installation # gpg: Signature made Fri 21 Aug 2020 11:33:35 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (152 commits) docs: convert build system documentation to rST meson: update build-system documentation meson: avoid unstable module warning with Meson 0.56.0 or newer meson: convert po/ meson: convert VNC and dependent libraries to meson meson: move SDL and SDL-image detection to meson meson: convert sample plugins meson: replace create-config with meson configure_file rules.mak: drop unneeded macros meson: convert check-block meson: build texi doc docs: automatically track manual dependencies meson: sphinx-build remove Makefile.target rules.mak: remove version.o meson: convert systemtap files configure: place compatibility symlinks in target directories meson: link emulators without Makefile.target meson: plugins meson: cpu-emu ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/check_sparse.py')
| -rw-r--r-- | scripts/check_sparse.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/check_sparse.py b/scripts/check_sparse.py new file mode 100644 index 0000000000..0de7aa55d9 --- /dev/null +++ b/scripts/check_sparse.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python3 + +# Invoke sparse based on the contents of compile_commands.json + +import json +import subprocess +import sys +import shlex + +def extract_cflags(shcmd): + cflags = shlex.split(shcmd) + return [x for x in cflags + if x.startswith('-D') or x.startswith('-I') or x.startswith('-W') + or x.startswith('-std=')] + +cflags = sys.argv[1:-1] +with open(sys.argv[-1], 'r') as fd: + compile_commands = json.load(fd) + +for cmd in compile_commands: + cmd = ['sparse'] + cflags + extract_cflags(cmd['command']) + [cmd['file']] + print(' '.join((shlex.quote(x) for x in cmd))) + r = subprocess.run(cmd) + if r.returncode != 0: + sys.exit(r.returncode) |