qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: alistair.francis@xilinx.com, Paolo Bonzini <pbonzini@redhat.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Richard Henderson <rth@twiddle.net>, Stefan Weil <sw@weilnetz.de>
Subject: [Qemu-devel] [PATCH v7 14/15] tcg: Replace fprintf(stderr, "*\n" with error_report()
Date: Fri,  2 Feb 2018 19:37:30 +0100	[thread overview]
Message-ID: <20180202183731.29990-15-armbru@redhat.com> (raw)
In-Reply-To: <20180202183731.29990-1-armbru@redhat.com>

From: Alistair Francis <alistair.francis@xilinx.com>

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.

find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Stefan Weil <sw@weilnetz.de>

Conversions that aren't followed by exit() dropped, because they might
be inappropriate.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 cpus.c | 10 +++++-----
 exec.c |  6 +++---
 vl.c   |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cpus.c b/cpus.c
index 2cb0af9b22..5d3a165960 100644
--- a/cpus.c
+++ b/cpus.c
@@ -259,7 +259,7 @@ int64_t cpu_get_icount_raw(void)
 
     if (cpu && cpu->running) {
         if (!cpu->can_do_io) {
-            fprintf(stderr, "Bad icount read\n");
+            error_report("Bad icount read");
             exit(1);
         }
         /* Take into account what has run */
@@ -1181,7 +1181,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
 
     r = kvm_init_vcpu(cpu);
     if (r < 0) {
-        fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r));
+        error_report("kvm_init_vcpu failed: %s", strerror(-r));
         exit(1);
     }
 
@@ -1211,7 +1211,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
 static void *qemu_dummy_cpu_thread_fn(void *arg)
 {
 #ifdef _WIN32
-    fprintf(stderr, "qtest is not supported under Windows\n");
+    error_report("qtest is not supported under Windows");
     exit(1);
 #else
     CPUState *cpu = arg;
@@ -1631,8 +1631,8 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
 #else /* _WIN32 */
     if (!qemu_cpu_is_self(cpu)) {
         if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) {
-            fprintf(stderr, "%s: QueueUserAPC failed with error %lu\n",
-                    __func__, GetLastError());
+            error_report("%s: QueueUserAPC failed with error %lu", __func__,
+                         GetLastError());
             exit(1);
         }
     }
diff --git a/exec.c b/exec.c
index 629a508385..e8d7b335b6 100644
--- a/exec.c
+++ b/exec.c
@@ -2216,9 +2216,9 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
                                 flags, -1, 0);
                 }
                 if (area != vaddr) {
-                    fprintf(stderr, "Could not remap addr: "
-                            RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n",
-                            length, addr);
+                    error_report("Could not remap addr: "
+                                 RAM_ADDR_FMT "@" RAM_ADDR_FMT "",
+                                 length, addr);
                     exit(1);
                 }
                 memory_try_enable_merging(vaddr, length);
diff --git a/vl.c b/vl.c
index e517a8d995..32db91da1e 100644
--- a/vl.c
+++ b/vl.c
@@ -2172,7 +2172,7 @@ static DisplayType select_display(const char *p)
         display_opengl = 1;
         display = DT_EGL;
 #else
-        fprintf(stderr, "egl support is disabled\n");
+        error_report("egl support is disabled");
         exit(1);
 #endif
     } else if (strstart(p, "curses", &opts)) {
-- 
2.13.6

  parent reply	other threads:[~2018-02-02 18:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 18:37 [Qemu-devel] [PATCH v7 00/15] Remove some of the fprintf(stderr, "* Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 01/15] audio: Replace AUDIO_FUNC with __func__ Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 02/15] hw/arm: Replace fprintf(stderr, "*\n" with error_report() Markus Armbruster
2018-02-02 19:35   ` Eric Blake
2018-02-03  8:42     ` Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 03/15] hw/dma: " Markus Armbruster
2018-02-03 20:18   ` Thomas Huth
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 04/15] hw/lm32: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 05/15] hw/mips: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 06/15] hw/moxie: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 07/15] hw/openrisc: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 08/15] hw/pci*: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 09/15] hw/ppc: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 10/15] hw/sd: " Markus Armbruster
2018-02-03 20:12   ` Thomas Huth
2018-02-05  6:27     ` Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 11/15] hw/sparc*: " Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 12/15] hw/timer: " Markus Armbruster
2018-02-02 20:24   ` Philippe Mathieu-Daudé
2018-02-03  7:51     ` Markus Armbruster
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 13/15] hw/xen*: " Markus Armbruster
2018-02-02 18:37 ` Markus Armbruster [this message]
2018-02-02 18:37 ` [Qemu-devel] [PATCH v7 15/15] target: Use qemu_log() instead of fprintf(stderr, ...) Markus Armbruster
2018-02-02 19:59   ` Eric Blake
2018-02-03  7:42     ` Markus Armbruster
2018-02-02 19:45 ` [Qemu-devel] [PATCH v7 00/15] Remove some of the fprintf(stderr, "* Alistair Francis
2018-02-02 20:21 ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180202183731.29990-15-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=alistair.francis@xilinx.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).