diff options
| author | Peter Maydell | 2015-01-20 16:19:32 +0100 |
|---|---|---|
| committer | Peter Maydell | 2015-01-20 16:19:32 +0100 |
| commit | 83ecb22ba2c91a4674ae109595a8ed1da8de4d7a (patch) | |
| tree | 2491e3feb3edcaa258ba80ff1ee7585cfba538bb /include | |
| parent | Merge remote-tracking branch 'remotes/sstabellini/xen-2015-01-20-v2' into sta... (diff) | |
| download | qemu-83ecb22ba2c91a4674ae109595a8ed1da8de4d7a.tar.gz qemu-83ecb22ba2c91a4674ae109595a8ed1da8de4d7a.tar.xz qemu-83ecb22ba2c91a4674ae109595a8ed1da8de4d7a.zip | |
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
^
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1419359069-16611-1-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
