mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-08-07 17:43:58 +00:00
codegen: Add a check for C structure fields
This check make sure that output fields for member with @end (arrays) are declared as empty arrays in output C structure. This avoids output fields to be declared as pointer or other invalid types. The check is a compile time check so no code in object file is generated. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
This commit is contained in:
parent
493475e012
commit
c392a7fee7
@ -805,6 +805,9 @@ def write_array_parser(writer, member, nelements, array, dest, scope):
|
||||
if member:
|
||||
array_start = dest.get_ref(member.name)
|
||||
at_end = member.has_end_attr()
|
||||
# the field is supposed to be a [0] array, check it
|
||||
if at_end:
|
||||
writer.statement('verify(sizeof(%s) == 0)' % array_start)
|
||||
else:
|
||||
array_start = "end"
|
||||
at_end = True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user