Skip to content

Commit

Permalink
Include qapi/error.h exactly where needed
Browse files Browse the repository at this point in the history
This cleanup makes the number of objects depending on qapi/error.h
drop from 1910 (out of 4743) to 1612 in my "build everything" tree.

While there, separate #include from file comment with a blank line,
and drop a useless comment on why qemu/osdep.h is included first.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <[email protected]>
[Semantic conflict with commit 34e304e resolved, OSX breakage fixed]
  • Loading branch information
Markus Armbruster committed Feb 9, 2018
1 parent 522ece3 commit e688df6
Show file tree
Hide file tree
Showing 151 changed files with 117 additions and 70 deletions.
1 change: 1 addition & 0 deletions audio/wavcapture.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "audio.h"

Expand Down
1 change: 1 addition & 0 deletions balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sysemu/balloon.h"
#include "trace-root.h"
#include "qmp-commands.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qjson.h"

Expand Down
2 changes: 2 additions & 0 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "qemu/osdep.h"
#include "block/trace.h"
#include "block/block_int.h"
Expand All @@ -29,6 +30,7 @@
#include "qemu/error-report.h"
#include "module_block.h"
#include "qemu/module.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qjson.h"
Expand Down
1 change: 1 addition & 0 deletions block/block-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/sysemu.h"
#include "qapi-event.h"
#include "qapi/error.h"
#include "qemu/id.h"
#include "trace.h"
#include "migration/misc.h"
Expand Down
1 change: 1 addition & 0 deletions block/iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "qemu/iov.h"
#include "qemu/uuid.h"
#include "qmp-commands.h"
#include "qapi/error.h"
#include "qapi/qmp/qstring.h"
#include "crypto/secret.h"
#include "scsi/utils.h"
Expand Down
1 change: 1 addition & 0 deletions block/qapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "block/write-threshold.h"
#include "qmp-commands.h"
#include "qapi-visit.h"
#include "qapi/error.h"
#include "qapi/qobject-output-visitor.h"
#include "qapi/qmp/types.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 0 additions & 1 deletion block/qcow2-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "qemu/osdep.h"
#include <zlib.h>

#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "block/qcow2.h"
Expand Down
2 changes: 2 additions & 0 deletions block/qcow2.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "qemu/osdep.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
#include "qemu/module.h"
#include <zlib.h>
#include "block/qcow2.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/types.h"
Expand Down
1 change: 1 addition & 0 deletions block/quorum.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "block/block_int.h"
#include "qapi/error.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
Expand Down
2 changes: 1 addition & 1 deletion block/write-threshold.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include "block/write-threshold.h"
#include "qemu/notify.h"
#include "qapi-event.h"
#include "qapi/error.h"
#include "qmp-commands.h"


uint64_t bdrv_write_threshold_get(const BlockDriverState *bs)
{
return bs->write_threshold_offset;
Expand Down
1 change: 1 addition & 0 deletions blockdev-nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/block-backend.h"
#include "hw/block/block.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "sysemu/sysemu.h"
#include "qmp-commands.h"
Expand Down
1 change: 1 addition & 0 deletions blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "qemu/config-file.h"
#include "qapi/qmp/types.h"
#include "qapi-visit.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qobject-output-visitor.h"
#include "sysemu/sysemu.h"
Expand Down
1 change: 1 addition & 0 deletions blockjob.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "block/blockjob_int.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qjson.h"
#include "qemu/coroutine.h"
Expand Down
2 changes: 2 additions & 0 deletions chardev/char-ringbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "qemu/osdep.h"
#include "chardev/char.h"
#include "qmp-commands.h"
#include "qapi/error.h"
#include "qemu/base64.h"

/* Ring buffer chardev */
Expand Down
2 changes: 2 additions & 0 deletions chardev/char.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "monitor/monitor.h"
Expand All @@ -30,6 +31,7 @@
#include "chardev/char.h"
#include "qmp-commands.h"
#include "qapi-visit.h"
#include "qapi/error.h"
#include "sysemu/replay.h"
#include "qemu/help_option.h"

Expand Down
1 change: 1 addition & 0 deletions chardev/spice.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "trace.h"
#include "ui/qemu-spice.h"
#include "chardev/char.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include <spice.h>
#include <spice/protocol.h>
Expand Down
2 changes: 1 addition & 1 deletion cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
* THE SOFTWARE.
*/

/* Needed early for CONFIG_BSD etc. */
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/config-file.h"
#include "cpu.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
Expand Down
1 change: 0 additions & 1 deletion crypto/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "crypto/hash.h"
#include "hashpriv.h"

Expand Down
1 change: 0 additions & 1 deletion crypto/hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "crypto/hmac.h"
#include "hmacpriv.h"

Expand Down
1 change: 0 additions & 1 deletion crypto/ivgen-essiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/bswap.h"
#include "crypto/ivgen-essiv.h"

Expand Down
1 change: 0 additions & 1 deletion crypto/ivgen-plain.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/bswap.h"
#include "crypto/ivgen-plain.h"

Expand Down
1 change: 0 additions & 1 deletion crypto/ivgen-plain64.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/bswap.h"
#include "crypto/ivgen-plain.h"

Expand Down
1 change: 1 addition & 0 deletions crypto/random-gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "qemu/osdep.h"

#include "crypto/random.h"
#include "qapi/error.h"

#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
Expand Down
1 change: 1 addition & 0 deletions crypto/random-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "qemu/osdep.h"

#include "crypto/random.h"
#include "qapi/error.h"

#ifdef _WIN32
#include <wincrypt.h>
Expand Down
2 changes: 0 additions & 2 deletions docs/devel/qapi-code-gen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,6 @@ Example:
#include "example-qapi-types.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/dispatch.h"
#include "qapi/error.h"

void example_qmp_init_marshal(QmpCommandList *cmds);
UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp);
Expand Down Expand Up @@ -1263,7 +1262,6 @@ Example:
#ifndef EXAMPLE_QAPI_EVENT_H
#define EXAMPLE_QAPI_EVENT_H

