Received: from eggs.gnu.org ([2001:4830:134:3::10]:34508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSheR-0006jR-0A for qemu-devel@nongnu.org; Mon, 08 Feb 2016 03:58:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSheN-00014W-Px for qemu-devel@nongnu.org; Mon, 08 Feb 2016 03:58:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSheN-00014S-IA for qemu-devel@nongnu.org; Mon, 08 Feb 2016 03:58:27 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 08C645A6F for ; Mon, 8 Feb 2016 08:58:25 +0000 (UTC) From: Markus Armbruster References: <1454522628-28294-1-git-send-email-armbru@redhat.com> <87egct8uy9.fsf@fimbulvetr.bsc.es> <87io25f0ba.fsf@blackfin.pond.sub.org> <87r3gs7hi9.fsf@fimbulvetr.bsc.es> <87fux7d1ls.fsf@blackfin.pond.sub.org> <87twln1d9w.fsf@fimbulvetr.bsc.es> Date: Mon, 08 Feb 2016 09:58:23 +0100 In-Reply-To: <87twln1d9w.fsf@fimbulvetr.bsc.es> (=?utf-8?Q?=22Llu=C3=ADs?= Vilanova"'s message of "Fri, 05 Feb 2016 14:45:47 +0100") Message-ID: <87lh6v7f4g.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 0/2] error: Documentation updates List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: thuth@redhat.com, dgilbert@redhat.com Llu=C3=ADs Vilanova writes: > Markus Armbruster writes: > >> Llu=C3=ADs Vilanova writes: >>> Markus Armbruster writes: >>>=20 >>>> Llu=C3=ADs Vilanova writes: >>>>> Markus Armbruster writes: >>>>>=20 >>>>>> This overlaps with parts of Llu=C3=ADs's "[RFC][PATCH v6 0/5] utils: >>>>>> Improve and document error reporting". Llu=C3=ADs, feel free to int= egrate >>>>>> my patches into a respin of your series. You can also respin on top >>>>>> of my series. >>>>>=20 >>>>> Reviewed-by: Llu=C3=ADs Vilanova >>>>>=20 >>>>> I'm happy with this series as a replacement for mine. Two nitpicks: >>>>>=20 >>>>> * The error.h comments point to assert() instead of abort() as a repl= acement for >>>>> error_setg(&error_abort) (while your HACKING says otherwise). >>>=20 >>>> Where? >>>=20 >>> Documentation on error_setg() (last phrase) vs HACKING (also last phras= e). > >> Got it. error_setg()'s comment: > >> Likewise, don't error_setg(&error_abort, ...), use assert(). > >> This is advice on what to do. > >> HACKING: > >> Note that &error_fatal is just another way to exit(1), and >> &error_abort is just another way to abort(). > >> This tries to extend the admonition on exit() and abort() to >> &error_fatal and &error_abort. I'm open for better ways to word it. >> However, I feel this section of HACKING should not go into detail on >> what to do, but leave that to error.h. > > Right. I just wanted to say the error.h comment should be: > > Likewise, don't error_setg(&error_abort, ...), use abort(). > > To be consistent with HACKING (which implies the equivalent for error_abo= rt is > abort()). But that's just me thinking that assert will be omitted when ND= EBUG is > defined :) In my opinion, the error.h comment should point to assert(), not abort(), because &error_abort and assert() both print information on the error location, while abort() doesn't. I *want* people to use assert(). But I'd rather not explain all that in HACKING, to avoid getting bogged down in detail there. Feel free to suggest a wording that improves consistency without getting too far into the weeds. HACKING doesn't say &error_abort is *equivalent* to abort(), it says "&error_abort is just another way to abort()". That's true for assert(), too. Except assert() comes with a compile time switch we don't use. Heh, just found this gem in hw/virtio/virtio.c: #ifdef NDEBUG #error building with NDEBUG is not supported #endif At least it got a suitable TODO comment. > As a side note (just an observation), it seems that NDEBUG is only select= ively > (and manually) defined in some files like "tcg/tcg.c", so it's not consis= tently > affecting files (e.g., it's used as a shorter substitute of "#ifdef > CONFIG_DEBUG_TCG", but it's not acting like a "real" NDEBUG; aka assert w= ill > still work *iff* it's included before defining NDEBUG, which is not clear= at > all). I can see two instances (tci.c tcg/tcg.c), and both look like this: #if !defined(CONFIG_DEBUG_TCG) && !defined(NDEBUG) # define NDEBUG #endif They make switching off CONFIG_DEBUG_TCG switch off assertions as well. Feels odd to me, but I'm not familiar with these two files. [...]