From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab36E-0002CS-My for qemu-devel@nongnu.org; Wed, 02 Mar 2016 04:29:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ab36B-00012t-FI for qemu-devel@nongnu.org; Wed, 02 Mar 2016 04:29:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab36B-00012p-9Z for qemu-devel@nongnu.org; Wed, 02 Mar 2016 04:29:39 -0500 From: Markus Armbruster References: <6FDF78F9-D147-4239-9B8E-CAB1417369AA@gmail.com> <56D622BC.6090600@redhat.com> <296156E0-31D8-4612-B3B7-AB93093353D3@gmail.com> <56D632F7.7000500@redhat.com> <5F294002-672A-4E4D-948F-39070F53F063@gmail.com> <56D64C9B.6060305@redhat.com> Date: Wed, 02 Mar 2016 10:29:36 +0100 In-Reply-To: <56D64C9B.6060305@redhat.com> (Eric Blake's message of "Tue, 1 Mar 2016 19:14:51 -0700") Message-ID: <87si09qlbz.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Replace pc/xt keyboard keycode array with QKeyCode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Programmingkid , qemu-devel qemu-devel , Peter Maydell Eric Blake writes: > On 03/01/2016 06:20 PM, Programmingkid wrote: > >>> You weren't the original cause of the bug, so it is not necessarily this >>> patch's job to fix the bug. Therefore, "pre-existing". But since the >>> bug was observed during review of your patch, you may want to fix it >>> anyways, probably as a separate patch. >> >> So you want this: >> >> if (ARRAY_SIZE(macToQKeyCodeMap) <= keycode) { >> error_report("(cocoa) warning unknown keycode 0x%x\n", keycode); > > Or something similar. Yes, error_report() is better than fprintf. But > error_report() is only good if you are directly interacting with the > user; if this code can be reached via a QMP monitor command, it would be > better to adjust signatures and propagate an Error **errp back to the > caller, so that the caller knows how best to report it. An error that makes a QMP command fail must be propagated to the QMP core with Error objects. To find out how, study the big comment in error.h, and the copious examples in the code. Reporting such errors with error_report(), fprintf() or similar instead is a bug. > But that's more > plumbing effort, so it doesn't necessarily have to be you doing the > work, nor this series. Yes.