aboutsummaryrefslogtreecommitdiff
path: root/scripts/clean-includes
AgeCommit message (Collapse)AuthorFilesLines
2020-08-21meson: rename included C source files to .c.incPaolo Bonzini1-1/+1
With Makefiles that have automatically generated dependencies, you generated includes are set as dependencies of the Makefile, so that they are built before everything else and they are available when first building the .c files. Alternatively you can use a fine-grained dependency, e.g. target/arm/translate.o: target/arm/decode-neon-shared.inc.c With Meson you have only one choice and it is a third option, namely "build at the beginning of the corresponding target"; the way you express it is to list the includes in the sources of that target. The problem is that Meson decides if something is a source vs. a generated include by looking at the extension: '.c', '.cc', '.m', '.C' are sources, while everything else is considered an include---including '.inc.c'. Use '.c.inc' to avoid this, as it is consistent with our other convention of using '.rst.inc' for included reStructuredText files. The editorconfig file is adjusted. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-06-08scripts/clean-includes: Mark 'qemu/qemu-plugin.h' as special headerPhilippe Mathieu-Daudé1-0/+1
"qemu/qemu-plugin.h" isn't meant to be include by QEMU codebase, but by 3rd party plugins that QEMU can use. These plugins can be built out of QEMU and don't include "qemu/osdep.h". Mark "qemu/qemu-plugin.h" as a special header that doesn't need to be cleaned for "qemu/osdep.h". Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200524215654.13256-1-f4bug@amsat.org> Message-Id: <20200605154929.26910-3-alex.bennee@linaro.org>
2016-10-28scripts/clean-includes: added duplicate #include checkAnand J1-14/+42
Enhance the clean-includes script to optionally check for duplicate #include entries. Script might output false positive entries as well. Such entries should not be removed. So if it finds any duplicate entries script will terminate with an exit status 1. Then each and every file should be checked manually and corrected if necessary. In order to enable the check use --check-dup-head option with scripts/clean-includes. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Anand J <anand.indukala@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-06-16os-posix: include sys/mman.hPaolo Bonzini1-0/+3
qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous inclusion of sys/mman.h. Include it in sysemu/os-posix.h and remove it from everywhere else. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-06-07clean-includes: Add glib.h to list of unneeded includesPeter Maydell1-1/+2
osdep.h pulls in glib.h via glib-compat.h, so add it to the list of includes that we remove. (This then means we must avoid running clean-includes on glib-compat.h or it will delete the glib.h include.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-06-07scripts: Use $(..) instead of deprecated `..`Stefan Weil1-1/+1
This fixes these warnings from shellcheck: ^-- SC2006: Use $(..) instead of deprecated `..` Update also a comment using the same pattern. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-03-24Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell1-2/+3
* Log filtering from Alex and Peter * Chardev fix from Marc-André * config.status tweak from David * Header file tweaks from Markus, myself and Veronia (Outreachy candidate) * get_ticks_per_sec() removal from Rutuja (Outreachy candidate) * Coverity fix from myself * PKE implementation from myself, based on rth's XSAVE support # gpg: Signature made Thu 24 Mar 2016 20:15:11 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: (28 commits) target-i386: implement PKE for TCG config.status: Pass extra parameters char: translate from QIOChannel error to errno exec: fix error handling in file_ram_alloc cputlb: modernise the debug support qemu-log: support simple pid substitution for logs target-arm: dfilter support for in_asm qemu-log: dfilter-ise exec, out_asm, op and opt_op qemu-log: new option -dfilter to limit output qemu-log: Improve the "exec" TB execution logging qemu-log: Avoid function call for disabled qemu_log_mask logging qemu-log: correct help text for -d cpu tcg: pass down TranslationBlock to tcg_code_gen util: move declarations out of qemu-common.h Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND hw: explicitly include qemu-common.h and cpu.h include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h Move ParallelIOArg from qemu-common.h to sysemu/char.h Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Conflicts: scripts/clean-includes
2016-03-22include/qemu/osdep.h: Don't include qapi/error.hMarkus Armbruster1-2/+3
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the Error typedef. Since then, we've moved to include qemu/osdep.h everywhere. Its file comment explains: "To avoid getting into possible circular include dependencies, this file should not include any other QEMU headers, with the exceptions of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which are doing a similar job to this file and are under similar constraints." qapi/error.h doesn't do a similar job, and it doesn't adhere to similar constraints: it includes qapi-types.h. That's in excess of 100KiB of crap most .c files don't actually need. Add the typedef to qemu/typedefs.h, and include that instead of qapi/error.h. Include qapi/error.h in .c files that need it and don't get it now. Include qapi-types.h in qom/object.h for uint16List. Update scripts/clean-includes accordingly. Update it further to match reality: replace config.h by config-target.h, add sysemu/os-posix.h, sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h comment quoted above similarly. This reduces the number of objects depending on qapi/error.h from "all of them" to less than a third. Unfortunately, the number depending on qapi-types.h shrinks only a little. More work is needed for that one. Signed-off-by: Markus Armbruster <armbru@redhat.com> [Fix compilation without the spice devel packages. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22Remove unneeded include statements for setjmp.hStefan Weil1-1/+1
As soon as setjmp.h is included from qemu/osdep.h, those old include statements are no longer needed. Add also setjmp.h to the list in scripts/clean-includes. Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-03-16include/config.h: RemovePeter Maydell1-1/+0
include/config.h just includes config-target.h (and used to also include config-host.h). It is now obsolete and unused, because osdep.h does this job, so remove it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 1456237112-32662-3-git-send-email-peter.maydell@linaro.org
2016-02-23scripts/clean-includes: Ignore .inc.c filesPeter Maydell1-0/+5
Ignore files which have a .inc.c extension -- these are not headers but they are not standalone C source files either, so we can't make any automated decisions about what #include directives they should have. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <1456238983-10160-3-git-send-email-peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
2016-02-23scripts/clean-includes: Add --all optionPeter Maydell1-1/+15
Add a --all option which will run the script on every C source and header file in the repository (except for those in a few directories which contain standalone guest code). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-02-23scripts/clean-includes: Enhance to handle header filesPeter Maydell1-8/+45
Enhance clean-includes to handle header files as well as .c source files. For headers we merely remove all the redundant #include lines, including any includes of qemu/osdep.h itself. There is a simple mollyguard on the include file processing to skip a few key headers like osdep.h itself, to avoid producing bad patches if the script is run on every file in include/. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-01-18scripts: Add new clean-includes script to fix C include directivesPeter Maydell1-0/+109
Add a new scripts/clean-includes, which can be used to automatically ensure that a C source file includes qemu/osdep.h first and doesn't then include any headers which osdep.h provides already. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1449505425-32022-2-git-send-email-peter.maydell@linaro.org