[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 00/25] VMState cleanups and conversion of networ
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] Re: [PATCH 00/25] VMState cleanups and conversion of network drivers |
Date: |
Tue, 20 Oct 2009 17:41:48 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 |
On 10/19/2009 09:15 PM, Jamie Lokier wrote:
__builtin_types_compatible_p(), __builtin_choose_exper and
__attribute__((__error__)) are good for informative error messages.
Unfortunately __attribute__((__error__)) cannot be applied in this case
for several reasons:
1) it cannot apply to types so you cannot do
extern void compile_error (void);
#define raise_compile_error(x) \
(((void __attribute__ ((error(x))) (*) (void)) x) ())
2) it only operates for calls, so you cannot use it in initializers
I whipped up a patch to add to GCC __builtin_compile_error, to be used
inside __builtin_choose_expr:
#define typecheck(t1, t2) \
__builtin_choose_expr (__builtin_types_compatible(t1, t2), (void)0, \
__builtin_compile_error (#t1 " and " #t2 \
"are not compatible types"))
#define if_types_compatible(t1, t2, value) (typecheck (t1, t2), value)
and I will send it upstream, but it will be a long time before it is in
a released version (especially since GCC is currently in bug-fixing-only
mode)---anyway Jamie got the array case to work, AFAIU.
Paolo
- [Qemu-devel] [PATCH 21/25] pcnet: port to vmstate, (continued)
- [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, 2009/10/19