From bb1f47545c11953b57a6ce810f85f957af8d8251 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 18 Nov 2019 16:37:19 -0500 Subject: [PATCH] typedefs: Separate incomplete types and function types While there, rewrite the obsolete file comment. Backports commit 2a28720d773df2193c9fb633c02092cca107a9e5 from qemu --- qemu/include/qemu/typedefs.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/qemu/include/qemu/typedefs.h b/qemu/include/qemu/typedefs.h index 671dbf78..e5966b98 100644 --- a/qemu/include/qemu/typedefs.h +++ b/qemu/include/qemu/typedefs.h @@ -1,10 +1,27 @@ #ifndef QEMU_TYPEDEFS_H #define QEMU_TYPEDEFS_H -/* A load of opaque types so that device init declarations don't have to - pull in all the real definitions. */ +/* + * This header is for selectively avoiding #include just to get a + * typedef name. + * + * Declaring a typedef name in its "obvious" place can result in + * inclusion cycles, in particular for complete struct and union + * types that need more types for their members. It can also result + * in headers pulling in many more headers, slowing down builds. + * + * You can break such cycles and unwanted dependencies by declaring + * the typedef name here. + * + * For struct types used in only a few headers, judicious use of the + * struct tag instead of the typedef name is commonly preferable. + */ + +/* + * Incomplete struct types + * Please keep this list in case-insensitive alphabetical order. + */ -/* Please keep this list in alphabetical order */ typedef struct AdapterInfo AdapterInfo; typedef struct AddressSpace AddressSpace; typedef struct AioContext AioContext; @@ -86,4 +103,8 @@ typedef struct VirtIODevice VirtIODevice; typedef struct Visitor Visitor; typedef struct uWireSlave uWireSlave; +/* + * Function types + */ + #endif /* QEMU_TYPEDEFS_H */