include/qemu/osdep.h: Don't include qapi/error.h

Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.

Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.

Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.

This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.

Backports commit da34e65cb4025728566d6504a99916f6e7e1dd6a from qemu
This commit is contained in:
Markus Armbruster 2018-02-21 23:05:15 -05:00 committed by Lioncash
parent baa477d324
commit 06668850e3
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
32 changed files with 40 additions and 7 deletions

View file

@ -19,6 +19,7 @@
/* Modified for Unicorn Engine by Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#ifndef _WIN32
#include <sys/mman.h>
#endif

View file

@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/arm/arm.h"
#include "hw/boards.h"

View file

@ -32,6 +32,7 @@
/* By Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "hw/arm/arm.h"
#include "hw/boards.h"

View file

@ -10,7 +10,9 @@
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "hw/boards.h"
#include "qapi/error.h"
static void machine_initfn(struct uc_struct *uc, Object *obj, void *opaque)
{

View file

@ -18,6 +18,7 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/i386/apic.h"
#include "hw/i386/apic_internal.h"
#include "hw/qdev.h"

View file

@ -11,6 +11,8 @@
/* Unicorn Emulator Engine */
/* By Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/mips/mips.h"
#include "hw/mips/cpudevs.h"

View file

@ -25,6 +25,8 @@
/* Unicorn Emulator Engine */
/* By Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/sparc/sparc.h"
#include "qemu/timer.h"

View file

@ -21,6 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/sparc/sparc.h"
#include "qemu/timer.h"

View file

@ -112,11 +112,6 @@
#include "qapi-types.h"
#include "unicorn/platform.h"
/**
* Opaque error object.
*/
typedef struct Error Error;
/*
* Overall category of an error.
* Based on the qapi type QapiErrorClass, but reproduced here for nicer

View file

@ -7,8 +7,10 @@
*
* To avoid getting into possible circular include dependencies, this
* file should not include any other QEMU headers, with the exceptions
* of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which
* are doing a similar job to this file and are under similar constraints.
* of config-host.h, config-target.h, qemu/compiler.h,
* sysemu/os-posix.h, sysemu/os-win32.h, glib-compat.h and
* qemu/typedefs.h, all of which are doing a similar job to this file
* and are under similar constraints.
*
* This header also contains prototypes for functions defined in
* os-*.c and util/oslib-*.c; those would probably be better split
@ -86,6 +88,8 @@
#include "glib_compat.h"
#include "qemu/typedefs.h"
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif

View file

@ -22,6 +22,7 @@ typedef struct DisplayChangeListener DisplayChangeListener;
typedef struct DisplayState DisplayState;
typedef struct DisplaySurface DisplaySurface;
typedef struct DriveInfo DriveInfo;
typedef struct Error Error;
typedef struct EventNotifier EventNotifier;
typedef struct FWCfgState FWCfgState;
typedef struct HCIInfo HCIInfo;

View file

@ -16,6 +16,7 @@
#include "glib_compat.h"
#include "unicorn/platform.h"
#include "qapi-types.h"
#include "qemu/queue.h"
#include "qemu/typedefs.h"
#include "qapi/error.h"

View file

@ -16,6 +16,7 @@
/* Modified for Unicorn Engine by Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "exec/memory.h"
#include "exec/address-spaces.h"

View file

@ -14,6 +14,7 @@
/* Modified for Unicorn Engine by Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "glib_compat.h"
#include "qemu-common.h"

View file

@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/dealloc-visitor.h"
#include "qemu/queue.h"
#include "qemu-common.h"

View file

@ -14,6 +14,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qapi/qmp/qobject.h"
#include "qapi/qmp/qerror.h"

View file

@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/qmp-input-visitor.h"
#include "qapi/visitor-impl.h"
#include "qemu/queue.h"

View file

@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/qmp-output-visitor.h"
#include "qapi/visitor-impl.h"
#include "qemu/queue.h"

View file

@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qapi/string-input-visitor.h"
#include "qapi/visitor-impl.h"

View file

@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/log.h"
#include "uc_priv.h"

View file

@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qom/object.h"
#include "qemu-common.h"
#include "qapi/visitor.h"

View file

@ -10,6 +10,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qom/object.h"
#include "qom/qom-qobject.h"

View file

@ -360,6 +360,7 @@ h_comment = '''
fdef.write(mcgen('''
#include "qemu-common.h"
#include "qapi/error.h"
#include "%(prefix)sqapi-visit.h"
''',
prefix=prefix))

View file

@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "cpu.h"
#include "internals.h"
#include "qemu-common.h"

View file

@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "cpu.h"
#include "qemu-common.h"
#include "hw/arm/arm.h"

View file

@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "unicorn/platform.h"
#include "cpu.h"

View file

@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/m68k/m68k.h"
#include "cpu.h"
#include "qemu-common.h"

View file

@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "cpu.h"
#include "qemu-common.h"
#include "hw/mips/mips.h"

View file

@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "cpu.h"
#include "hw/sparc/sparc.h"

View file

@ -13,6 +13,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qapi/error.h"

View file

@ -40,6 +40,7 @@
#define HUGETLBFS_MAGIC 0x958458f6
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "unicorn/platform.h"
#include "sysemu/sysemu.h"
#include <sys/mman.h>

View file

@ -27,6 +27,7 @@
*
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include <winsock2.h>
#include <windows.h>