Received: from eggs.gnu.org ([2001:4830:134:3::10]:57411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSoTZ-0006b0-Rx for qemu-devel@nongnu.org; Mon, 08 Feb 2016 11:15:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSoTV-0002VA-3A for qemu-devel@nongnu.org; Mon, 08 Feb 2016 11:15:45 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:44784 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSoTU-0002Us-FU for qemu-devel@nongnu.org; Mon, 08 Feb 2016 11:15:40 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= 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> <87lh6v7f4g.fsf@blackfin.pond.sub.org> Date: Mon, 08 Feb 2016 17:15:37 +0100 In-Reply-To: <87lh6v7f4g.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Mon, 08 Feb 2016 09:58:23 +0100") Message-ID: <87pow7qity.fsf@fimbulvetr.bsc.es> 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: Markus Armbruster Cc: thuth@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com Markus Armbruster writes: > Llu=C3=ADs Vilanova writes: >> Markus Armbruster writes: >>=20 >>> 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 in= tegrate >>>>>>> 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 rep= lacement for >>>>>> error_setg(&error_abort) (while your HACKING says otherwise). >>>>=20 >>>>> Where? >>>>=20 >>>> Documentation on error_setg() (last phrase) vs HACKING (also last phra= se). >>=20 >>> Got it. error_setg()'s comment: >>=20 >>> Likewise, don't error_setg(&error_abort, ...), use assert(). >>=20 >>> This is advice on what to do. >>=20 >>> HACKING: >>=20 >>> Note that &error_fatal is just another way to exit(1), and >>> &error_abort is just another way to abort(). >>=20 >>> 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. >>=20 >> Right. I just wanted to say the error.h comment should be: >>=20 >> Likewise, don't error_setg(&error_abort, ...), use abort(). >>=20 >> To be consistent with HACKING (which implies the equivalent for error_ab= ort is >> abort()). But that's just me thinking that assert will be omitted when N= DEBUG 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. Well, now that I think of it, assert() uses abort() underneath, so they're equivalent on that sense (not that I thought of it initially). HACKING: Note that &error_fatal is just another way to exit(1), and &error_abort= is just another way to terminate QEMU like abort() or assert(). Also, are we all aware that messages from abort() won't be redirected to the monitor? (error_setg, error_report and so redirect appropriately). Just che= cking if it makes sense to redirect them. BTW, either way, I'm fine if you push this into upstream. [...] >> As a side note (just an observation), it seems that NDEBUG is only selec= tively >> (and manually) defined in some files like "tcg/tcg.c", so it's not consi= stently >> 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 = will >> still work *iff* it's included before defining NDEBUG, which is not clea= r 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. That's the case now, since assert.h is never directly (or indirectly) inclu= ded before the define. But it looks fragile to me; it's very easy to add an inc= lude before that define. Cheers, Lluis