From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrE0r-000133-Fg for qemu-devel@nongnu.org; Mon, 15 Mar 2010 13:23:33 -0400 Received: from [199.232.76.173] (port=56388 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrE0q-00012Y-Pl for qemu-devel@nongnu.org; Mon, 15 Mar 2010 13:23:32 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrE0q-0006dx-3A for qemu-devel@nongnu.org; Mon, 15 Mar 2010 13:23:32 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:34549) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrE0p-0006dn-Pn for qemu-devel@nongnu.org; Mon, 15 Mar 2010 13:23:31 -0400 Received: by pwi9 with SMTP id 9so1990284pwi.4 for ; Mon, 15 Mar 2010 10:23:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 15 Mar 2010 19:23:29 +0200 Message-ID: Subject: Re: [Qemu-devel] [PATCH, RFC] Replace assert(0) with abort() or cpu_abort() From: Blue Swirl Content-Type: text/plain; charset=UTF-8 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel On 3/15/10, Markus Armbruster wrote: > Blue Swirl writes: > > > When building with -DNDEBUG, assert(0) will not stop execution > > so it must not be used for abnormal termination. > > > For each case: are you sure the code does not recover after assert(0)? > Not saying it does, just asking whether you checked. I had not checked but did just now, QEMU system emulators do not handle SIGABRT. The situation is different for user emulator, but then assert(0) and abort() would be equally correct or incorrect. > > Use cpu_abort() when in CPU context, abort() otherwise. > > > 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.