diff mbox

[RFC,v4,06/32] qapi: Split up some typedefs to ease review

Message ID 1441290623-13631-7-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Sept. 3, 2015, 2:29 p.m. UTC
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 <armbru@redhat.com>
---
 scripts/qapi-types.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

Daniel P. Berrangé Sept. 3, 2015, 4:19 p.m. UTC | #1
On Thu, Sep 03, 2015 at 04:29:57PM +0200, Markus Armbruster wrote:
> 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 <armbru@redhat.com>

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Regards,
Daniel
diff mbox

Patch

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))