From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxzmx-0003kg-G7 for qemu-devel@nongnu.org; Fri, 29 Sep 2017 14:13:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxzmw-0003Qi-KS for qemu-devel@nongnu.org; Fri, 29 Sep 2017 14:13:27 -0400 MIME-Version: 1.0 Sender: alistair23@gmail.com In-Reply-To: References: <5ad72536402da2879d49b58753cc709a8ff22de9.1506384415.git.alistair.francis@xilinx.com> From: Alistair Francis Date: Fri, 29 Sep 2017 11:12:54 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] [PATCH v1 8/8] target: Replace fprintf(stderr, "*\n" with error_report() List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: Alistair Francis , "qemu-devel@nongnu.org Developers" , Cornelia Huck , Eduardo Habkost , Marcelo Tosatti , "Edgar E. Iglesias" , Markus Armbruster , Christian Borntraeger , Michael Walle , qemu-arm , "open list:New World" , Paolo Bonzini , Yongbok Kim , Guan Xuetao , Aurelien Jarno , Richard Henderson List-ID: On Mon, Sep 25, 2017 at 9:08 PM, Thomas Huth wrote: > On 26.09.2017 02:09, Alistair Francis wrote: >> Replace a large number of the fprintf(stderr, "*\n" calls with >> error_report(). The functions were renamed with these commands and then >> compiler issues where manually fixed. > [...] >> @@ -9281,18 +9281,19 @@ static void init_ppc_proc(PowerPCCPU *cpu) >> case POWERPC_FLAG_PMM: >> break; >> default: >> - fprintf(stderr, "PowerPC MSR definition inconsistency\n" >> - "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n"); >> + error_report("PowerPC MSR definition inconsistency"); >> + error_printf("Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM"); >> exit(1); >> } >> } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { >> - fprintf(stderr, "PowerPC MSR definition inconsistency\n" >> - "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n"); >> + error_report("PowerPC MSR definition inconsistency"); >> + error_printf("Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM"); >> exit(1); >> } >> if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) { >> - fprintf(stderr, "PowerPC flags inconsistency\n" >> - "Should define the time-base and decrementer clock source\n"); >> + error_report("PowerPC MSR definition inconsistency"); >> + error_printf("Should define the time-base and decrementer clock" >> + " source"); >> exit(1); >> } > > Replacing fprintf with error_report+error_printf is kind of very ugly. > While error_report adds newline to the output, error_printf does not (as > far as I can see) ... did you check how such a message looks like when > it is generated during runtime? > Also, the strings belong together, so printing them with two function > calls sound wrong to me... maybe they should be joined without newline > in the middle instead? Ok, that works for me, I'll do that. Thanks, Alistair > > Thomas