codegen: Check wrong attribute

@ptr_array is supposed to change the destination to an array
of pointer to items. This for a raw buffer does not make sense
but check if user specifies this combination.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-02-18 03:22:02 +00:00
parent 7462c171e1
commit a5de31bc8a

View File

@ -810,6 +810,8 @@ def write_array_parser(writer, member, nelements, array, dest, scope):
at_end = True
if element_type == ptypes.uint8 or element_type == ptypes.int8:
if array.has_attr("ptr_array"):
raise Exception("Attribute ptr_array not supported for arrays of int8/uint8")
writer.statement("memcpy(%s, in, %s)" % (array_start, nelements))
writer.increment("in", nelements)
if at_end: