From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40203 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzDae-0004Rp-QR for qemu-devel@nongnu.org; Mon, 14 Mar 2011 15:38:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzDaW-0006g8-S5 for qemu-devel@nongnu.org; Mon, 14 Mar 2011 15:37:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzDaW-0006fw-Jm for qemu-devel@nongnu.org; Mon, 14 Mar 2011 15:37:56 -0400 Date: Mon, 14 Mar 2011 16:37:47 -0300 From: Luiz Capitulino Subject: Re: [Qemu-devel] Re: [PATCH 02/11] qerror: expose a function to format an error Message-ID: <20110314163747.77392d06@doriath> In-Reply-To: <4D7E6C22.8010102@codemonkey.ws> References: <1299877249-13433-1-git-send-email-aliguori@us.ibm.com> <1299877249-13433-3-git-send-email-aliguori@us.ibm.com> <4D7A8F56.2080703@us.ibm.com> <20110314161728.36c3ca7e@doriath> <4D7E6C22.8010102@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org, Michael Roth , Markus Armbruster On Mon, 14 Mar 2011 14:27:30 -0500 Anthony Liguori wrote: > On 03/14/2011 02:17 PM, Luiz Capitulino wrote: > > On Fri, 11 Mar 2011 15:08:38 -0600 > > Anthony Liguori wrote: > > > >> On 03/11/2011 03:00 PM, Anthony Liguori wrote: > >>> This will let Error share the QError human formatting. This is only used for > >>> HMP. > >>> > >>> Signed-off-by: Anthony Liguori > >>> > >>> diff --git a/qerror.c b/qerror.c > >>> index 4855604..13d53c9 100644 > >>> --- a/qerror.c > >>> +++ b/qerror.c > >>> @@ -326,12 +326,18 @@ QError *qerror_from_info(const char *file, int linenr, const char *func, > >>> return qerr; > >>> } > >>> > >>> -static void parse_error(const QError *qerror, int c) > >>> +static void parse_error(const QErrorStringTable *entry, int c) > >>> { > >>> - qerror_abort(qerror, "expected '%c' in '%s'", c, qerror->entry->desc); > >>> +#if 0 > >>> + qerror_abort(qerror, "expected '%c' in '%s'", c, entry->desc); > >>> +#else > >>> + fprintf(stderr, "expected '%c' in '%s'", c, entry->desc); > >>> + abort(); > >>> +#endif > >>> } > >> Err, I shouldn't have left these #if 0's in here. Please ignore them. > > But you're going to keep qerror_abort() usage, right? > > No, qerror_abort() needs to go away. > > It's too tied to QError and this patch is making the formatting code > work outside of of QEMU. qerror_abort() only exists for debugging purposes. I won't say its perfect, but it's better than nothing and has already saved some time when writing new errors. I'm fine dropping it as long as there's a better replacement, which is not the case here. There's even a hunk that replaces qerror_abort() for a plain abort(). > Once this whole series is completely merged, QError goes away entirely > and this pretty formatting is replaced with something much simpler. > > Regards, > > Anthony Liguori >