From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrF1m-0006o8-B3 for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:28:34 -0400 Received: from [199.232.76.173] (port=50459 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrF1l-0006n8-Lf for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:28:33 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrF1k-0002CW-Hu for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:28:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31374) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrF1k-0002CR-2h for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:28:32 -0400 From: Markus Armbruster References: <4B9E7A29.1020902@redhat.com> Date: Mon, 15 Mar 2010 19:28:28 +0100 In-Reply-To: <4B9E7A29.1020902@redhat.com> (Paolo Bonzini's message of "Mon, 15 Mar 2010 19:19:21 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Blue Swirl , qemu-devel Paolo Bonzini writes: >>>> I sympathize with the general idea, but I don't like dead code >>> after abort(). What about cleaning that up? >>> >> Good idea, but it should be a separate patch. This patch is "safe", >> whereas the cleanup patch could cause problems if it's not done >> carefully. > > This patch is "safe", however I'd consider not changing > assert(0)->abort() if there is code after the assert that looks like > an attempt at recovering. Example: > > if (!p) { > printf ("the impossible has happened!"); > assert (0); > } > > return p->q; > > should be changed to abort, while > > if (!p) { > printf ("the impossible has happened!"); > assert (0); > return 0; > } > > return p->q; > > should not. Except when you find that the recovery attempt is insufficient, of course. Requires closer inspection.