One of the next patches will among other things generate a separate typedef for some struct types, i.e.
typedef struct FOO FOO; struct FOO { ... }; instead of typedef struct FOO { ... } FOO; To make the generated files easier to diff, anticipate the change. Signed-off-by: Markus Armbruster <arm...@redhat.com> --- scripts/qapi-types.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index d162ca2..124a788 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -15,13 +15,15 @@ from qapi import * def generate_fwd_builtin(name): return mcgen(''' -typedef struct %(name)sList { +typedef struct %(name)sList %(name)sList; + +struct %(name)sList { union { %(type)s value; uint64_t padding; }; struct %(name)sList *next; -} %(name)sList; +}; ''', type=c_type(name), name=name) @@ -31,26 +33,30 @@ def generate_fwd_struct(name): typedef struct %(name)s %(name)s; -typedef struct %(name)sList { +typedef struct %(name)sList %(name)sList; + +struct %(name)sList { union { %(name)s *value; uint64_t padding; }; struct %(name)sList *next; -} %(name)sList; +}; ''', name=c_name(name)) def generate_fwd_enum_struct(name): return mcgen(''' -typedef struct %(name)sList { +typedef struct %(name)sList %(name)sList; + +struct %(name)sList { union { %(name)s value; uint64_t padding; }; struct %(name)sList *next; -} %(name)sList; +}; ''', name=c_name(name)) -- 2.4.3