[{"id":1775137,"web_url":"http://patchwork.ozlabs.org/comment/1775137/","msgid":"<adae1793-1a4a-7107-7676-f6dbaa26a9f4@redhat.com>","list_archive_url":null,"date":"2017-09-26T04:08:13","subject":"Re: [Qemu-devel] [PATCH v1 8/8] target: Replace fprintf(stderr,\n\t\"*\\n\" with error_report()","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 26.09.2017 02:09, Alistair Francis wrote:\n> Replace a large number of the fprintf(stderr, \"*\\n\" calls with\n> error_report(). The functions were renamed with these commands and then\n> compiler issues where manually fixed.\n[...]\n> @@ -9281,18 +9281,19 @@ static void init_ppc_proc(PowerPCCPU *cpu)\n>          case POWERPC_FLAG_PMM:\n>              break;\n>          default:\n> -            fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n> -                    \"Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\\n\");\n> +            error_report(\"PowerPC MSR definition inconsistency\");\n> +            error_printf(\"Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\");\n>              exit(1);\n>          }\n>      } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {\n> -        fprintf(stderr, \"PowerPC MSR definition inconsistency\\n\"\n> -                \"Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\\n\");\n> +        error_report(\"PowerPC MSR definition inconsistency\");\n> +        error_printf(\"Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\");\n>          exit(1);\n>      }\n>      if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) {\n> -        fprintf(stderr, \"PowerPC flags inconsistency\\n\"\n> -                \"Should define the time-base and decrementer clock source\\n\");\n> +        error_report(\"PowerPC MSR definition inconsistency\");\n> +        error_printf(\"Should define the time-base and decrementer clock\"\n> +                     \" source\");\n>          exit(1);\n>      }\n\nReplacing fprintf with error_report+error_printf is kind of very ugly.\nWhile error_report adds newline to the output, error_printf does not (as\nfar as I can see) ... did you check how such a message looks like when\nit is generated during runtime?\nAlso, the strings belong together, so printing them with two function\ncalls sound wrong to me... maybe they should be joined without newline\nin the middle instead?\n\n Thomas","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y1SBd6YZxz9t49\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 14:09:12 +1000 (AEST)","from localhost ([::1]:45503 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dwhBG-0007Ip-4w\n\tfor incoming@patchwork.ozlabs.org; Tue, 26 Sep 2017 00:09:10 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:41988)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dwhAq-0007Gz-KS\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 00:08:45 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dwhAp-0002mD-M9\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 00:08:44 -0400","from mx1.redhat.com ([209.132.183.28]:40912)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>)\n\tid 1dwhAl-0002k5-6n; Tue, 26 Sep 2017 00:08:39 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 9297781E06;\n\tTue, 26 Sep 2017 04:08:37 +0000 (UTC)","from [10.36.116.28] (ovpn-116-28.ams2.redhat.com [10.36.116.28])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 2E9F469FC3;\n\tTue, 26 Sep 2017 04:08:19 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 9297781E06","To":"Alistair Francis <alistair.francis@xilinx.com>, qemu-devel@nongnu.org","References":"<cover.1506384414.git.alistair.francis@xilinx.com>\n\t<5ad72536402da2879d49b58753cc709a8ff22de9.1506384415.git.alistair.francis@xilinx.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<adae1793-1a4a-7107-7676-f6dbaa26a9f4@redhat.com>","Date":"Tue, 26 Sep 2017 06:08:13 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<5ad72536402da2879d49b58753cc709a8ff22de9.1506384415.git.alistair.francis@xilinx.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tTue, 26 Sep 2017 04:08:38 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v1 8/8] target: Replace fprintf(stderr,\n\t\"*\\n\" with error_report()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Marcelo Tosatti <mtosatti@redhat.com>,\n\tEduardo Habkost <ehabkost@redhat.com>,\n\tCornelia Huck <cohuck@redhat.com>, armbru@redhat.com,\n\talistair23@gmail.com, Christian Borntraeger <borntraeger@de.ibm.com>,\n\tMichael Walle <michael@walle.cc>, qemu-arm@nongnu.org,\n\tqemu-ppc@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,\n\tYongbok Kim <yongbok.kim@imgtec.com>,\n\t\"Edgar E. Iglesias\" <edgar.iglesias@gmail.com>,\n\tGuan Xuetao <gxt@mprc.pku.edu.cn>,\n\tAurelien Jarno <aurelien@aurel32.net>, \n\tRichard Henderson <rth@twiddle.net>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1775630,"web_url":"http://patchwork.ozlabs.org/comment/1775630/","msgid":"<d591fe76-6305-e082-3dc3-b53178c0ee5d@twiddle.net>","list_archive_url":null,"date":"2017-09-26T15:21:24","subject":"Re: [Qemu-devel] [PATCH v1 8/8] target: Replace fprintf(stderr,\n\t\"*\\n\" with error_report()","submitter":{"id":2222,"url":"http://patchwork.ozlabs.org/api/people/2222/","name":"Richard Henderson","email":"rth@twiddle.net"},"content":"On 09/25/2017 05:09 PM, Alistair Francis wrote:\n> diff --git a/target/cris/translate.c b/target/cris/translate.c\n> index 38a999e6f1..8847005984 100644\n> --- a/target/cris/translate.c\n> +++ b/target/cris/translate.c\n> @@ -138,7 +138,7 @@ typedef struct DisasContext {\n>  \n>  static void gen_BUG(DisasContext *dc, const char *file, int line)\n>  {\n> -    fprintf(stderr, \"BUG: pc=%x %s %d\\n\", dc->pc, file, line);\n> +    error_report(\"BUG: pc=%x %s %d\", dc->pc, file, line);\n>      if (qemu_log_separate()) {\n>          qemu_log(\"BUG: pc=%x %s %d\\n\", dc->pc, file, line);\n>      }\n\nEh, no, this should simply use qemu_log.\n\n> diff --git a/target/ppc/translate.c b/target/ppc/translate.c\n> index 606b605ba0..a3da22580e 100644\n> --- a/target/ppc/translate.c\n> +++ b/target/ppc/translate.c\n> @@ -3943,8 +3943,8 @@ static inline void gen_op_mfspr(DisasContext *ctx)\n>               * allowing userland application to read the PVR\n>               */\n>              if (sprn != SPR_PVR) {\n> -                fprintf(stderr, \"Trying to read privileged spr %d (0x%03x) at \"\n> -                        TARGET_FMT_lx \"\\n\", sprn, sprn, ctx->nip - 4);\n> +                error_report(\"Trying to read privileged spr %d (0x%03x) at \"\n> +                        TARGET_FMT_lx \"\", sprn, sprn, ctx->nip - 4);\n>                  if (qemu_log_separate()) {\n>                      qemu_log(\"Trying to read privileged spr %d (0x%03x) at \"\n>                               TARGET_FMT_lx \"\\n\", sprn, sprn, ctx->nip - 4);\n\nLikewise.  And all the others.\nPerhaps we should kill qemu_log_separate as a bad idea?\n\n> diff --git a/target/sh4/translate.c b/target/sh4/translate.c\n> index 10191073b2..9f95410e53 100644\n> --- a/target/sh4/translate.c\n> +++ b/target/sh4/translate.c\n> @@ -438,7 +438,7 @@ static void _decode_opc(DisasContext * ctx)\n>  \t}\n>  \n>  #if 0\n> -    fprintf(stderr, \"Translating opcode 0x%04x\\n\", ctx->opcode);\n> +    error_report(\"Translating opcode 0x%04x\", ctx->opcode);\n>  #endif\n\nqemu_log.\n\n>  \n>      switch (ctx->opcode) {\n> @@ -1799,7 +1799,7 @@ static void _decode_opc(DisasContext * ctx)\n>          break;\n>      }\n>  #if 0\n> -    fprintf(stderr, \"unknown instruction 0x%04x at pc 0x%08x\\n\",\n> +    error_report(\"unknown instruction 0x%04x at pc 0x%08x\",\n>  \t    ctx->opcode, ctx->pc);\n>      fflush(stderr);\n>  #endif\n\nqemu_log_mask(LOG_UNIMP, ...)\n\n> @@ -1940,7 +1940,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)\n>          disas_uc32_insn(env, dc);\n>  \n>          if (num_temps) {\n> -            fprintf(stderr, \"Internal resource leak before %08x\\n\", dc->pc);\n> +            error_report(\"Internal resource leak before %08x\", dc->pc);\n>              num_temps = 0;\n>          }\n>  \n> \n\nqemu_log.\n\n\nr~","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"dXBo0qb5\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y1l7K6YBZz9sxR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 01:22:21 +1000 (AEST)","from localhost ([::1]:48073 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dwrgi-00075f-2W\n\tfor incoming@patchwork.ozlabs.org; Tue, 26 Sep 2017 11:22:20 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50549)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <rth7680@gmail.com>) id 1dwrgE-00074c-Lq\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 11:21:51 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <rth7680@gmail.com>) id 1dwrgD-0000FB-Kj\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 11:21:50 -0400","from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:33366)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <rth7680@gmail.com>)\n\tid 1dwrfw-0000Bu-0q; Tue, 26 Sep 2017 11:21:32 -0400","by mail-pf0-x242.google.com with SMTP id h4so5143984pfk.0;\n\tTue, 26 Sep 2017 08:21:30 -0700 (PDT)","from bigtime.twiddle.net ([70.35.39.2])\n\tby smtp.googlemail.com with ESMTPSA id\n\th90sm19110544pfj.32.2017.09.26.08.21.26\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 26 Sep 2017 08:21:27 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=QhH+NzC7s7pyRpsaJKe6GJ4T1mGMun5EkDjTqGtW78Y=;\n\tb=dXBo0qb5m03dXw49F3A2f9ovDUyUeJLHAnePlOCF/dhRWb7/8YUvgsJ5G7KzFLA+Uv\n\tVuiDOoD2SBE0M5C/mGC6MtVHVNYoF/6cqKLQGU94y7Up32camSlxYwr4V5FJU6o+UlLR\n\tH2GmiE5NfLrpYz134nWFcedXOv+/IHW9+NrCYbSFnbtZO0vcnp5Wn3by8VaHoM9a1e1N\n\tXZRh5nEnOL1CGa5oSQcVoQZL3gQgiJotGtKiMxPkaw8JXrSeKIXzxUQz2CJbxcnG8KgJ\n\tk/SGsNVUvrwYZLUauSxW6NjcLlDD3LoBcbCZuNWkf6C4BV4REQPJWdnyRRezXYn9xt6I\n\tXTAg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=QhH+NzC7s7pyRpsaJKe6GJ4T1mGMun5EkDjTqGtW78Y=;\n\tb=PI8R9slFYvV5SErSjPWosVNfe03VRY/ZTNnuTVNg2UyaBMMvK+g3mI4eMEFF6vkcnA\n\tBsKEk98Ni/JrGXbJLratXsVJgl4VwjunsZMLOzfZC5RMxdTN+ad7PjdiMlrkZwJwWo7Y\n\thnY8CurrRo5CfovK2391N1FuQrfGZvSOfZGtQKt0uP90VEoz8YXJl401VzAwdeAc3EyE\n\t6UioXgVUqwKVa6UCjneICzCQzHS8VZw5/BMyL5qW9I+xPxerI+x+8xv2eCUCYC7/9O/R\n\tp42t4ihPZuK4kK3Gv3dcCyWyFjBipS7jUBpFO0sKx0YIR6Jqy8oEEXr/J8jm0A4sHZnZ\n\tF0eA==","X-Gm-Message-State":"AHPjjUho2zm619z1Gn0WXd0betFdPpNI2ViEi7yarbyUg1rTXakQ8jIk\n\tcm3V46N9A2Dg9ZCdzf3qIrSJ/HKN","X-Google-Smtp-Source":"AOwi7QBP+iK2v9hDvQGTd+YXc9wzrcvJqsWTiCDrh6Qa69At28iwA86oG4d9+9XLW6QlVv6WwI/0iQ==","X-Received":"by 10.98.157.74 with SMTP id i71mr11366570pfd.168.1506439289242; \n\tTue, 26 Sep 2017 08:21:29 -0700 (PDT)","To":"Alistair Francis <alistair.francis@xilinx.com>, qemu-devel@nongnu.org","References":"<cover.1506384414.git.alistair.francis@xilinx.com>\n\t<5ad72536402da2879d49b58753cc709a8ff22de9.1506384415.git.alistair.francis@xilinx.com>","From":"Richard Henderson <rth@twiddle.net>","Message-ID":"<d591fe76-6305-e082-3dc3-b53178c0ee5d@twiddle.net>","Date":"Tue, 26 Sep 2017 08:21:24 -0700","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<5ad72536402da2879d49b58753cc709a8ff22de9.1506384415.git.alistair.francis@xilinx.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400e:c00::242","Subject":"Re: [Qemu-devel] [PATCH v1 8/8] target: Replace fprintf(stderr,\n\t\"*\\n\" with error_report()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Cornelia Huck <cohuck@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>,\n\tMarcelo Tosatti <mtosatti@redhat.com>,\n\t\"Edgar E. Iglesias\" <edgar.iglesias@gmail.com>, armbru@redhat.com,\n\tChristian Borntraeger <borntraeger@de.ibm.com>,\n\tMichael Walle <michael@walle.cc>, qemu-arm@nongnu.org,\n\tqemu-ppc@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,\n\tYongbok Kim <yongbok.kim@imgtec.com>, alistair23@gmail.com,\n\tGuan Xuetao <gxt@mprc.pku.edu.cn>, Aurelien Jarno <aurelien@aurel32.net>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]