From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MLPoz-0004FD-5L for mharc-grub-devel@gnu.org; Mon, 29 Jun 2009 18:59:33 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLPox-0004F8-Pn for grub-devel@gnu.org; Mon, 29 Jun 2009 18:59:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLPos-0004Es-B0 for grub-devel@gnu.org; Mon, 29 Jun 2009 18:59:30 -0400 Received: from [199.232.76.173] (port=33891 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLPos-0004Ep-5Q for grub-devel@gnu.org; Mon, 29 Jun 2009 18:59:26 -0400 Received: from c60.cesmail.net ([216.154.195.49]:7149) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MLPor-0007QO-KD for grub-devel@gnu.org; Mon, 29 Jun 2009 18:59:25 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 29 Jun 2009 18:59:24 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 5CD7C34C6D for ; Mon, 29 Jun 2009 19:06:36 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20090629134900.GC20463@thorin> References: <20090627121216.GA29067@thorin> <1246248556.22661.24.camel@mj> <20090629134900.GC20463@thorin> Content-Type: text/plain Date: Mon, 29 Jun 2009 18:59:22 -0400 Message-Id: <1246316362.15956.63.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 (2.26.2-1.fc11) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] export -boot parameter as qemu_boot{0,1,2} X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 22:59:32 -0000 On Mon, 2009-06-29 at 15:49 +0200, Robert Millan wrote: > > Use of a nested function seems totally unwarranted. > > I did it to make the code more readable. Declaring functions that will > be used locally inside their scope improves code clarity and prevents > mistakes (like attempting to run them from somewhere else). However, they are not widely used. In GRUB, nested functions are used to allow passing them as callbacks that can access local variables of the containing function. There is a problem associates with nested functions. Some versions of gcc miscompile them with -mregparm=3. Arguments other than the first one are not passed correctly. There was a test in configure.ac, but it turned out to be wrong, so we are always specifying __attribute__((__regparm__(1))) for nested functions taking more than one argument on i386 (kernel code only). Just look for NESTED_FUNC_ATTR to see what I mean. We had several bugs because NESTED_FUNC_ATTR wasn't used consistently. I don't know if NESTED_FUNC_ATTR is needed in your case, or it's only needed when the function is passed as an argument. In any case, I think it's an overkill for the problem you are solving. > > We actually agreed > > a while ago that they are bad, but nobody had time to remove them. > > I didn't participate in that discussion. Did Marco and Okuji agree with this? They didn't participate. -- Regards, Pavel Roskin