#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
#include "example-qapi-types.h"

Expand Down
1 change: 1 addition & 0 deletions dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "sysemu/sysemu.h"
#include "sysemu/memory_mapping.h"
#include "sysemu/cpus.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qmp-commands.h"
#include "qapi-event.h"
Expand Down
1 change: 0 additions & 1 deletion fsdev/qemu-fsdev-throttle.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "block/aio.h"
#include "qemu/main-loop.h"
#include "qemu/coroutine.h"
#include "qapi/error.h"
#include "qemu/throttle.h"

typedef struct FsThrottle {
Expand Down
3 changes: 2 additions & 1 deletion fsdev/qemu-fsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-fsdev.h"
#include "qemu/queue.h"
#include "qemu-common.h"
Expand Down
1 change: 1 addition & 0 deletions hmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "qemu/sockets.h"
#include "monitor/monitor.h"
#include "monitor/qdev.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
#include "qapi/qmp/qerror.h"
#include "qapi/string-input-visitor.h"
Expand Down
2 changes: 1 addition & 1 deletion hw/9pfs/9p-local.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
*/

#include "qemu/osdep.h"
Expand All @@ -23,6 +22,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include "qemu/xattr.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include <libgen.h>
Expand Down
2 changes: 2 additions & 0 deletions hw/9pfs/9p-proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*/

#include "qemu/osdep.h"
#include <sys/socket.h>
#include <sys/un.h>
#include "9p.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "fsdev/qemu-fsdev.h"
Expand Down
1 change: 1 addition & 0 deletions hw/acpi/acpi-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qmp-commands.h"
#include "hw/acpi/acpi.h"
Expand Down
2 changes: 2 additions & 0 deletions hw/acpi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
* Contributions after 2012-01-13 are licensed under the terms of the
* GNU GPL, version 2 or (at your option) any later version.
*/

#include "qemu/osdep.h"
#include "sysemu/sysemu.h"
#include "hw/hw.h"
#include "hw/acpi/acpi.h"
#include "hw/nvram/fw_cfg.h"
#include "qemu/config-file.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
#include "qapi-visit.h"
#include "qapi-event.h"
Expand Down
1 change: 1 addition & 0 deletions hw/acpi/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "hw/qdev-core.h"
#include "trace.h"
#include "qapi-event.h"
#include "qapi/error.h"

#define MEMORY_SLOTS_NUMBER "MDNR"
#define MEMORY_HOTPLUG_IO_REGION "HPMR"
Expand Down
1 change: 1 addition & 0 deletions hw/acpi/vmgenid.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qmp-commands.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/aml-build.h"
Expand Down
1 change: 0 additions & 1 deletion hw/adc/stm32f2xx_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
#include "hw/hw.h"
#include "qapi/error.h"
#include "qemu/log.h"
#include "hw/adc/stm32f2xx_adc.h"

Expand Down
1 change: 0 additions & 1 deletion hw/char/mcf_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "hw/m68k/mcf.h"
#include "chardev/char-fe.h"
#include "exec/address-spaces.h"
#include "qapi/error.h"

typedef struct {
SysBusDevice parent_obj;
Expand Down
1 change: 1 addition & 0 deletions hw/char/virtio-console.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "trace.h"
#include "hw/virtio/virtio-serial.h"
#include "qapi-event.h"
#include "qapi/error.h"

#define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport"
#define VIRTIO_CONSOLE(obj) \
Expand Down
1 change: 1 addition & 0 deletions hw/core/qdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "qemu/osdep.h"
#include "hw/qdev.h"
#include "sysemu/sysemu.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qapi/visitor.h"
#include "qapi/qmp/qjson.h"
Expand Down
1 change: 1 addition & 0 deletions hw/display/milkymist-tmu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "trace.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qapi/error.h"

Expand Down
1 change: 1 addition & 0 deletions hw/display/qxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include <zlib.h>

#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/timer.h"
#include "qemu/queue.h"
Expand Down
Loading

0 comments on commit e688df6

Please sign in to comment.