[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 00/25] VMState cleanups and conversion of networ
From: |
Jamie Lokier |
Subject: |
Re: [Qemu-devel] [PATCH 00/25] VMState cleanups and conversion of network drivers |
Date: |
Mon, 19 Oct 2009 20:15:04 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Juan Quintela wrote:
> * add VARRAY_UINT16_UNSAFE: unsafe here means that type checking is off
> (a.k.a. as a cast in C). In this case the problem is that the last
> element of one struct is int foo[0], and we allocate the right size
> for the array we want. Problem? I haven't been able to abuse^Wuse
> gcc + cpp + magic to typecheck that for vmstate:
>
> We have
> struct FOO {
> int32_t foo[0];
> }
> We want to "compare the type of foo (t1) with int32_t (t2)
>
> ((t1(*)[n])0 - (t2*)0)
> This one don't work, because we don't have 'n'
> ((t1(**))0 - (t2*)0)
> This don't work either because t1 is one array.
> ((t1(*)[])0 - (t2*)0)
> Too clever, imposible cast to on array type.
> I tried some other variants, but have not able to get one that compiles.
Since you mention GCC, is it ok to use GCC extensions? __typeof__(t1)
often does the trick for this sort of thing where t1 alone does not
compile, even if t1 is a type.
__builtin_types_compatible_p(), __builtin_choose_exper and
__attribute__((__error__)) are good for informative error messages.
-- Jamie
- [Qemu-devel] [PATCH 14/25] vmstate: Add version arg to VMSTATE_SINGLE_TEST(), (continued)
- [Qemu-devel] [PATCH 14/25] vmstate: Add version arg to VMSTATE_SINGLE_TEST(), Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 16/25] vmstate: Introduce the concept of sub-arrays, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 19/25] eeprom93xx: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 21/25] pcnet: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 18/25] rtl8139: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 22/25] ne2000: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 20/25] eepro100: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 24/25] e1000: unfold mac_regarraystosave array, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 23/25] e1000: unfold mac_reg_tosave array, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 25/25] e1000: port to vmstate, Juan Quintela, 2009/10/19
- Re: [Qemu-devel] [PATCH 00/25] VMState cleanups and conversion of network drivers,
Jamie Lokier <=