From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5xQN-0006Mu-J2 for qemu-devel@nongnu.org; Fri, 19 Jun 2015 10:37:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5xQJ-0004rs-Dl for qemu-devel@nongnu.org; Fri, 19 Jun 2015 10:37:43 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:40121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5xQJ-0004rb-4A for qemu-devel@nongnu.org; Fri, 19 Jun 2015 10:37:39 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Jun 2015 15:37:37 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 256131B08067 for ; Fri, 19 Jun 2015 15:38:37 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t5JEbZMD20644064 for ; Fri, 19 Jun 2015 14:37:35 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t5JEbYjZ017606 for ; Fri, 19 Jun 2015 08:37:35 -0600 Date: Fri, 19 Jun 2015 16:37:31 +0200 From: Greg Kurz Message-ID: <20150619163731.5610c28c@bahia.local> In-Reply-To: <20150619160502-mutt-send-email-mst@redhat.com> References: <20150619095853.12531.15450.stgit@bahia.huguette.org> <20150619120638-mutt-send-email-mst@redhat.com> <20150619121512-mutt-send-email-mst@redhat.com> <878ubgq85e.fsf@blackfin.pond.sub.org> <20150619153555-mutt-send-email-mst@redhat.com> <87oakbkdcq.fsf@blackfin.pond.sub.org> <20150619160502-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vhost_net: fix misuse of assert() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Peter Maydell , Markus Armbruster , QEMU Developers On Fri, 19 Jun 2015 16:06:04 +0200 "Michael S. Tsirkin" wrote: > On Fri, Jun 19, 2015 at 04:00:05PM +0200, Markus Armbruster wrote: > > "Michael S. Tsirkin" writes: > > > > > On Fri, Jun 19, 2015 at 12:55:57PM +0200, Markus Armbruster wrote: > > >> "Michael S. Tsirkin" writes: > > >> > > >> > On Fri, Jun 19, 2015 at 11:13:40AM +0100, Peter Maydell wrote: > > >> >> On 19 June 2015 at 11:07, Michael S. Tsirkin wrote: > > >> >> > On Fri, Jun 19, 2015 at 12:00:53PM +0200, Greg Kurz wrote: > > >> >> >> In case NDEBUG is defined, assert() expands to nothing and > > >> >> >> vhost_net_set_vnet_endian() doesn't get called... > > >> >> >> > > >> >> >> Suggested-by: Thomas Huth > > >> >> >> Signed-off-by: Greg Kurz > > >> >> > > > >> >> > Not sure what the point is. > > >> >> > We don't support building with NDEBUG. > > >> >> > > >> >> Putting functional behaviour inside an assert() is still a really > > >> >> bad idea. If you're reading the code you probably skim over the > > >> >> assert() as not functionally relevant... > > >> >> > > >> >> -- PMM > > >> > > > >> > I can apply this if commit log explains it's a readability > > >> > enhancement, not a bugfix. > > >> > > >> Easy: > > >> > > >> vhost_net: fix misuse of assert() > > >> > > >> In case NDEBUG is defined, assert() expands to nothing and > > >> vhost_net_set_vnet_endian() doesn't get called... > > >> > > >> Suggested-by: Thomas Huth > > >> Signed-off-by: Greg Kurz > > >> > > >> We don't support building with NDEBUG, but putting functional behaviour > > >> inside an assert() is still a really bad idea. If you're reading the > > >> code you probably skim over the assert() as not functionally relevant... > > >> > > >> Signed-off-by: Michael S. Tsirkin" > > > > > > Pls submit v2 in the regular format - I can rewrite the commit log > > > but prefer not to, as it doesn't scale. There's no need to add my > > > signature though, git am -s does this automatically. > > > > I *hate* it when maintainers rewrite my commit message, then claim it's > > mine :) > > > > But that's not what I suggested! I suggested to append the additional > > explanation you want after Greg's S-o-B. Makes it obvious that it's > > yours. > > Well both the subject and the original commit log are irrelevant IMO: > why mention NDEBUG when we don't support it? So it's not really > a misuse. > Hmmm... I got obviously un-Cc'd from this thread at some point... but anyway I've sent a v2 with a more comprehensive log. The subject stays the same though: putting relevant code in assert() is wrong, even from a code reading POV. > > I think that scales just fine in a simple case like this where you > > already know the explanation. >