From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NzBDL-0005Xu-GJ for qemu-devel@nongnu.org; Tue, 06 Apr 2010 12:01:19 -0400 Received: from [140.186.70.92] (port=59030 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzBDI-0005Ww-FN for qemu-devel@nongnu.org; Tue, 06 Apr 2010 12:01:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NzBDH-0003tJ-5N for qemu-devel@nongnu.org; Tue, 06 Apr 2010 12:01:16 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:65155) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzBDG-0003sx-BX for qemu-devel@nongnu.org; Tue, 06 Apr 2010 12:01:15 -0400 Message-ID: <4BBB5AC3.7080404@mail.berlios.de> Date: Tue, 06 Apr 2010 18:01:07 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 6/9] eepro100: Support compilation without EEPROM References: <1270554249-24861-1-git-send-email-weil@mail.berlios.de> <1270554249-24861-7-git-send-email-weil@mail.berlios.de> <4BBB56EE.7080203@twiddle.net> In-Reply-To: <4BBB56EE.7080203@twiddle.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: QEMU Developers , "Michael S. Tsirkin" 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