From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MghnM-0006fP-CT for qemu-devel@nongnu.org; Thu, 27 Aug 2009 12:25:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MghnI-0006cN-Pr for qemu-devel@nongnu.org; Thu, 27 Aug 2009 12:25:52 -0400 Received: from [199.232.76.173] (port=51268 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MghnI-0006cI-MQ for qemu-devel@nongnu.org; Thu, 27 Aug 2009 12:25:48 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:52913) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MghnH-0004EK-Rn for qemu-devel@nongnu.org; Thu, 27 Aug 2009 12:25:48 -0400 Received: from localhost ([127.0.0.1] ident=stefan) by flocke.weilnetz.de with esmtp (Exim 4.69) (envelope-from ) id 1MghnE-0002TX-GZ for qemu-devel@nongnu.org; Thu, 27 Aug 2009 18:25:44 +0200 Message-ID: <4A96B388.1070309@mail.berlios.de> Date: Thu, 27 Aug 2009 18:25:44 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Remove typedef for bool from eepro100.c References: <1251376284-22426-1-git-send-email-amit.shah@redhat.com> <20090827124546.GA5912@1und1.de> In-Reply-To: <20090827124546.GA5912@1und1.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Reimar Döffinger schrieb: > On Thu, Aug 27, 2009 at 06:01:24PM +0530, Amit Shah wrote: > >> eepro100.c shouldn't have the need to do this in its local header file. >> >> And I recently started getting this: >> >> $ make -j3 >> ... >> CC x86_64-softmmu/eepro100.o >> /home/amit/src/qemu/hw/eepro100.c:112: error: two or more data types >> in declaration specifiers >> /home/amit/src/qemu/hw/eepro100.c:112: warning: useless type name in >> empty declaration >> make[1]: *** [eepro100.o] Error 1 >> >> so just remove the typedef and include instead. >> >> Signed-off-by: Amit Shah >> --- >> hw/eepro100.c | 3 +-- >> 1 files changed, 1 insertions(+), 2 deletions(-) >> >> diff --git a/hw/eepro100.c b/hw/eepro100.c >> index 8988b3f..0634f8c 100644 >> --- a/hw/eepro100.c >> +++ b/hw/eepro100.c >> @@ -38,6 +38,7 @@ >> #endif >> >> #include /* offsetof */ >> +#include >> #include "hw.h" >> #include "pci.h" >> #include "net.h" >> @@ -109,8 +110,6 @@ >> #define INT_MASK 0x0100 >> #define DRVR_INT 0x0200 /* Driver generated interrupt. */ >> >> -typedef unsigned char bool; >> - >> > I doubt it matters much, but > 1) stdbool bool is probably 4 bytes, not just 1 like char > This is no problem in eepro100.c > 2) all assignments to bool variable are converted to 0/1 which could > make a speed difference (not here since the code actually does that > explicitly). > Only C++ compilers do convert bool assignments to false / true. > 3) is stdbool.h available everywhere where qemu is supposed to compile? > Yes. nbd.h uses it for more than a year now. > I suggest to just get rid of bool in this file, it is only used in 5 > places, i.e. change > >> bool bit_el = ((command & 0x8000) != 0); >> > to > >> int bit_el = command & 0x8000; >> > > This would be possible, but I like my code as it is (as long as it is not wrong) :-) and prefer to keep bool. Using stdbool.h as suggested by the patch is ok (only a small hint: I prefer to sort standard includes alphabetically if there are no special reasons against this sorting. Sorting additional lines instead of adding them to the end also reduces merge conflicts). Regards Stefan