unicorn/qemu/scripts
Peter Maydell 9a3972b6b2
scripts/qapi-types.py: Add dummy member to empty structs
Make sure that all generated C structs have at least one field; this
avoids potential issues with attempting to malloc space for
zero-length structs in C (g_malloc(sizeof struct) would return NULL).
It also avoids an incompatibility with C++ (where an empty struct is
size 1); that isn't important to us now but might be in future.

Generated empty structures look like this:
    struct Abort
    {
        char qapi_dummy_field_for_empty_struct;
    };

This silences clang warnings like:
./qapi-types.h:3752:1: warning: empty struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
struct Abort
^

Backports commit 83ecb22ba2c91a4674ae109595a8ed1da8de4d7a from qemu
2018-02-19 15:56:31 -05:00
..
create_config more cleanup qemu/configure 2017-01-19 14:11:54 +08:00
make_device_config.sh fix file perms 2015-08-28 21:05:38 -07:00
ordereddict.py import 2015-08-21 15:04:50 +08:00
qapi-event.py qapi: Factor open_output(), close_output() out of generators 2018-02-19 15:32:28 -05:00
qapi-types.py scripts/qapi-types.py: Add dummy member to empty structs 2018-02-19 15:56:31 -05:00
qapi-visit.py qapi: Factor open_output(), close_output() out of generators 2018-02-19 15:32:28 -05:00
qapi.py qapi: Catch and reject flat union branch of array type 2018-02-19 15:48:12 -05:00