[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 6/9] eepro100: Support compilation without EEPRO
From: |
Stefan Weil |
Subject: |
Re: [Qemu-devel] [PATCH 6/9] eepro100: Support compilation without EEPROM |
Date: |
Tue, 06 Apr 2010 18:01:07 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090707) |
Richard Henderson schrieb:
> On 04/06/2010 04:44 AM, Stefan Weil wrote:
>
>> +#if EEPROM_SIZE > 0
>> /* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM,
>> * i82559 and later support 64 or 256 word EEPROM. */
>> s->eeprom = eeprom93xx_new(EEPROM_SIZE);
>> +#endif
>>
>
> If EEPROM_SIZE is known to be defined, even if zero, it is
> better to write this as a C if, not a preprocessor ifdef.
> Let the compiler eliminate the dead code for you.
>
>
> r~
>
Why do you think that a C if is better than a CPP if
in this case?
Some compilers give warnings for code which will
never be reached. Try gcc -Wunreachable-code.
It's a really useful option which sometimes even
detects programming errors, so maybe it would
be good for qemu, too.
Stefan
[Qemu-devel] [PATCH 5/9] eepro100: Set configuration bit for standard TCB, Stefan Weil, 2010/04/06
[Qemu-devel] [PATCH 7/9] eepro100: Set power management capability using pci_reserve_capability, Stefan Weil, 2010/04/06
[Qemu-devel] [PATCH 8/9] eepro100: Fix mapping of flash memory, Stefan Weil, 2010/04/06