[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] osdep: Make MIN/MAX evaluate arguments only once
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH v3] osdep: Make MIN/MAX evaluate arguments only once |
Date: |
Thu, 4 Jun 2020 20:39:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 03/06/20 21:26, Eric Blake wrote:
>
> Yes, I just tested; using "((void)0)" in place of
> "__builtin_unreachable()" has the same effect (no change to valid use,
> and still a compiler error on misuse). gcc:
>
> /home/eblake/qemu/qemu-img.c: In function ‘is_allocated_sectors’:
> /home/eblake/qemu/qemu-img.c:1225:15: error: void value not ignored as
> it ought to be
> 1225 | i = MIN_CONST(i, n);
> | ^
>
> clang:
>
> /home/eblake/qemu/qemu-img.c:1225:15: error: assigning to 'int' from
> incompatible type 'void'
> i = MIN_CONST(i, n);
> ^ ~~~~~~~~~~~~~~~
>
>
> Of course, a comment explaining the intent can't hurt either. I'll wait
> to see if this gathers any other comments before spinning a v4 with that
> change.
Please go ahead and send v4.
Thanks,
Paolo