More #include cleanups
Subsystems (3)
cover More #include cleanups
This set of patches does a bunch more cleaning of includes. Specifically it does everything necessary to be able to remove osdep.h includes from header files including qemu-common.h
Most of these patches are small, except for the one which deals with tests/ (that one has already been reviewed). There are several patches which fix code generators to generate correct #includes, and some which do manual changes to C++ or other files that Coccinelle barfs on.
The "all:" patch is running clean-includes on the whole tree to pick up some new files which have been added recently (mostly via target-arm).
I've thrown in a couple of patches that have already appeared on list, just to get the whole set into one series.
I have some pending patches which:
* enhance clean-includes to handle header files
* clean up header files
* add a --all option to clean-includes to do a "run clean on whole tree"
but I'd like to get the "add missing includes to .c files" parts into master before moving onto "remove includes from .h files" part...
thanks
-- PMM
Eric Blake (1):
qapi: Clean up includes in generated files
Peter Maydell (13):
cpu: Clean up includes
ui/cocoa.m: Include qemu/osdep.h
disas/arm-a64.cc: Include osdep.h first
hw/block/nand.c: Include osdep.h first
target-cris: Remove unnecessary ifdef from mmu.c
cris: Clean up includes
libdecnumber: Clean up includes
tests/i440fx-test: Don't define ARRAY_SIZE locally
tests: Clean up includes
scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h scripts/tracetool: Include qemu/osdep.h in generated .c files
all: Clean up includes
oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h
disas/arm-a64.cc | 5 +++-- hw/arm/bcm2835_peripherals.c | 1 + hw/arm/bcm2836.c | 1 + hw/arm/raspi.c | 1 + hw/block/nand.c | 5 +++-- hw/intc/bcm2835_ic.c | 1 + hw/intc/bcm2836_control.c | 1 + hw/misc/bcm2835_mbox.c | 1 + hw/misc/bcm2835_property.c | 1 + include/qemu/osdep.h | 11 +++++++++++ libdecnumber/decContext.c | 3 +-- libdecnumber/decNumber.c | 5 +---- libdecnumber/dpd/decimal128.c | 3 +-- libdecnumber/dpd/decimal32.c | 3 +-- libdecnumber/dpd/decimal64.c | 3 +-- qom/cpu.c | 1 + scripts/feature_to_c.sh | 2 +- scripts/qapi-commands.py | 1 + scripts/qapi-event.py | 1 + scripts/qapi-introspect.py | 3 ++- scripts/qapi-types.py | 3 +-- scripts/qapi-visit.py | 1 + scripts/tracetool/backend/simple.py | 3 ++- scripts/tracetool/format/events_c.py | 1 + scripts/tracetool/format/tcg_helper_c.py | 1 + stubs/blockdev-close-all-bdrv-states.c | 1 + target-cris/mmu.c | 4 +--- target-i386/cpu.c | 5 +---- tests/ac97-test.c | 3 +-- tests/bios-tables-test.c | 4 +--- tests/boot-order-test.c | 2 +- tests/check-qdict.c | 1 + tests/check-qfloat.c | 1 + tests/check-qint.c | 1 + tests/check-qjson.c | 1 + tests/check-qlist.c | 1 + tests/check-qom-interface.c | 1 + tests/check-qom-proplist.c | 1 + tests/check-qstring.c | 1 + tests/crypto-tls-x509-helpers.c | 4 +--- tests/device-introspect-test.c | 2 +- tests/display-vga-test.c | 3 +-- tests/drive_del-test.c | 2 +- tests/ds1338-test.c | 1 + tests/e1000-test.c | 3 +-- tests/eepro100-test.c | 3 +-- tests/endianness-test.c | 5 +---- tests/es1370-test.c | 3 +-- tests/fdc-test.c | 4 +--- tests/fw_cfg-test.c | 2 +- tests/hd-geo-test.c | 4 +--- tests/i440fx-test.c | 8 +------- tests/i82801b11-test.c | 3 +-- tests/intel-hda-test.c | 3 +-- tests/io-channel-helpers.c | 1 + tests/ioh3420-test.c | 3 +-- tests/ipmi-bt-test.c | 5 +---- tests/ipmi-kcs-test.c | 4 +--- tests/ipoctal232-test.c | 3 +-- tests/ivshmem-test.c | 6 +----- tests/libqos/fw_cfg.c | 1 + tests/libqos/i2c-imx.c | 3 +-- tests/libqos/i2c-omap.c | 3 +-- tests/libqos/i2c.c | 1 + tests/libqos/libqos-pc.c | 1 + tests/libqos/libqos.c | 6 +----- tests/libqos/malloc-generic.c | 1 + tests/libqos/malloc-pc.c | 1 + tests/libqos/malloc.c | 3 +-- tests/libqos/pci-pc.c | 1 + tests/libqos/pci.c | 1 + tests/libqos/usb.c | 3 +-- tests/libqos/virtio-mmio.c | 2 +- tests/libqos/virtio-pci.c | 2 +- tests/libqos/virtio.c | 1 + tests/libqtest.c | 12 ++---------- tests/m48t59-test.c | 5 +---- tests/ne2000-test.c | 3 +-- tests/nvme-test.c | 3 +-- tests/pc-cpu-test.c | 3 +-- tests/pcnet-test.c | 3 +-- tests/pkix_asn1_tab.c | 1 + tests/pvpanic-test.c | 3 +-- tests/q35-test.c | 3 +-- tests/qemu-iotests/socket_scm_helper.c | 8 +------- tests/qom-test.c | 3 +-- tests/rcutorture.c | 5 +---- tests/rtc-test.c | 5 +---- tests/rtl8139-test.c | 3 +-- tests/spapr-phb-test.c | 1 + tests/tco-test.c | 4 +--- tests/test-aio.c | 1 + tests/test-base64.c | 1 + tests/test-bitops.c | 3 +-- tests/test-blockjob-txn.c | 2 +- tests/test-coroutine.c | 1 + tests/test-crypto-cipher.c | 1 + tests/test-crypto-hash.c | 1 + tests/test-crypto-secret.c | 1 + tests/test-crypto-tlscredsx509.c | 4 +--- tests/test-crypto-tlssession.c | 4 +--- tests/test-cutils.c | 3 +-- tests/test-hbitmap.c | 4 +--- tests/test-int128.c | 3 +-- tests/test-io-channel-buffer.c | 1 + tests/test-io-channel-command.c | 1 + tests/test-io-channel-file.c | 1 + tests/test-io-channel-socket.c | 1 + tests/test-io-channel-tls.c | 4 +--- tests/test-io-task.c | 1 + tests/test-iov.c | 1 + tests/test-mul64.c | 3 +-- tests/test-netfilter.c | 1 + tests/test-opts-visitor.c | 1 + tests/test-qdev-global-props.c | 2 +- tests/test-qemu-opts.c | 3 +-- tests/test-qga.c | 9 +-------- tests/test-qmp-commands.c | 1 + tests/test-qmp-event.c | 2 +- tests/test-qmp-input-strict.c | 2 +- tests/test-qmp-input-visitor.c | 2 +- tests/test-qmp-output-visitor.c | 1 + tests/test-rcu-list.c | 6 +----- tests/test-rfifolock.c | 1 + tests/test-string-input-visitor.c | 2 +- tests/test-string-output-visitor.c | 1 + tests/test-thread-pool.c | 1 + tests/test-throttle.c | 1 + tests/test-timed-average.c | 2 +- tests/test-visitor-serialization.c | 3 +-- tests/test-vmstate.c | 1 + tests/test-write-threshold.c | 2 +- tests/test-x86-cpuid.c | 1 + tests/test-xbzrle.c | 6 +----- tests/tmp105-test.c | 1 + tests/tpci200-test.c | 3 +-- tests/vhost-user-bridge.c | 12 +----------- tests/vhost-user-test.c | 1 + tests/virtio-balloon-test.c | 3 +-- tests/virtio-blk-test.c | 5 +---- tests/virtio-console-test.c | 3 +-- tests/virtio-net-test.c | 3 +-- tests/virtio-rng-test.c | 3 +-- tests/virtio-scsi-test.c | 4 +--- tests/virtio-serial-test.c | 3 +-- tests/vmxnet3-test.c | 3 +-- tests/wdt_ib700-test.c | 3 +-- ui/cocoa.m | 2 ++ util/oslib-posix.c | 9 --------- 149 files changed, 166 insertions(+), 241 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/14 cpu: 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.
--- qom/cpu.c | 1 + target-i386/cpu.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-)
qom/cpu.c +1 -0
@@ -18,6 +18,7 @@* <http://www.gnu.org/licenses/gpl-2.0.html> */ +#include "qemu/osdep.h" #include "qemu-common.h" #include "qom/cpu.h" #include "sysemu/kvm.h"
target-i386/cpu.c +1 -4
@@ -16,10 +16,7 @@* You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <inttypes.h> +#include "qemu/osdep.h" #include "cpu.h" #include "sysemu/kvm.h"
Signature · 1 line
1.9.1
Andreas Färber
AppliedRe: [Qemu-devel] [PATCH 01/14] cpu: Clean up includes
Am 09.02.2016 um 16:24 schrieb Peter Maydell:
Quoted 10 lines
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes.Signed-off-by Peter Maydell <[email protected]>--- qom/cpu.c | 1 + target-i386/cpu.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-)
Applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu
Thanks,
Andreas
Signature · 2 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)
PATCH 2/14 ui/cocoa.m: Include qemu/osdep.h
In reply to Peter MaydellInclude "qemu/osdep.h". (This is a manual commit equivalent to what the clean-includes script would do, because that script can't handle ObjectiveC source files.)
--- ui/cocoa.m | 2 ++ 1 file changed, 2 insertions(+)
ui/cocoa.m +2 -0
@@ -22,6 +22,8 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" + #import <Cocoa/Cocoa.h> #include <crt_externs.h>
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 02/14] ui/cocoa.m: Include qemu/osdep.h
Quoted 8 lines · Peter Maydell
Include "
qemu/osdep.h". (This is a manual commit equivalent to what the clean-includes script would do, because that script can't handle ObjectiveC source files.)Signed-off-by Peter Maydell <[email protected]>--- ui/cocoa.m | 2 ++ 1 file changed, 2 insertions(+)
This one already landed as e4a096b.
Quoted 15 lines
ui/cocoa.m +2
-0@@ -22,6 +22,8 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" + #import <Cocoa/Cocoa.h> #include <crt_externs.h>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 02/14] ui/cocoa.m: Include qemu/osdep.h
Quoted 11 lines · Eric Blake
Quoted 8 lines · Peter Maydell
Include "
qemu/osdep.h". (This is a manual commit equivalent to what the clean-includes script would do, because that script can't handle ObjectiveC source files.)Signed-off-by Peter Maydell <[email protected]>--- ui/cocoa.m | 2 ++ 1 file changed, 2 insertions(+)This one already landed as e4a096b.
Heh, so it did, forgot to rebase. No harm done...
-- PMM
PATCH 3/14 disas/arm-a64.cc: Include osdep.h first
In reply to Peter MaydellRearrange include directives so that we include osdep.h first. This has to be done manually because clean-includes doesn't handle C++.
--- disas/arm-a64.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
disas/arm-a64.cc +3 -2
@@ -17,12 +17,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "vixl/a64/disasm-a64.h" - extern "C" { +#include "qemu/osdep.h" #include "disas/bfd.h" } +#include "vixl/a64/disasm-a64.h" + using namespace vixl; static Decoder *vixl_decoder = NULL;
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first
Quoted 19 lines · Peter Maydell
Rearrange include directives so that we include
osdep.hfirst. This has to be done manually because clean-includes doesn't handle C++.Signed-off-by Peter Maydell <[email protected]>--- disas/arm-a64.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)disas/arm-a64.cc +0
-2@@ -17,12 +17,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "vixl/a64/disasm-a64.h" -
disas/arm-a64.cc line 29
Quoted 10 lines
disas/arm-a64.cc +3
-0extern "C" { +#include "qemu/osdep.h" #include "disas/bfd.h" } +#include "vixl/a64/disasm-a64.h" + using namespace vixl; static Decoder *vixl_decoder = NULL;
So this patch doesn't build on the old mingw32 compiler. I think this is because this compiler is not C++11, and so its <stdint.h> doesn't provide various macros for C++ unless __STDC_CONSTANT_MACROS, __STDC_LIMIT_MACROS and __STDC_FORMAT_MACROS are defined before the first inclusion of <stdint.h>.
libvixl's globals.h defines these constants, but this only works if globals.h is first-include, so making osdep.h first-include then results in stdint.h being included before globals.h has a chance to set the defines.
What's the best way to deal with this? I can see a couple of options:
(1) as a special case, for this file include disasm-a64.h before osdep.h
(2) as a special case, for this file manually define the __STDC_* before including osdep.h
(3) make osdep.h itself define the __STDC_* constants so it works with C++-before-C++11 as well as with C and with C++11
I think I prefer (3) (though it does mean we will have to tweak osdep.h in future if a new vixl version should ever require any further similar #defines.)
thanks
-- PMM
Re: [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first
Quoted 42 lines · Peter Maydell
Quoted 19 lines · Peter Maydell
Rearrange include directives so that we include
osdep.hfirst. This has to be done manually because clean-includes doesn't handle C++.Signed-off-by Peter Maydell <[email protected]>--- disas/arm-a64.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)disas/arm-a64.cc +0
-2@@ -17,12 +17,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "vixl/a64/disasm-a64.h" -disas/arm-a64.cc line 29
Quoted 10 lines
disas/arm-a64.cc +3
-0extern "C" { +#include "qemu/osdep.h" #include "disas/bfd.h" } +#include "vixl/a64/disasm-a64.h" + using namespace vixl; static Decoder *vixl_decoder = NULL;So this patch doesn't build on the old mingw32 compiler. I think this is because this compiler is not C++11, and so its <
stdint.h> doesn't provide various macros for C++ unless__STDC_CONSTANT_MACROS,__STDC_LIMIT_MACROSand__STDC_FORMAT_MACROSare defined before the first inclusion of <stdint.h>.libvixl's
globals.hdefines these constants, but this only works ifglobals.his first-include, so makingosdep.hfirst-include then results instdint.hbeing included beforeglobals.hhas a chance to set the defines.
Quoted 8 lines
What's the best way to deal with this? I can see a couple of options:
(1) as a special case, for this file include
disasm-a64.hbeforeosdep.h
(2) as a special case, for this file manually define the __STDC_* before includingosdep.h
(3) makeosdep.hitself define the __STDC_* constants so it works with C++-before-C++11 as well as with C and with C++11
(4) Tell old mingw32 to take a hike :)
Quoted 3 lines
I think I prefer (3) (though it does mean we will have to tweak
osdep.hin future if a new vixl version should ever require any further similar #defines.)
Doesn't sound like a deal-breaker to me.
Re: [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first
Quoted 11 lines · Markus Armbruster
Quoted 8 lines · Peter Maydell
What's the best way to deal with this? I can see a couple of options:
(1) as a special case, for this file include
disasm-a64.hbeforeosdep.h
(2) as a special case, for this file manually define the __STDC_* before includingosdep.h
(3) makeosdep.hitself define the __STDC_* constants so it works with C++-before-C++11 as well as with C and with C++11(4) Tell old mingw32 to take a hike :)
I suspect it is not the only pre-C++11 compiler people in the wild will be using, though...
thanks
-- PMM
Re: [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first
In reply to Peter MaydellQuoted 25 lines · Peter Maydell
Quoted 7 lines · Peter Maydell
Rearrange include directives so that we include
osdep.hfirst. This has to be done manually because clean-includes doesn't handle C++.disas/arm-a64.cc +0
-2-#include "vixl/a64/disasm-a64.h" -disas/arm-a64.cc line 29
Quoted 10 lines
disas/arm-a64.cc +3
-0extern "C" { +#include "qemu/osdep.h" #include "disas/bfd.h" } +#include "vixl/a64/disasm-a64.h" + using namespace vixl; static Decoder *vixl_decoder = NULL;So this patch doesn't build on the old mingw32 compiler. I think this is because this compiler is not C++11, and so its <
stdint.h> doesn't provide various macros for C++ unless__STDC_CONSTANT_MACROS,__STDC_LIMIT_MACROSand__STDC_FORMAT_MACROSare defined before the first inclusion of <stdint.h>.
Quoted 6 lines
(3) make
osdep.hitself define the __STDC_* constants so it works with C++-before-C++11 as well as with C and with C++11I think I prefer (3) (though it does mean we will have to tweak
osdep.hin future if a new vixl version should ever require any further similar #defines.)
(3) has my vote as well; it's the approach used by gnulib (wherever practical, do whatever wrapping it takes to make all standard headers appear like the most modern version of said header, even on older platforms)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 4/14 hw/block/nand.c: Include osdep.h first
In reply to Peter MaydellInclude osdep.h as the first header in nand.c; this has to be done manually because coccinelle gets confused by the way that this C file includes itself.
We fix some odd spacing in #includes while we are in the area.
--- hw/block/nand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/block/nand.c +3 -2
@@ -18,8 +18,9 @@#ifndef NAND_IO -# include "hw/hw.h" -# include "hw/block/flash.h" +#include "qemu/osdep.h" +#include "hw/hw.h" +#include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "hw/qdev.h" #include "qemu/error-report.h"
Signature · 1 line
1.9.1
PATCH 5/14 target-cris: Remove unnecessary ifdef from mmu.c
In reply to Peter Maydellmmu.c is only built for CONFIG_SOFTMMU targets, so there is no need to redundantly surround the whole file contents with an #ifndef CONFIG_USER_ONLY. The ifdef also confuses the Coccinelle tool.
--- target-cris/mmu.c | 3 --- 1 file changed, 3 deletions(-)
target-cris/mmu.c +0 -3
@@ -18,8 +18,6 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_USER_ONLY -#include "cpu.h" #include "mmu.h"
@@ -360,4 +358,3 @@ int cris_mmu_translate(struct cris_mmu_result *res, env->pregs[PR_SRS ] = old_srs;return miss; } -#endif
Signature · 1 line
1.9.1
PATCH 6/14 cris: Clean up includes
In reply to Peter MaydellClean 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.
--- target-cris/mmu.c | 1 + 1 file changed, 1 insertion(+)
target-cris/mmu.c +1 -0
@@ -18,6 +18,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "cpu.h" #include "mmu.h"
Signature · 1 line
1.9.1
PATCH 7/14 libdecnumber: Clean up includes
In reply to Peter MaydellClean 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.
--- libdecnumber/decContext.c | 3 +-- libdecnumber/decNumber.c | 5 +---- libdecnumber/dpd/decimal128.c | 3 +-- libdecnumber/dpd/decimal32.c | 3 +-- libdecnumber/dpd/decimal64.c | 3 +-- 5 files changed, 5 insertions(+), 12 deletions(-)
libdecnumber/decContext.c +1 -2
@@ -35,8 +35,7 @@/* context structures. */ /* ------------------------------------------------------------------ */ -#include <string.h> /* for strcmp */ -#include <stdio.h> /* for printf if DECCHECK */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #include "libdecnumber/decContext.h" #include "libdecnumber/decNumberLocal.h"
libdecnumber/decNumber.c +1 -4
@@ -166,10 +166,7 @@/* ** -- raise to the power */ /* ------------------------------------------------------------------ */ -#include <stdlib.h> /* for malloc, free, etc. */ -#include <stdio.h> /* for printf [if needed] */ -#include <string.h> /* for strcpy */ -#include <ctype.h> /* for lower */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #include "libdecnumber/decNumber.h" #include "libdecnumber/decNumberLocal.h"
libdecnumber/dpd/decimal128.c +1 -2
@@ -39,8 +39,7 @@/* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ -#include <string.h> /* [for memset/memcpy] */ -#include <stdio.h> /* [for printf] */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #define DECNUMDIGITS 34/* make decNumbers with space for 34 */
libdecnumber/dpd/decimal32.c +1 -2
@@ -39,8 +39,7 @@/* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ -#include <string.h> /* [for memset/memcpy] */ -#include <stdio.h> /* [for printf] */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #define DECNUMDIGITS 7/* make decNumbers with space for 7 */
libdecnumber/dpd/decimal64.c +1 -2
@@ -39,8 +39,7 @@/* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ -#include <string.h> /* [for memset/memcpy] */ -#include <stdio.h> /* [for printf] */ +#include "qemu/osdep.h" #include "libdecnumber/dconfig.h" #define DECNUMDIGITS 16/* make decNumbers with space for 16 */
Signature · 1 line
1.9.1
PATCH 8/14 tests/i440fx-test: Don't define ARRAY_SIZE locally
In reply to Peter MaydellDon't define ARRAY_SIZE locally; instead include osdep.h for it.
--- tests/i440fx-test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tests/i440fx-test.c +1 -2
@@ -12,6 +12,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include <string.h> #include <stdio.h>
@@ -27,8 +28,6 @@#define BROKEN 1 -#define ARRAY_SIZE (array) (sizeof(array) / sizeof((array)[0])) - typedef struct TestData { int num_cpus;
Signature · 1 line
1.9.1
PATCH 9/14 tests: Clean up includes
In reply to Peter MaydellClean 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.
---
This deals with every .c file in tests/ except those in tests/tcg and tests/multiboot which I think are all standalone programs targeting the guest.
--- tests/ac97-test.c | 3 +-- tests/bios-tables-test.c | 4 +--- tests/boot-order-test.c | 2 +- tests/check-qdict.c | 1 + tests/check-qfloat.c | 1 + tests/check-qint.c | 1 + tests/check-qjson.c | 1 + tests/check-qlist.c | 1 + tests/check-qom-interface.c | 1 + tests/check-qom-proplist.c | 1 + tests/check-qstring.c | 1 + tests/crypto-tls-x509-helpers.c | 4 +--- tests/device-introspect-test.c | 2 +- tests/display-vga-test.c | 3 +-- tests/drive_del-test.c | 2 +- tests/ds1338-test.c | 1 + tests/e1000-test.c | 3 +-- tests/eepro100-test.c | 3 +-- tests/endianness-test.c | 5 +---- tests/es1370-test.c | 3 +-- tests/fdc-test.c | 4 +--- tests/fw_cfg-test.c | 2 +- tests/hd-geo-test.c | 4 +--- tests/i440fx-test.c | 5 ----- tests/i82801b11-test.c | 3 +-- tests/intel-hda-test.c | 3 +-- tests/io-channel-helpers.c | 1 + tests/ioh3420-test.c | 3 +-- tests/ipmi-bt-test.c | 5 +---- tests/ipmi-kcs-test.c | 4 +--- tests/ipoctal232-test.c | 3 +-- tests/ivshmem-test.c | 6 +----- tests/libqos/fw_cfg.c | 1 + tests/libqos/i2c-imx.c | 3 +-- tests/libqos/i2c-omap.c | 3 +-- tests/libqos/i2c.c | 1 + tests/libqos/libqos-pc.c | 1 + tests/libqos/libqos.c | 6 +----- tests/libqos/malloc-generic.c | 1 + tests/libqos/malloc-pc.c | 1 + tests/libqos/malloc.c | 3 +-- tests/libqos/pci-pc.c | 1 + tests/libqos/pci.c | 1 + tests/libqos/usb.c | 3 +-- tests/libqos/virtio-mmio.c | 2 +- tests/libqos/virtio-pci.c | 2 +- tests/libqos/virtio.c | 1 + tests/libqtest.c | 12 ++---------- tests/m48t59-test.c | 5 +---- tests/ne2000-test.c | 3 +-- tests/nvme-test.c | 3 +-- tests/pc-cpu-test.c | 3 +-- tests/pcnet-test.c | 3 +-- tests/pkix_asn1_tab.c | 1 + tests/pvpanic-test.c | 3 +-- tests/q35-test.c | 3 +-- tests/qemu-iotests/socket_scm_helper.c | 8 +------- tests/qom-test.c | 3 +-- tests/rcutorture.c | 5 +---- tests/rtc-test.c | 5 +---- tests/rtl8139-test.c | 3 +-- tests/spapr-phb-test.c | 1 + tests/tco-test.c | 4 +--- tests/test-aio.c | 1 + tests/test-base64.c | 1 + tests/test-bitops.c | 3 +-- tests/test-blockjob-txn.c | 2 +- tests/test-coroutine.c | 1 + tests/test-crypto-cipher.c | 1 + tests/test-crypto-hash.c | 1 + tests/test-crypto-secret.c | 1 + tests/test-crypto-tlscredsx509.c | 4 +--- tests/test-crypto-tlssession.c | 4 +--- tests/test-cutils.c | 3 +-- tests/test-hbitmap.c | 4 +--- tests/test-int128.c | 3 +-- tests/test-io-channel-buffer.c | 1 + tests/test-io-channel-command.c | 1 + tests/test-io-channel-file.c | 1 + tests/test-io-channel-socket.c | 1 + tests/test-io-channel-tls.c | 4 +--- tests/test-io-task.c | 1 + tests/test-iov.c | 1 + tests/test-mul64.c | 3 +-- tests/test-netfilter.c | 1 + tests/test-opts-visitor.c | 1 + tests/test-qdev-global-props.c | 2 +- tests/test-qemu-opts.c | 3 +-- tests/test-qga.c | 9 +-------- tests/test-qmp-commands.c | 1 + tests/test-qmp-event.c | 2 +- tests/test-qmp-input-strict.c | 2 +- tests/test-qmp-input-visitor.c | 2 +- tests/test-qmp-output-visitor.c | 1 + tests/test-rcu-list.c | 6 +----- tests/test-rfifolock.c | 1 + tests/test-string-input-visitor.c | 2 +- tests/test-string-output-visitor.c | 1 + tests/test-thread-pool.c | 1 + tests/test-throttle.c | 1 + tests/test-timed-average.c | 2 +- tests/test-visitor-serialization.c | 3 +-- tests/test-vmstate.c | 1 + tests/test-write-threshold.c | 2 +- tests/test-x86-cpuid.c | 1 + tests/test-xbzrle.c | 6 +----- tests/tmp105-test.c | 1 + tests/tpci200-test.c | 3 +-- tests/vhost-user-bridge.c | 12 +----------- tests/vhost-user-test.c | 1 + tests/virtio-balloon-test.c | 3 +-- tests/virtio-blk-test.c | 5 +---- tests/virtio-console-test.c | 3 +-- tests/virtio-net-test.c | 3 +-- tests/virtio-rng-test.c | 3 +-- tests/virtio-scsi-test.c | 4 +--- tests/virtio-serial-test.c | 3 +-- tests/vmxnet3-test.c | 3 +-- tests/wdt_ib700-test.c | 3 +-- 119 files changed, 119 insertions(+), 202 deletions(-)
tests/ac97-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/bios-tables-test.c +1 -3
@@ -10,13 +10,11 @@* See the COPYING file in the top-level directory. */ -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h> #include <glib/gstdio.h> #include "qemu-common.h" #include "libqtest.h" -#include "qemu/compiler.h" #include "hw/acpi/acpi-defs.h" #include "hw/smbios/smbios.h" #include "qemu/bitmap.h"
tests/boot-order-test.c +1 -1
@@ -10,7 +10,7 @@* See the COPYING file in the top-level directory. */ -#include <string.h> +#include "qemu/osdep.h" #include <glib.h> #include "libqos/fw_cfg.h" #include "libqtest.h"
tests/check-qdict.c +1 -0
@@ -9,6 +9,7 @@* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qint.h"
tests/check-qfloat.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING.LIB file in the top-level directory. * */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qfloat.h"
tests/check-qint.c +1 -0
@@ -9,6 +9,7 @@* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qint.h"
tests/check-qjson.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING.LIB file in the top-level directory. * */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qstring.h"
tests/check-qlist.c +1 -0
@@ -9,6 +9,7 @@* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qint.h"
tests/check-qom-interface.c +1 -0
@@ -9,6 +9,7 @@* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qom/object.h"
tests/check-qom-proplist.c +1 -0
@@ -18,6 +18,7 @@* Author: Daniel P. Berrange <[email protected]> */ +#include "qemu/osdep.h" #include <glib.h> #include "qom/object.h"
tests/check-qstring.c +1 -0
@@ -9,6 +9,7 @@* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qapi/qmp/qstring.h"
tests/crypto-tls-x509-helpers.c +1 -3
@@ -18,10 +18,8 @@* Author: Daniel P. Berrange <[email protected]> */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "qemu/sockets.h"
tests/device-introspect-test.c +1 -1
@@ -17,8 +17,8 @@* bugs around here. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/qmp/qstring.h" #include "libqtest.h"
tests/display-vga-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" static void pci_cirrus (void ) {
tests/drive_del-test.c +1 -1
@@ -10,8 +10,8 @@* See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" static void drive_add (void )
tests/ds1338-test.c +1 -0
@@ -17,6 +17,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "libqtest.h" #include "libqos/i2c.h"
tests/e1000-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void test_device (gconstpointer data)
tests/eepro100-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" static void test_device (gconstpointer data) {
tests/endianness-test.c +1 -4
@@ -11,11 +11,8 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> #include "libqtest.h" #include "qemu/bswap.h"
tests/es1370-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/fdc-test.c +1 -3
@@ -22,9 +22,7 @@* THE SOFTWARE. */ -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h>
tests/fw_cfg-test.c +1 -1
@@ -10,7 +10,7 @@* See the COPYING file in the top-level directory. */ -#include <string.h> +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h"
tests/hd-geo-test.c +1 -3
@@ -15,10 +15,8 @@* Improvements welcome. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> #include "qemu-common.h" #include "libqtest.h"
tests/i440fx-test.c +0 -5
@@ -14,12 +14,7 @@#include "qemu/osdep.h" #include <glib.h> -#include <string.h> -#include <stdio.h> -#include <unistd.h> -#include <errno.h> #include <sys/mman.h> -#include <stdlib.h> #include "libqtest.h" #include "libqos/pci.h"
tests/i82801b11-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/intel-hda-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #define HDA_ID "hda0"#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
tests/io-channel-helpers.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include "io-channel-helpers.h" struct QIOChannelTest {
tests/ioh3420-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/ipmi-bt-test.c +1 -4
@@ -22,10 +22,7 @@* THE SOFTWARE. */ -#include <sys/types.h> -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <sys/socket.h> #include <netinet/in.h>
tests/ipmi-kcs-test.c +1 -3
@@ -22,9 +22,7 @@* THE SOFTWARE. */ -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h>
tests/ipoctal232-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/ivshmem-test.c +1 -5
@@ -8,17 +8,13 @@* See the COPYING file in the top-level directory. */ -#include <errno.h> -#include <fcntl.h> +#include "qemu/osdep.h" #include <glib.h> #include <glib/gstdio.h> -#include <string.h> #include <sys/mman.h> -#include <unistd.h> #include "contrib/ivshmem-server/ivshmem-server.h" #include "libqos/pci-pc.h" #include "libqtest.h" -#include "qemu/osdep.h" #include "qemu-common.h" #define TMPSHMSIZE (1 << 20)
tests/libqos/fw_cfg.c +1 -0
@@ -12,6 +12,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqos/fw_cfg.h" #include "libqtest.h"
tests/libqos/i2c-imx.c +1 -2
@@ -17,12 +17,11 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "libqos/i2c.h" #include <glib.h> -#include <string.h> -#include "qemu/osdep.h" #include "libqtest.h" #include "hw/i2c/imx_i2c.h"
tests/libqos/i2c-omap.c +1 -2
@@ -6,12 +6,11 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/i2c.h" #include <glib.h> -#include <string.h> -#include "qemu/osdep.h" #include "qemu/bswap.h" #include "libqtest.h"
tests/libqos/i2c.c +1 -0
@@ -6,6 +6,7 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/i2c.h" #include "libqtest.h"
tests/libqos/libqos-pc.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "libqos/libqos-pc.h" #include "libqos/malloc-pc.h"
tests/libqos/libqos.c +1 -5
@@ -1,9 +1,5 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include "qemu/osdep.h" #include <glib.h> -#include <unistd.h> -#include <fcntl.h> #include <sys/wait.h> #include "libqtest.h"
tests/libqos/malloc-generic.c +1 -0
@@ -7,6 +7,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqos/malloc-generic.h" #include "libqos/malloc.h"
tests/libqos/malloc-pc.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/malloc-pc.h" #include "libqos/fw_cfg.h"
tests/libqos/malloc.c +1 -2
@@ -10,10 +10,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/malloc.h" #include "qemu-common.h" -#include <stdio.h> -#include <inttypes.h> #include <glib.h> typedef QTAILQ_HEAD(MemList, MemBlock) MemList;
tests/libqos/pci-pc.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqtest.h" #include "libqos/pci-pc.h"
tests/libqos/pci.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "libqos/pci.h" #include "hw/pci/pci_regs.h"
tests/libqos/usb.c +1 -2
@@ -11,10 +11,9 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #include "hw/usb/uhci-regs.h" #include "libqos/usb.h"
tests/libqos/virtio-mmio.c +1 -1
@@ -7,8 +7,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-mmio.h"
tests/libqos/virtio-pci.c +1 -1
@@ -7,8 +7,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h"
tests/libqos/virtio.c +1 -0
@@ -7,6 +7,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h" #include "libqos/virtio.h"
tests/libqtest.c +2 -10
@@ -14,22 +14,14 @@* See the COPYING file in the top-level directory. * */ +#include "qemu/osdep.h" #include "libqtest.h" #include <glib.h> -#include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> #include <sys/un.h> -#include <inttypes.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -#include "qemu/compiler.h" -#include "qemu/osdep.h" +#include "qapi/qmp/json-parser.h" #include "qapi/qmp/json-streamer.h" #include "qapi/qmp/qjson.h"
tests/m48t59-test.c +1 -4
@@ -12,11 +12,8 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> #include "libqtest.h"
tests/ne2000-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop (void )
tests/nvme-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/pc-cpu-test.c +1 -2
@@ -7,12 +7,11 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "qemu-common.h" #include "libqtest.h" -#include "qemu/osdep.h" #include "qapi/qmp/types.h" struct PCTestData {
tests/pcnet-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop (void )
tests/pkix_asn1_tab.c +1 -0
@@ -3,6 +3,7 @@* and is under copyright of various GNUTLS contributors. */ +#include "qemu/osdep.h" #include <libtasn1.h> const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
tests/pvpanic-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" static void test_panic (void ) {
tests/q35-test.c +1 -2
@@ -9,12 +9,11 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" -#include "qemu/osdep.h" #include "hw/pci-host/q35.h" static void smram_set_bit (QPCIDevice *pcidev,uint8_t mask,bool enabled)
tests/qemu-iotests/socket_scm_helper.c +1 -7
@@ -10,15 +10,9 @@* See the COPYING.LIB file in the top-level directory. */ -#include <stdio.h> -#include <errno.h> +#include "qemu/osdep.h" #include <sys/socket.h> #include <sys/un.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> /* #define SOCKET_SCM_DEBUG */
tests/qom-test.c +1 -2
@@ -7,12 +7,11 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "qemu-common.h" #include "libqtest.h" -#include "qemu/osdep.h" #include "qapi/qmp/types.h" static const char *blacklist_x86[] = {
tests/rcutorture.c +1 -4
@@ -60,13 +60,10 @@* Test variables. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> #include "qemu/atomic.h" #include "qemu/rcu.h" -#include "qemu/compiler.h" #include "qemu/thread.h" long long n_reads =0LL ;
tests/rtc-test.c +1 -4
@@ -11,11 +11,8 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> #include "libqtest.h" #include "hw/timer/mc146818rtc_regs.h"
tests/rtl8139-test.c +1 -2
@@ -7,11 +7,10 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" #include "libqos/pci-pc.h" -#include "qemu/osdep.h" #include "qemu/timer.h" #include "qemu-common.h"
tests/spapr-phb-test.c +1 -0
@@ -7,6 +7,7 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h"
tests/tco-test.c +1 -3
@@ -6,10 +6,8 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> #include "libqtest.h" #include "libqos/pci.h"
tests/test-aio.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "block/aio.h" #include "qemu/timer.h"
tests/test-base64.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu/base64.h"
tests/test-bitops.c +1 -2
@@ -6,9 +6,8 @@* */ -#include <glib.h> -#include <stdint.h> #include "qemu/osdep.h" +#include <glib.h> #include "qemu/bitops.h" typedef struct {
tests/test-blockjob-txn.c +1 -1
@@ -10,8 +10,8 @@* See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include "qapi/error.h" #include "qemu/main-loop.h" #include "block/blockjob.h"
tests/test-coroutine.c +1 -0
@@ -11,6 +11,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu/coroutine.h" #include "qemu/coroutine_int.h"
tests/test-crypto-cipher.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "crypto/init.h"
tests/test-crypto-hash.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "crypto/init.h"
tests/test-crypto-secret.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "crypto/init.h"
tests/test-crypto-tlscredsx509.c +1 -3
@@ -18,10 +18,8 @@* Author: Daniel P. Berrange <[email protected]> */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "crypto/tlscredsx509.h"
tests/test-crypto-tlssession.c +1 -3
@@ -18,10 +18,8 @@* Author: Daniel P. Berrange <[email protected]> */ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "crypto/tlscredsx509.h" #include "crypto/tlssession.h"
tests/test-cutils.c +1 -2
@@ -25,9 +25,8 @@* THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> -#include <errno.h> -#include <string.h> #include "qemu-common.h"
tests/test-hbitmap.c +1 -3
@@ -9,10 +9,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> -#include <string.h> -#include <sys/types.h> #include "qemu/hbitmap.h" #define LOG_BITS_PER_LONG (BITS_PER_LONG == 32 ? 5 : 6)
tests/test-int128.c +1 -2
@@ -6,10 +6,9 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdio.h> #include "qemu/int128.h" -#include "qemu/osdep.h" /* clang doesn't support __noclone__ but it does have a mechanism for * telling us this. We assume that if we don't have __has_attribute()
tests/test-io-channel-buffer.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include "io/channel-buffer.h" #include "io-channel-helpers.h"
tests/test-io-channel-command.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include "io/channel-command.h" #include "io-channel-helpers.h"
tests/test-io-channel-file.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include "io/channel-file.h" #include "io-channel-helpers.h"
tests/test-io-channel-socket.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include "io/channel-socket.h" #include "io-channel-helpers.h" #ifdef HAVE_IFADDRS_H
tests/test-io-channel-tls.c +1 -3
@@ -21,10 +21,8 @@*/ -#include <stdlib.h> -#include <fcntl.h> +#include "qemu/osdep.h" -#include "config-host.h" #include "crypto-tls-x509-helpers.h" #include "io/channel-tls.h" #include "io/channel-socket.h"
tests/test-io-task.c +1 -0
@@ -18,6 +18,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "io/task.h"
tests/test-iov.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "qemu/iov.h"
tests/test-mul64.c +1 -2
@@ -6,10 +6,9 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdint.h> #include "qemu/host-utils.h" -#include "qemu/osdep.h" typedef struct {
tests/test-netfilter.c +1 -0
@@ -8,6 +8,7 @@* later. See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h"
tests/test-opts-visitor.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu/config-file.h" /* qemu_add_opts() */
tests/test-qdev-global-props.c +1 -1
@@ -22,8 +22,8 @@* THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdint.h> #include "hw/qdev.h" #include "qom/object.h"
tests/test-qemu-opts.c +1 -2
@@ -7,12 +7,11 @@* See the COPYING.LIB file in the top-level directory. */ -#include "qapi/error.h" +#include "qemu/osdep.h" #include "qapi/qmp/qstring.h" #include "qemu/config-file.h" #include <glib.h> -#include <string.h> static QemuOptsList opts_list_01 = { .name ="opts_list_01" ,
tests/test-qga.c +1 -8
@@ -1,18 +1,11 @@ +#include "qemu/osdep.h" #include <locale.h> #include <glib.h> #include <glib/gstdio.h> -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> -#include <unistd.h> -#include <inttypes.h> #include "libqtest.h" -#include "config-host.h" #include "qga/guest-agent-core.h" typedef struct {
tests/test-qmp-commands.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "qapi/qmp/types.h"
tests/test-qmp-event.c +1 -1
@@ -11,8 +11,8 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "test-qapi-types.h"
tests/test-qmp-input-strict.c +1 -1
@@ -11,8 +11,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/qmp-input-visitor.h"
tests/test-qmp-input-visitor.c +1 -1
@@ -10,8 +10,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/qmp-input-visitor.h"
tests/test-qmp-output-visitor.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h"
tests/test-rcu-list.c +1 -5
@@ -20,14 +20,10 @@* Copyright (c) 2013 Mike D. Day, IBM Corporation. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> #include "qemu/atomic.h" #include "qemu/rcu.h" -#include "qemu/compiler.h" -#include "qemu/osdep.h" #include "qemu/thread.h" #include "qemu/rcu_queue.h"
tests/test-rfifolock.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "qemu/rfifolock.h"
tests/test-string-input-visitor.c +1 -1
@@ -10,8 +10,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdarg.h> #include "qemu-common.h" #include "qapi/string-input-visitor.h"
tests/test-string-output-visitor.c +1 -0
@@ -10,6 +10,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h"
tests/test-thread-pool.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h" #include "block/aio.h"
tests/test-throttle.c +1 -0
@@ -12,6 +12,7 @@* See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include <math.h> #include "block/aio.h"
tests/test-timed-average.c +1 -1
@@ -10,8 +10,8 @@* See the COPYING.LIB file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <unistd.h> #include "qemu/timed-average.h"
tests/test-visitor-serialization.c +1 -2
@@ -11,9 +11,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdlib.h> -#include <stdint.h> #include <float.h> #include "qemu-common.h"
tests/test-vmstate.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> #include "qemu-common.h"
tests/test-write-threshold.c +1 -1
@@ -6,8 +6,8 @@* */ +#include "qemu/osdep.h" #include <glib.h> -#include <stdint.h> #include "block/block_int.h" #include "block/write-threshold.h"
tests/test-x86-cpuid.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "qemu/osdep.h" #include <glib.h> #include "hw/i386/topology.h"
tests/test-xbzrle.c +1 -5
@@ -10,11 +10,7 @@* See the COPYING file in the top-level directory. * */ -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/time.h> +#include "qemu/osdep.h" #include "qemu-common.h" #include "include/migration/migration.h"
tests/tmp105-test.c +1 -0
@@ -7,6 +7,7 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h"
tests/tpci200-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/vhost-user-bridge.c +1 -11
@@ -29,23 +29,13 @@#define _FILE_OFFSET_BITS 64 -#include <stddef.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <inttypes.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <sys/types.h> +#include "qemu/osdep.h" #include <sys/socket.h> #include <sys/un.h> #include <sys/unistd.h> #include <sys/mman.h> #include <sys/eventfd.h> #include <arpa/inet.h> -#include <ctype.h> #include <netdb.h> #include <linux/vhost.h>
tests/vhost-user-test.c +1 -0
@@ -8,6 +8,7 @@* */ +#include "qemu/osdep.h" #include <glib.h> #include "libqtest.h"
tests/virtio-balloon-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop (void )
tests/virtio-blk-test.c +1 -4
@@ -8,11 +8,8 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h"
tests/virtio-console-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void console_pci_nop (void )
tests/virtio-net-test.c +1 -2
@@ -7,12 +7,11 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" #include "qemu-common.h" #include "qemu/sockets.h" -#include "qemu/osdep.h" #include "qemu/iov.h" #include "libqos/pci-pc.h" #include "libqos/virtio.h"
tests/virtio-rng-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #include "libqos/pci.h" #define PCI_SLOT_HP 0x06
tests/virtio-scsi-test.c +1 -3
@@ -8,11 +8,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" -#include <stdio.h> #include "block/scsi.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h"
tests/virtio-serial-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void pci_nop (void )
tests/vmxnet3-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop (void )
tests/wdt_ib700-test.c +1 -2
@@ -7,10 +7,9 @@* See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include <glib.h> -#include <string.h> #include "libqtest.h" -#include "qemu/osdep.h" #include "qemu/timer.h" static void qmp_check_no_event (void )
Signature · 1 line
1.9.1
PATCH 10/14 qapi: Clean up includes in generated files
In reply to Peter MaydellFrom: Eric Blake <[email protected]>
As a followup to commit cbf2115, clean up the includes in files generated by QAPI so that osdep.h is included first in .c files, and headers which it implies are not included manually. This patch is done manually, since Coccinelle (and therefore scripts/clean-includes) doesn't see into the generator scripts.
--- scripts/qapi-commands.py | 1 + scripts/qapi-event.py | 1 + scripts/qapi-introspect.py | 3 ++- scripts/qapi-types.py | 3 +-- scripts/qapi-visit.py | 1 + 5 files changed, 6 insertions(+), 3 deletions(-)
scripts/qapi-commands.py +1 -0
@@ -297,6 +297,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/module.h" #include "qapi/qmp/types.h"
scripts/qapi-event.py +1 -0
@@ -161,6 +161,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qemu-common.h" #include "%(prefix)sqapi-event.h" #include "%(prefix)sqapi-visit.h"
scripts/qapi-introspect.py +2 -1
@@ -1,7 +1,7 @@ # # QAPI introspection generator # -# Copyright (C) 2015 Red Hat, Inc. +# Copyright (C) 2015-2016 Red Hat, Inc. # # Authors: # Markus Armbruster <[email protected]>
@@ -204,6 +204,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "%(prefix)sqmp-introspect.h" ''',
scripts/qapi-types.py +1 -2
@@ -279,6 +279,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" #include "%(prefix)sqapi-types.h" #include "%(prefix)sqapi-visit.h"
@@ -287,8 +288,6 @@ fdef.write(mcgen(''' # To avoid circular headers, use only typedefs.h here, not qobject.h fdecl.write(mcgen(''' -#include <stdbool.h> -#include <stdint.h> #include "qemu/typedefs.h" '''))
scripts/qapi-visit.py +1 -0
@@ -437,6 +437,7 @@ h_comment = ''' c_comment, h_comment) fdef.write(mcgen(''' +#include "qemu/osdep.h" #include "qemu-common.h" #include "%(prefix)sqapi-visit.h" ''',
Signature · 1 line
1.9.1
PATCH 11/14 scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h
In reply to Peter MaydellIn the .c files generated by this script, include qemu/osdep.h as the first included header, not config.h.
--- scripts/feature_to_c.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/feature_to_c.sh +1 -1
@@ -36,7 +36,7 @@ for input; do arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'` ${AWK:-awk} 'BEGIN { n = 0 - printf "#include \"config.h\"\n" + printf "#include \"qemu/osdep.h\"\n" printf "#include \"qemu-common.h\"\n" printf "#include \"exec/gdbstub.h\"\n" print "static const char '$arrayname'[] = {"
Signature · 1 line
1.9.1
PATCH 12/14 scripts/tracetool: Include qemu/osdep.h in generated .c files
In reply to Peter MaydellInclude qemu/osdep.h as the first include in generated .c files, so they don't implicitly rely on some other included header to pull it in.
--- scripts/tracetool/backend/simple.py | 3 ++- scripts/tracetool/format/events_c.py | 1 + scripts/tracetool/format/tcg_helper_c.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
scripts/tracetool/backend/simple.py +2 -1
@@ -42,7 +42,8 @@ def generate_h(event): def generate_c_begin(events): - out('#include "trace.h"', + out('#include "qemu/osdep.h"', + '#include "trace.h"', '#include "trace/control.h"', '#include "trace/simple.h"', '')
scripts/tracetool/format/events_c.py +1 -0
@@ -19,6 +19,7 @@ from tracetool import out def generate(events, backend): out('/* This file is autogenerated by tracetool, do not edit. */', '', + '#include "qemu/osdep.h"', '#include "trace.h"', '#include "trace/generated-events.h"', '#include "trace/control.h"',
scripts/tracetool/format/tcg_helper_c.py +1 -0
@@ -23,6 +23,7 @@ def generate(events, backend): out('/* This file is autogenerated by tracetool, do not edit. */', '', + '#include "qemu/osdep.h"', '#include "qemu-common.h"', '#include "trace.h"', '#include "exec/helper-proto.h"',
Signature · 1 line
1.9.1
PATCH 13/14 all: Clean up includes
In reply to Peter MaydellClean 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.
--- hw/arm/bcm2835_peripherals.c | 1 + hw/arm/bcm2836.c | 1 + hw/arm/raspi.c | 1 + hw/intc/bcm2835_ic.c | 1 + hw/intc/bcm2836_control.c | 1 + hw/misc/bcm2835_mbox.c | 1 + hw/misc/bcm2835_property.c | 1 + stubs/blockdev-close-all-bdrv-states.c | 1 + 8 files changed, 8 insertions(+)
hw/arm/bcm2835_peripherals.c +1 -0
@@ -8,6 +8,7 @@* This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/arm/bcm2835_peripherals.h" #include "hw/misc/bcm2835_mbox_defs.h" #include "hw/arm/raspi_platform.h"
hw/arm/bcm2836.c +1 -0
@@ -8,6 +8,7 @@* This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h"
hw/arm/raspi.c +1 -0
@@ -8,6 +8,7 @@* This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/arm/bcm2836.h" #include "qemu/error-report.h" #include "hw/boards.h"
hw/intc/bcm2835_ic.c +1 -0
@@ -12,6 +12,7 @@* This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/intc/bcm2835_ic.h" #define GPU_IRQS 64
hw/intc/bcm2836_control.c +1 -0
@@ -13,6 +13,7 @@* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf */ +#include "qemu/osdep.h" #include "hw/intc/bcm2836_control.h" #define REG_GPU_ROUTE 0x0c
hw/misc/bcm2835_mbox.c +1 -0
@@ -8,6 +8,7 @@* https://github.com/raspberrypi/firmware/wiki/Accessing-mailboxes */ +#include "qemu/osdep.h" #include "hw/misc/bcm2835_mbox.h" #define MAIL0_PEEK 0x90
hw/misc/bcm2835_property.c +1 -0
@@ -3,6 +3,7 @@* This code is licensed under the GNU GPLv2 and later. */ +#include "qemu/osdep.h" #include "hw/misc/bcm2835_property.h" #include "hw/misc/bcm2835_mbox_defs.h" #include "sysemu/dma.h"
stubs/blockdev-close-all-bdrv-states.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "block/block_int.h" void blockdev_close_all_bdrv_states (void )
Signature · 1 line
1.9.1
PATCH 14/14 oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h
In reply to Peter MaydellThe right place for "work around issues with system headers" code is osdep.h. Move the workaround for OSX's stdlib.h emitting a deprecation warning for daemon() to that header.
This also fixes a problem where running clean-includes on oslib-posix.c would erroneously remove the #include <stdlib.h> from it, breaking the workaround.
--- include/qemu/osdep.h | 11 +++++++++++ util/oslib-posix.c | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-)
include/qemu/osdep.h +11 -0
@@ -27,6 +27,17 @@#include "config-host.h" #include "qemu/compiler.h" + +/* The following block of code temporarily renames the daemon() function so the +* compiler does not see the warning associated with it in stdlib.h on OSX +*/ +#ifdef __APPLE__ +#define daemon qemu_fake_daemon_function +#include <stdlib.h> +#undef daemon +extern int daemon (int ,int ); +#endif +#include <stdarg.h> #include <stddef.h> #include <stdbool.h>
util/oslib-posix.c +0 -9
@@ -26,15 +26,6 @@* THE SOFTWARE. */ -/* The following block of code temporarily renames the daemon() function so the -compiler does not see the warning associated with it in stdlib.h on OSX */ -#ifdef __APPLE__ -#define daemon qemu_fake_daemon_function -#include <stdlib.h> -#undef daemon -extern int daemon (int ,int ); -#endif -#if defined(__linux__) && (defined(__x86_64__) || defined(__arm__))/* Use 2 MiB alignment so transparent hugepages can be used by KVM. Valgrind does not support alignments larger than 1 MiB,
Signature · 1 line
1.9.1
Quoted 23 lines · Peter Maydell
This set of patches does a bunch more cleaning of includes. Specifically it does everything necessary to be able to remove
osdep.hincludes from header files includingqemu-common.hMost of these patches are small, except for the one which deals with tests/ (that one has already been reviewed). There are several patches which fix code generators to generate correct #includes, and some which do manual changes to C++ or other files that Coccinelle barfs on.
The "all:" patch is running clean-includes on the whole tree to pick up some new files which have been added recently (mostly via target-arm).
I've thrown in a couple of patches that have already appeared on list, just to get the whole set into one series.
I have some pending patches which:
* enhance clean-includes to handle header files
* clean up header files
* add a --all option to clean-includes to do a "run clean on whole tree"
Quoted 3 lines
but I'd like to get the "add missing includes to .c files" parts into master before moving onto "remove includes from .h files" part...
Quoted 173 lines
thanks
-- PMMEric Blake (1):
qapi: Clean up includes in generated filesPeter Maydell (13):
cpu: Clean up includes
ui/cocoa.m: Includeqemu/osdep.h
disas/arm-a64.cc: Includeosdep.hfirst
hw/block/nand.c: Includeosdep.hfirst
target-cris: Remove unnecessary ifdef frommmu.c
cris: Clean up includes
libdecnumber: Clean up includes
tests/i440fx-test: Don't defineARRAY_SIZElocally
tests: Clean up includes
scripts/feature_to_c.sh: Includeqemu/osdep.hrather thanconfig.hscripts/tracetool: Includeqemu/osdep.hin generated .c files
all: Clean up includes
oslib-posix.c: Move workaround for OSXdaemon()deprecation toosdep.hdisas/arm-a64.cc | 5 +++-- hw/arm/bcm2835_peripherals.c | 1 + hw/arm/bcm2836.c | 1 + hw/arm/raspi.c | 1 + hw/block/nand.c | 5 +++-- hw/intc/bcm2835_ic.c | 1 + hw/intc/bcm2836_control.c | 1 + hw/misc/bcm2835_mbox.c | 1 + hw/misc/bcm2835_property.c | 1 + include/qemu/osdep.h | 11 +++++++++++ libdecnumber/decContext.c | 3 +-- libdecnumber/decNumber.c | 5 +---- libdecnumber/dpd/decimal128.c | 3 +-- libdecnumber/dpd/decimal32.c | 3 +-- libdecnumber/dpd/decimal64.c | 3 +-- qom/cpu.c | 1 + scripts/feature_to_c.sh | 2 +- scripts/qapi-commands.py | 1 + scripts/qapi-event.py | 1 + scripts/qapi-introspect.py | 3 ++- scripts/qapi-types.py | 3 +-- scripts/qapi-visit.py | 1 + scripts/tracetool/backend/simple.py | 3 ++- scripts/tracetool/format/events_c.py | 1 + scripts/tracetool/format/tcg_helper_c.py | 1 + stubs/blockdev-close-all-bdrv-states.c | 1 + target-cris/mmu.c | 4 +--- target-i386/cpu.c | 5 +---- tests/ac97-test.c | 3 +-- tests/bios-tables-test.c | 4 +--- tests/boot-order-test.c | 2 +- tests/check-qdict.c | 1 + tests/check-qfloat.c | 1 + tests/check-qint.c | 1 + tests/check-qjson.c | 1 + tests/check-qlist.c | 1 + tests/check-qom-interface.c | 1 + tests/check-qom-proplist.c | 1 + tests/check-qstring.c | 1 + tests/crypto-tls-x509-helpers.c | 4 +--- tests/device-introspect-test.c | 2 +- tests/display-vga-test.c | 3 +-- tests/drive_del-test.c | 2 +- tests/ds1338-test.c | 1 + tests/e1000-test.c | 3 +-- tests/eepro100-test.c | 3 +-- tests/endianness-test.c | 5 +---- tests/es1370-test.c | 3 +-- tests/fdc-test.c | 4 +--- tests/fw_cfg-test.c | 2 +- tests/hd-geo-test.c | 4 +--- tests/i440fx-test.c | 8 +------- tests/i82801b11-test.c | 3 +-- tests/intel-hda-test.c | 3 +-- tests/io-channel-helpers.c | 1 + tests/ioh3420-test.c | 3 +-- tests/ipmi-bt-test.c | 5 +---- tests/ipmi-kcs-test.c | 4 +--- tests/ipoctal232-test.c | 3 +-- tests/ivshmem-test.c | 6 +----- tests/libqos/fw_cfg.c | 1 + tests/libqos/i2c-imx.c | 3 +-- tests/libqos/i2c-omap.c | 3 +-- tests/libqos/i2c.c | 1 + tests/libqos/libqos-pc.c | 1 + tests/libqos/libqos.c | 6 +----- tests/libqos/malloc-generic.c | 1 + tests/libqos/malloc-pc.c | 1 + tests/libqos/malloc.c | 3 +-- tests/libqos/pci-pc.c | 1 + tests/libqos/pci.c | 1 + tests/libqos/usb.c | 3 +-- tests/libqos/virtio-mmio.c | 2 +- tests/libqos/virtio-pci.c | 2 +- tests/libqos/virtio.c | 1 + tests/libqtest.c | 12 ++---------- tests/m48t59-test.c | 5 +---- tests/ne2000-test.c | 3 +-- tests/nvme-test.c | 3 +-- tests/pc-cpu-test.c | 3 +-- tests/pcnet-test.c | 3 +-- tests/pkix_asn1_tab.c | 1 + tests/pvpanic-test.c | 3 +-- tests/q35-test.c | 3 +-- tests/qemu-iotests/socket_scm_helper.c | 8 +------- tests/qom-test.c | 3 +-- tests/rcutorture.c | 5 +---- tests/rtc-test.c | 5 +---- tests/rtl8139-test.c | 3 +-- tests/spapr-phb-test.c | 1 + tests/tco-test.c | 4 +--- tests/test-aio.c | 1 + tests/test-base64.c | 1 + tests/test-bitops.c | 3 +-- tests/test-blockjob-txn.c | 2 +- tests/test-coroutine.c | 1 + tests/test-crypto-cipher.c | 1 + tests/test-crypto-hash.c | 1 + tests/test-crypto-secret.c | 1 + tests/test-crypto-tlscredsx509.c | 4 +--- tests/test-crypto-tlssession.c | 4 +--- tests/test-cutils.c | 3 +-- tests/test-hbitmap.c | 4 +--- tests/test-int128.c | 3 +-- tests/test-io-channel-buffer.c | 1 + tests/test-io-channel-command.c | 1 + tests/test-io-channel-file.c | 1 + tests/test-io-channel-socket.c | 1 + tests/test-io-channel-tls.c | 4 +--- tests/test-io-task.c | 1 + tests/test-iov.c | 1 + tests/test-mul64.c | 3 +-- tests/test-netfilter.c | 1 + tests/test-opts-visitor.c | 1 + tests/test-qdev-global-props.c | 2 +- tests/test-qemu-opts.c | 3 +-- tests/test-qga.c | 9 +-------- tests/test-qmp-commands.c | 1 + tests/test-qmp-event.c | 2 +- tests/test-qmp-input-strict.c | 2 +- tests/test-qmp-input-visitor.c | 2 +- tests/test-qmp-output-visitor.c | 1 + tests/test-rcu-list.c | 6 +----- tests/test-rfifolock.c | 1 + tests/test-string-input-visitor.c | 2 +- tests/test-string-output-visitor.c | 1 + tests/test-thread-pool.c | 1 + tests/test-throttle.c | 1 + tests/test-timed-average.c | 2 +- tests/test-visitor-serialization.c | 3 +-- tests/test-vmstate.c | 1 + tests/test-write-threshold.c | 2 +- tests/test-x86-cpuid.c | 1 + tests/test-xbzrle.c | 6 +----- tests/tmp105-test.c | 1 + tests/tpci200-test.c | 3 +-- tests/vhost-user-bridge.c | 12 +----------- tests/vhost-user-test.c | 1 + tests/virtio-balloon-test.c | 3 +-- tests/virtio-blk-test.c | 5 +---- tests/virtio-console-test.c | 3 +-- tests/virtio-net-test.c | 3 +-- tests/virtio-rng-test.c | 3 +-- tests/virtio-scsi-test.c | 4 +--- tests/virtio-serial-test.c | 3 +-- tests/vmxnet3-test.c | 3 +-- tests/wdt_ib700-test.c | 3 +-- ui/cocoa.m | 2 ++ util/oslib-posix.c | 9 --------- 149 files changed, 166 insertions(+), 241 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 24 lines · Eric Blake
Quoted 23 lines · Peter Maydell
This set of patches does a bunch more cleaning of includes. Specifically it does everything necessary to be able to remove
osdep.hincludes from header files includingqemu-common.hMost of these patches are small, except for the one which deals with tests/ (that one has already been reviewed). There are several patches which fix code generators to generate correct #includes, and some which do manual changes to C++ or other files that Coccinelle barfs on.
The "all:" patch is running clean-includes on the whole tree to pick up some new files which have been added recently (mostly via target-arm).
I've thrown in a couple of patches that have already appeared on list, just to get the whole set into one series.
I have some pending patches which:
* enhance clean-includes to handle header files
* clean up header files
* add a --all option to clean-includes to do a "run clean on whole tree"
Quoted 5 lines
Quoted 3 lines
but I'd like to get the "add missing includes to .c files" parts into master before moving onto "remove includes from .h files" part...
Reviewed-by Eric Blake <[email protected]>
But failed testing:
CC disas/arm.o
CXX disas/arm-a64.o
In file included from /usr/include/c++/5.3.1/cmath:41:0,
from /home/eblake/qemu-tmp/disas/libvixl/vixl/utils.h:31, from/home/eblake/qemu-tmp/disas/libvixl/vixl/a64/disasm-a64.h:31,
from disas/arm-a64.cc:25:
/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h:1991:10:
error: expected unqualified-id before ‘namespace’
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
^Not sure what went wrong there, but 3/14 probably needs tweaking.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 8 lines · Eric Blake
But failed testing:
CC
disas/arm.o
CXXdisas/arm-a64.o
In file included from/usr/include/c++/5.3.1/cmath:41:0,
from/home/eblake/qemu-tmp/disas/libvixl/vixl/utils.h:31, from/home/eblake/qemu-tmp/disas/libvixl/vixl/a64/disasm-a64.h:31,
Quoted 7 lines
from disas/arm-a64.cc:25: /usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h:1991:10: error: expected unqualified-id before ‘namespace’ inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } ^Not sure what went wrong there, but 3/14 probably needs tweaking.
Weird. Your machine does compile libvixl right in current master? The patch does build fine for me, and it's not clear to me why moving the disasm-a64.h include below osdep.h and disas/bfd.h would make it stop building. Google suggests that missing semicolons can provoke this kind of error so maybe there's a latent error in the headers somewhere :-(
I'll have a look and see if clang produces an error and if so a more comprehensible one.
thanks
-- PMM
Quoted 24 lines · Peter Maydell
Quoted 8 lines · Eric Blake
But failed testing:
CC
disas/arm.o
CXXdisas/arm-a64.o
In file included from/usr/include/c++/5.3.1/cmath:41:0,
from/home/eblake/qemu-tmp/disas/libvixl/vixl/utils.h:31, from/home/eblake/qemu-tmp/disas/libvixl/vixl/a64/disasm-a64.h:31,Quoted 7 lines
from disas/arm-a64.cc:25: /usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h:1991:10: error: expected unqualified-id before ‘namespace’ inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } ^Not sure what went wrong there, but 3/14 probably needs tweaking.
Weird. Your machine does compile libvixl right in current master? The patch does build fine for me, and it's not clear to me why moving the
disasm-a64.hinclude belowosdep.handdisas/bfd.hwould make it stop building. Google suggests that missing semicolons can provoke this kind of error so maybe there's a latent error in the headers somewhere :-(
Quoted 2 lines
I'll have a look and see if clang produces an error and if so a more comprehensible one.
Nope, can't repro any kind of compile failure with clang either on my system. Can I ask you to investigate a bit?
If we just add the osdep.h include but leave the "vixl/a64/disasm-a64.h" include as the first one in arm-a64.cc does it build OK? (Maybe our attempts to be first-header clash with the desire of vixl code to have disas/libvixl/vixl/globals.h be first-header, though it's not clear to me how.)
thanks
-- PMM
Quoted 15 lines · Peter Maydell
Quoted 14 lines · Eric Blake
But failed testing:
CC
disas/arm.o
CXXdisas/arm-a64.o
In file included from/usr/include/c++/5.3.1/cmath:41:0,
from/home/eblake/qemu-tmp/disas/libvixl/vixl/utils.h:31, from/home/eblake/qemu-tmp/disas/libvixl/vixl/a64/disasm-a64.h:31,from disas/arm-a64.cc:25: /usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h:1991:10: error: expected unqualified-id before ‘namespace’ inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } ^
Quoted 8 lines
Quoted 1 line
Not sure what went wrong there, but 3/14 probably needs tweaking.
Weird. Your machine does compile libvixl right in current master? The patch does build fine for me, and it's not clear to me why moving the
disasm-a64.hinclude belowosdep.handdisas/bfd.hwould make it stop building. Google suggests that missing semicolons can provoke this kind of error so maybe there's a latent error in the headers somewhere :-(
Yes, I bisected to 3/14; where things compiled after 1/14 (and 2/14 is already in-tree).
Looking at the c++config.h header, I see a context of:
#if _GLIBCXX_USE_CXX11_ABI
namespace std
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
Comparing pre- and post-patch on the preprocessor output, it used to expand to:
# 1989 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3 namespace std
{
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}
but with the new header order it expands to:
# 1989 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3 namespace std
{
# 1991 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h"
__attribute__ (( always_inline )) __inline__
# 1991 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3
namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
}So _something_ in osdep.h is redefining 'inline' with disastrous effects to C++.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 6 lines · Eric Blake
but with the new header order it expands to:
# 1989 "
/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3 namespace std
{
Quoted 8 lines
# 1991 "
/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h"
__attribute__((always_inline))__inline__
# 1991 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } }So _something_ in
osdep.his redefining 'inline' with disastrous effects to C++.
This hack seems to fix things; but I'm not enough of a C++ expert to know if it is the best fix.
include/qemu/compiler.h +2 -0
@@ -77,6 +77,7 @@#define typeof_field (type, field) typeof(((type *)0)->field)#define type_check (t1,t2) ((t1*)0 - (t2*)0) +#ifndef __cplusplus#ifndef always_inline#if !((__GNUC__ <3 ) || defined(__APPLE__))#ifdef __OPTIMIZE__
@@ -88,6 +89,7 @@#undef inline#define inline always_inline#endif +#endif #define QEMU_BUILD_BUG_ON (x) \ typedef char glue(qemu_build_bug_on__,__LINE__)[(x)?-1:1]
__attribute__((unused));
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 33 lines · Eric Blake
Quoted 6 lines · Eric Blake
but with the new header order it expands to:
# 1989 "
/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3 namespace std
{Quoted 8 lines
# 1991 "
/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h"
__attribute__((always_inline))__inline__
# 1991 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } }So _something_ in
osdep.his redefining 'inline' with disastrous effects to C++.This hack seems to fix things; but I'm not enough of a C++ expert to know if it is the best fix.
include/qemu/compiler.h +1
-0@@ -77,6 +77,7 @@#define typeof_field (type, field) typeof(((type *)0)->field)#define type_check (t1,t2) ((t1*)0 - (t2*)0) +#ifndef __cplusplus#ifndef always_inline#if !((__GNUC__ <3 ) || defined(__APPLE__))#ifdef __OPTIMIZE__
include/qemu/compiler.h line 92
Quoted 4 lines
include/qemu/compiler.h +1
-0@@ -88,6 +89,7 @@#undef inline#define inline always_inline#endif +#endif
Ah, well tracked down. I guess my system headers don't happen to rely on this bit of inline syntax.
Next question -- do we really need to redefine "inline" to always_inline at all, in C or C++? (cc'd a few people who might have an opinion). My instinct is to say "don't do this, just trust the compiler to decide whether to bother inlining".
Git blame says this was added back in commit df2542c737ea2 in 2007, with the rationale "To avoid discarded inlining bug"...
thanks
-- PMM
Quoted 4 lines · Peter Maydell
Next question -- do we really need to redefine "inline" to
always_inlineat all, in C or C++? (cc'd a few people who might have an opinion). My instinct is to say "don't do this, just trust the compiler to decide whether to bother inlining".
Besides this, it sounds like a thing you'd do in the old -ffixed-reg days...
Paolo
Quoted 27 lines · Peter Maydell
Quoted 19 lines
Quoted 2 lines
So _something_ in
osdep.his redefining 'inline' with disastrous effects to C++.This hack seems to fix things; but I'm not enough of a C++ expert to know if it is the best fix.
include/qemu/compiler.h +1
-0@@ -77,6 +77,7 @@#define typeof_field (type, field) typeof(((type *)0)->field)#define type_check (t1,t2) ((t1*)0 - (t2*)0) +#ifndef __cplusplus#ifndef always_inline#if !((__GNUC__ <3 ) || defined(__APPLE__))#ifdef __OPTIMIZE__include/qemu/compiler.h line 92
Quoted 4 lines
include/qemu/compiler.h +1
-0@@ -88,6 +89,7 @@#undef inline#define inline always_inline#endif +#endif Ah, well tracked down. I guess my system headers don't happen to rely on this bit of inline syntax.
Quoted 4 lines
Next question -- do we really need to redefine "inline" to
always_inlineat all, in C or C++? (cc'd a few people who might have an opinion). My instinct is to say "don't do this, just trust the compiler to decide whether to bother inlining".
If ripping that chunk out doesn't hurt anything, I'm all in favor of it. Redefining 'inline' tends to hurt more than it prevents (and while there IS the case of C89 vs. C99 vs. GNU having different semantics for 'static inline', those are best worked around by writing and consistently using wrapper macros such as 'STATIC_INLINE', not redefining 'inline' itself).
Quoted 3 lines
Git blame says this was added back in commit
df2542c737ea2in 2007, with the rationale "To avoid discarded inlining bug"...
The date alone says it may be time to quit doing it :)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 7 lines · Peter Maydell
This set of patches does a bunch more cleaning of includes. Specifically it does everything necessary to be able to remove
osdep.hincludes from header files includingqemu-common.hEric Blake (1):
qapi: Clean up includes in generated files
Quoted 14 lines
Peter Maydell (13):
cpu: Clean up includes
ui/cocoa.m: Includeqemu/osdep.h
disas/arm-a64.cc: Includeosdep.hfirst
hw/block/nand.c: Includeosdep.hfirst
target-cris: Remove unnecessary ifdef frommmu.c
cris: Clean up includes
libdecnumber: Clean up includes
tests/i440fx-test: Don't defineARRAY_SIZElocally
tests: Clean up includes
scripts/feature_to_c.sh: Includeqemu/osdep.hrather thanconfig.hscripts/tracetool: Includeqemu/osdep.hin generated .c files
all: Clean up includes
oslib-posix.c: Move workaround for OSXdaemon()deprecation toosdep.h
Since I've applied Eric's don't-override-inline patch to master, I'm going to apply patches 03..14 to master now. (Patch 02 is already in, and patch 01 is going via Andreas' QOM tree.)
thanks
-- PMM
Quoted 23 lines · Peter Maydell
Quoted 7 lines · Peter Maydell
This set of patches does a bunch more cleaning of includes. Specifically it does everything necessary to be able to remove
osdep.hincludes from header files includingqemu-common.hEric Blake (1):
qapi: Clean up includes in generated filesQuoted 14 lines
Peter Maydell (13):
cpu: Clean up includes
ui/cocoa.m: Includeqemu/osdep.h
disas/arm-a64.cc: Includeosdep.hfirst
hw/block/nand.c: Includeosdep.hfirst
target-cris: Remove unnecessary ifdef frommmu.c
cris: Clean up includes
libdecnumber: Clean up includes
tests/i440fx-test: Don't defineARRAY_SIZElocally
tests: Clean up includes
scripts/feature_to_c.sh: Includeqemu/osdep.hrather thanconfig.hscripts/tracetool: Includeqemu/osdep.hin generated .c files
all: Clean up includes
oslib-posix.c: Move workaround for OSXdaemon()deprecation toosdep.h
Quoted 3 lines
Since I've applied Eric's don't-override-inline patch to master, I'm going to apply patches 03..14 to master now. (Patch 02 is already in, and patch 01 is going via Andreas' QOM tree.)
I dropped the arm-a64.cc change since the ancient w32 compile didn't like it; so 04..14 pushed to master.
thanks
-- PMM