Skip to contentSkip to conversation

Remove some of the fprintf(stderr, "*

PATCH Superseded Alistair Francis 12 participants 79 messages Oct 19, 2017 – Nov 8, 2017 Page 2 of 2

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
Acked-by on v3 33/46
#54 lore raw

Re: [Qemu-devel] [PATCH v3 33/46] hw/scsi: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 44 lines · Alistair Francis

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}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

Cc Paolo Bonzini <[email protected]>
Cc David Gibson <[email protected]>
Cc Alexander Graf <[email protected]>
Quoted 8 lines

---
V2:
- Split hw patch into individual directories

 hw/scsi/lsi53c895a.c            |  4 ++--
 hw/scsi/spapr_vscsi.c           | 49 +++++++++++++++++++++--------------------
 hw/scsi/virtio-scsi-dataplane.c |  6 ++---
 3 files changed, 30 insertions(+), 29 deletions(-)

virtio_scsi part

Quoted 259 lines
hw/scsi/lsi53c895a.c +2 -2
index 191505df5b..7c9a930e2f 100644
@@ -14,7 +14,7 @@
  */
 
 #include "qemu/osdep.h"
-
+#include "qemu/error-report.h"
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
 #include "hw/scsi/scsi.h"
@@ -1501,7 +1501,7 @@ again:
            This is apparently sufficient to beat the drivers into submission.
          */
         if (!(s->sien0 & LSI_SIST0_UDC))
-            fprintf(stderr, "inf. loop with UDC masked\n");
+            error_report("inf. loop with UDC masked");
         lsi_script_scsi_interrupt(s, LSI_SIST0_UDC, 0);
         lsi_disconnect(s);
     } else if (s->istat1 & LSI_ISTAT1_SRUN && !s->waiting) {
hw/scsi/spapr_vscsi.c +25 -24
index 360db53ac8..8c4eabcf3d 100644
@@ -32,6 +32,7 @@
  *  - Maybe do autosense (PAPR seems to mandate it, linux doesn't care)
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
@@ -179,7 +180,7 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req,
     rc = spapr_vio_dma_write(&s->vdev, req->crq.s.IU_data_ptr,
                              &req->iu, length);
     if (rc) {
-        fprintf(stderr, "vscsi_send_iu: DMA write failure !\n");
+        error_report("vscsi_send_iu: DMA write failure !");
     }
 
     req->crq.s.valid = 0x80;
@@ -197,7 +198,7 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req,
 
     rc1 = spapr_vio_send_crq(&s->vdev, req->crq.raw);
     if (rc1) {
-        fprintf(stderr, "vscsi_send_iu: Error sending response\n");
+        error_report("vscsi_send_iu: Error sending response");
         return rc1;
     }
 
@@ -330,7 +331,7 @@ static int vscsi_fetch_desc(VSCSIState *s, struct vscsi_req *req,
         break;
     }
     default:
-        fprintf(stderr, "VSCSI:   Unknown format %x\n", req->dma_fmt);
+        error_report("VSCSI:   Unknown format %x", req->dma_fmt);
         return -1;
     }
 
@@ -518,7 +519,7 @@ static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)
 
     trace_spapr_vscsi_transfer_data(sreq->tag, len, req);
     if (req == NULL) {
-        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);
+        error_report("VSCSI: Can't find request for tag 0x%x", sreq->tag);
         return;
     }
 
@@ -527,7 +528,7 @@ static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)
         rc = vscsi_srp_transfer_data(s, req, req->writing, buf, len);
     }
     if (rc < 0) {
-        fprintf(stderr, "VSCSI: RDMA error rc=%d!\n", rc);
+        error_report("VSCSI: RDMA error rc=%d!", rc);
         req->dma_error = true;
         scsi_req_cancel(req->sreq);
         return;
@@ -547,7 +548,7 @@ static void vscsi_command_complete(SCSIRequest *sreq, uint32_t status, size_t re
 
     trace_spapr_vscsi_command_complete(sreq->tag, status, req);
     if (req == NULL) {
-        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);
+        error_report("VSCSI: Can't find request for tag 0x%x", sreq->tag);
         return;
     }
 
@@ -639,7 +640,7 @@ static void *vscsi_load_request(QEMUFile *f, SCSIRequest *sreq)
     memset(req, 0, sizeof(*req));
     rc = vmstate_load_state(f, &vmstate_spapr_vscsi_req, req, 1);
     if (rc) {
-        fprintf(stderr, "VSCSI: failed loading request tag#%u\n", sreq->tag);
+        error_report("VSCSI: failed loading request tag#%u", sreq->tag);
         return NULL;
     }
     assert(req->active);
@@ -827,7 +828,7 @@ static int vscsi_process_tsk_mgmt(VSCSIState *s, vscsi_req *req)
     uint64_t tag = iu->srp.rsp.tag;
     uint8_t sol_not = iu->srp.cmd.sol_not;
 
-    fprintf(stderr, "vscsi_process_tsk_mgmt %02x\n",
+    error_report("vscsi_process_tsk_mgmt %02x",
             iu->srp.tsk_mgmt.tsk_mgmt_func);
 
     d = vscsi_device_find(&s->bus, be64_to_cpu(req->iu.srp.tsk_mgmt.lun), &lun);
@@ -932,10 +933,10 @@ static int vscsi_handle_srp_req(VSCSIState *s, vscsi_req *req)
     case SRP_CRED_RSP:
     case SRP_AER_REQ:
     case SRP_AER_RSP:
-        fprintf(stderr, "VSCSI: Unsupported opcode %02x\n", opcode);
+        error_report("VSCSI: Unsupported opcode %02x", opcode);
         break;
     default:
-        fprintf(stderr, "VSCSI: Unknown type %02x\n", opcode);
+        error_report("VSCSI: Unknown type %02x", opcode);
     }
 
     return done;
@@ -953,7 +954,7 @@ static int vscsi_send_adapter_info(VSCSIState *s, vscsi_req *req)
     rc = spapr_vio_dma_read(&s->vdev, be64_to_cpu(sinfo->buffer),
                             &info, be16_to_cpu(sinfo->common.length));
     if (rc) {
-        fprintf(stderr, "vscsi_send_adapter_info: DMA read failure !\n");
+        error_report("vscsi_send_adapter_info: DMA read failure !");
     }
 #endif
     memset(&info, 0, sizeof(info));
@@ -967,7 +968,7 @@ static int vscsi_send_adapter_info(VSCSIState *s, vscsi_req *req)
     rc = spapr_vio_dma_write(&s->vdev, be64_to_cpu(sinfo->buffer),
                              &info, be16_to_cpu(sinfo->common.length));
     if (rc)  {
-        fprintf(stderr, "vscsi_send_adapter_info: DMA write failure !\n");
+        error_report("vscsi_send_adapter_info: DMA write failure !");
     }
 
     sinfo->common.status = rc ? cpu_to_be32(1) : 0;
@@ -987,7 +988,7 @@ static int vscsi_send_capabilities(VSCSIState *s, vscsi_req *req)
     req_len = len = be16_to_cpu(vcap->common.length);
     buffer = be64_to_cpu(vcap->buffer);
     if (len > sizeof(cap)) {
-        fprintf(stderr, "vscsi_send_capabilities: capabilities size mismatch !\n");
+        error_report("vscsi_send_capabilities: capabilities size mismatch !");
 
         /*
          * Just read and populate the structure that is known.
@@ -997,7 +998,7 @@ static int vscsi_send_capabilities(VSCSIState *s, vscsi_req *req)
     }
     rc = spapr_vio_dma_read(&s->vdev, buffer, &cap, len);
     if (rc)  {
-        fprintf(stderr, "vscsi_send_capabilities: DMA read failure !\n");
+        error_report("vscsi_send_capabilities: DMA read failure !");
     }
 
     /*
@@ -1013,7 +1014,7 @@ static int vscsi_send_capabilities(VSCSIState *s, vscsi_req *req)
 
     rc = spapr_vio_dma_write(&s->vdev, buffer, &cap, len);
     if (rc)  {
-        fprintf(stderr, "vscsi_send_capabilities: DMA write failure !\n");
+        error_report("vscsi_send_capabilities: DMA write failure !");
     }
     if (req_len > len) {
         /*
@@ -1034,11 +1035,11 @@ static int vscsi_handle_mad_req(VSCSIState *s, vscsi_req *req)
 
     switch (be32_to_cpu(mad->empty_iu.common.type)) {
     case VIOSRP_EMPTY_IU_TYPE:
-        fprintf(stderr, "Unsupported EMPTY MAD IU\n");
+        error_report("Unsupported EMPTY MAD IU");
         retlen = sizeof(mad->empty_iu);
         break;
     case VIOSRP_ERROR_LOG_TYPE:
-        fprintf(stderr, "Unsupported ERROR LOG MAD IU\n");
+        error_report("Unsupported ERROR LOG MAD IU");
         retlen = sizeof(mad->error_log);
         break;
     case VIOSRP_ADAPTER_INFO_TYPE:
@@ -1053,7 +1054,7 @@ static int vscsi_handle_mad_req(VSCSIState *s, vscsi_req *req)
         request_handled = true;
         break;
     default:
-        fprintf(stderr, "VSCSI: Unknown MAD type %02x\n",
+        error_report("VSCSI: Unknown MAD type %02x",
                 be32_to_cpu(mad->empty_iu.common.type));
         /*
          * PAPR+ says that "The length field is set to the length
@@ -1078,7 +1079,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
 
     req = vscsi_get_req(s);
     if (req == NULL) {
-        fprintf(stderr, "VSCSI: Failed to get a request !\n");
+        error_report("VSCSI: Failed to get a request !");
         return;
     }
 
@@ -1088,7 +1089,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
      * of the structure.
      */
     if (crq->s.IU_length > sizeof(union viosrp_iu)) {
-        fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
+        error_report("VSCSI: SRP IU too long (%d bytes) !",
                 crq->s.IU_length);
         vscsi_put_req(req);
         return;
@@ -1097,7 +1098,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     /* XXX Handle failure differently ? */
     if (spapr_vio_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
                            crq->s.IU_length)) {
-        fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
+        error_report("vscsi_got_payload: DMA read failure !");
         vscsi_put_req(req);
         return;
     }
@@ -1158,16 +1159,16 @@ static int vscsi_do_crq(struct VIOsPAPRDevice *dev, uint8_t *crq_data)
         case VIOSRP_AIX_FORMAT:
         case VIOSRP_LINUX_FORMAT:
         case VIOSRP_INLINE_FORMAT:
-            fprintf(stderr, "vscsi_do_srq: Unsupported payload format %02x\n",
+            error_report("vscsi_do_srq: Unsupported payload format %02x",
                     crq.s.format);
             break;
         default:
-            fprintf(stderr, "vscsi_do_srq: Unknown payload format %02x\n",
+            error_report("vscsi_do_srq: Unknown payload format %02x",
                     crq.s.format);
         }
         break;
     default:
-        fprintf(stderr, "vscsi_do_crq: unknown CRQ %02x %02x ...\n",
+        error_report("vscsi_do_crq: unknown CRQ %02x %02x ...",
                 crq.raw[0], crq.raw[1]);
     };
 
hw/scsi/virtio-scsi-dataplane.c +3 -3
index add4b3f4a4..e047361310 100644
@@ -97,7 +97,7 @@ static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n,
     /* Set up virtqueue notify */
     rc = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), n, true);
     if (rc != 0) {
-        fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
+        error_report("virtio-scsi: Failed to set host notifier (%d)",
                 rc);
         s->dataplane_fenced = true;
         return rc;
@@ -141,8 +141,8 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev)
     /* Set up guest notifier (irq) */
     rc = k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, true);
     if (rc != 0) {
-        fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
-                "ensure -enable-kvm is set\n", rc);
+        error_report("virtio-scsi: Failed to set guest notifiers (%d), "
+                "ensure -enable-kvm is set", rc);
         goto fail_guest_notifiers;
     }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by on v3 10/46
#28 lore raw

Re: [Qemu-devel] [PATCH v3 10/46] hw/cris: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 38 lines · Alistair Francis

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}' \
    {} +
Quoted 4 lines

Some lines where then manually tweaked to pass checkpatch.

"Edgar E. Iglesias" <[email protected]>

Is this a Reviewed-by tag?

Anyway:

Quoted 59 lines

---
V2:
- Split hw patch into individual directories

 hw/cris/axis_dev88.c | 3 ++-
 hw/cris/boot.c       | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
hw/cris/axis_dev88.c +2 -1
index 5eb552bce2..d121836b69 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
@@ -349,7 +350,7 @@ void axisdev88_init(MachineState *machine)
         li.cmdline = kernel_cmdline;
         cris_load_image(cpu, &li);
     } else if (!qtest_enabled()) {
-        fprintf(stderr, "Kernel image must be specified\n");
+        error_report("Kernel image must be specified");
         exit(1);
     }
 }
hw/cris/boot.c +3 -3
index f896ed7f86..fda0a039b8 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
@@ -86,14 +87,13 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li)
     }
 
     if (image_size < 0) {
-        fprintf(stderr, "qemu: could not load kernel '%s'\n",
-                li->image_filename);
+        error_report("could not load kernel '%s'", li->image_filename);
         exit(1);
     }
 
     if (li->cmdline && (kcmdline_len = strlen(li->cmdline))) {
         if (kcmdline_len > 256) {
-            fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n");
+            error_report("Too long CRIS kernel cmdline (max 256)");
             exit(1);
         }
         pstrcpy_targphys("cmdline", 0x40000000, 256, li->cmdline);
#76 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 46/46] target: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 3 lines · Alistair Francis

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.

[...]

Quoted 7 lines
Cc "Edgar E. Iglesias" <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Michael Walle <[email protected]>
Quoted 8 lines

I was not sure commenting after the mail would break scripts, but it doesn't appear to, good to know!

http://patchwork.ozlabs.org/patch/828257/ <- parsed correctly

#25 lore raw

Re: [Qemu-devel] [PATCH v3 08/46] hw/char: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 3 lines · Alistair Francis

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.

[...]

Quoted 21 lines

---
V2:
- Split hw patch into individual directories

 hw/char/mcf_uart.c  | 5 +++--
 hw/char/sh_serial.c | 9 +++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
hw/char/mcf_uart.c +1 -0
index 56fa402b58..14cb051be9 100644
@@ -6,6 +6,7 @@
  * This code is licensed under the GPL
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/m68k/mcf.h"

hw/char/mcf_uart.c static void mcf_do_command(mcf_uart_state *s, uint8_t cmd) · line 178

Quoted 5 lines
hw/char/mcf_uart.c +1 -1
@@ -174,7 +175,7 @@ static void mcf_do_command(mcf_uart_state *s, uint8_t cmd)
         mcf_uart_do_tx(s);
         break;
     case 3: /* Reserved.  */
-        fprintf(stderr, "mcf_uart: Bad TX command\n");
+        error_report("mcf_uart: Bad TX command");

I'd rather use qemu_log_mask(LOG_GUEST_ERROR,...) here.

hw/char/mcf_uart.c static void mcf_do_command(mcf_uart_state *s, uint8_t cmd) · line 193

Quoted 9 lines
hw/char/mcf_uart.c +1 -1
         break;
     }
 
@@ -189,7 +190,7 @@ static void mcf_do_command(mcf_uart_state *s, uint8_t cmd)
         s->rx_enabled = 0;
         break;
     case 3: /* Reserved.  */
-        fprintf(stderr, "mcf_uart: Bad RX command\n");
+        error_report("mcf_uart: Bad RX command");

ditto

Quoted 16 lines
hw/char/mcf_uart.c +0 -0
         break;
     }
 }
hw/char/sh_serial.c +1 -0
index 835b5378a0..7bb3f3c70b 100644
@@ -25,6 +25,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
 #include "chardev/char-fe.h"

hw/char/sh_serial.c static void sh_serial_write(void *opaque, hwaddr offs, · line 195

Quoted 7 lines
hw/char/sh_serial.c +2 -2
@@ -190,8 +191,8 @@ static void sh_serial_write(void *opaque, hwaddr offs,
         }
     }
 
-    fprintf(stderr, "sh_serial: unsupported write to 0x%02"
-            HWADDR_PRIx "\n", offs);
+    error_report("sh_serial: unsupported write to 0x%02"
+                 HWADDR_PRIx "", offs);

and qemu_log_mask(LOG_UNIMP, ...) here

hw/char/sh_serial.c static uint64_t sh_serial_read(void *opaque, hwaddr offs, · line 295

Quoted 11 lines
hw/char/sh_serial.c +2 -2
     abort();
 }
 
@@ -290,8 +291,8 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs,
 #endif
 
     if (ret & ~((1 << 16) - 1)) {
-        fprintf(stderr, "sh_serial: unsupported read from 0x%02"
-                HWADDR_PRIx "\n", offs);
+        error_report("sh_serial: unsupported read from 0x%02"
+                     HWADDR_PRIx "", offs);

ditto

Quoted 4 lines
hw/char/sh_serial.c +0 -0
         abort();
     }
 
#69 lore raw

Re: [Qemu-devel] [PATCH v3 42/46] util: Replace fprintf(stderr, "*\n" with error_report()

In reply to Stefan Weil
Quoted 32 lines · Stefan Weil

Am 19.10.2017 um 19:53 schrieb Thomas Huth:

Quoted 22 lines · Alistair Francis
Quoted 3 lines

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.

[...]

Quoted 17 lines
util/aio-posix.c +1 -1
index 5946ac09f0..29fff51fcf 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/error-report.h"
 #include "block/block.h"
 #include "qemu/rcu_queue.h"
 #include "qemu/sockets.h"
@@ -703,8 +704,8 @@ void aio_context_setup(AioContext *ctx)
 {
     /* TODO remove this in final patch submission */
     if (getenv("QEMU_AIO_POLL_MAX_NS")) {
-        fprintf(stderr, "The QEMU_AIO_POLL_MAX_NS environment variable has "
Quoted 8 lines

util/aio-posix.c void aio_context_setup(AioContext *ctx) · line 710

Quoted 5 lines
util/aio-posix.c +2 -1
-                "been replaced with -object iothread,poll-max-ns=NUM\n");
+        error_report("The QEMU_AIO_POLL_MAX_NS environment variable has "
+                "been replaced with -object iothread,poll-max-ns=NUM");
         exit(1);
     }

The comment in front of this code block indicates that this should rather be removed completely. Stefan, do you agree?

Quoted 1 line

I assume you asked the other Stefan, but I think he'll agree as I do,

Right, the code has been introduced by this commit:

commit 4a1cba3802554a3b077d436002519ff1fb0c18bf

Author: Stefan Hajnoczi <[email protected]>
Date:   Thu Dec 1 19:26:42 2016 +0000

aio: add polling mode to AioContext

and apparently the environment variable has never been used in the committed code base, so removing this code block sounds like the right way to go.

Thomas

#77 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 46/46] target: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 3 lines · Alistair Francis

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.

[...]

Quoted 18 lines
 target/arm/arm-powerctl.c    |  5 +++--
 target/arm/arm-semi.c        |  3 ++-
 target/arm/helper.c          |  4 ++--
 target/arm/kvm.c             | 16 ++++++-------
 target/arm/kvm32.c           |  2 +-
 target/arm/kvm64.c           |  2 +-
 target/arm/translate-a64.c   |  4 ++--
 target/arm/translate.c       |  2 +-
 target/cris/helper.c         |  2 +-
 target/i386/hax-all.c        | 53 ++++++++++++++++++++++----------------------
 target/i386/hax-darwin.c     | 26 +++++++++++-----------
 target/i386/hax-mem.c        |  4 ++--
 target/i386/hax-windows.c    | 43 +++++++++++++++++------------------
 target/i386/kvm.c            | 38 +++++++++++++++----------------
 target/i386/misc_helper.c    | 12 +++++-----
 target/lm32/op_helper.c      |  4 ++--
 target/mips/mips-semi.c      |  3 ++-
 target/mips/translate.c      |  2 +-
Quoted 8 lines
 target/ppc/excp_helper.c     |  4 ++--
 target/ppc/kvm.c             | 34 ++++++++++++++--------------
 target/ppc/mmu-hash64.c      |  2 +-
 target/ppc/mmu_helper.c      |  2 +-
 target/ppc/translate_init.c  | 53 ++++++++++++++++++++++----------------------
 target/s390x/kvm.c           | 20 ++++++++---------
 target/s390x/misc_helper.c   |  2 +-
 target/unicore32/translate.c |  2 +-

If you want to get this committed, it's likely better to split it up into the individual subsystems and send the patches to the according maintainers, I think.

Quoted 15 lines
 26 files changed, 175 insertions(+), 169 deletions(-)
target/arm/arm-powerctl.c +1 -0
index 25207cb850..2d56d5d579 100644
@@ -9,6 +9,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "cpu.h"
 #include "cpu-qom.h"
 #include "internals.h"

target/arm/arm-powerctl.c line 28

Quoted 5 lines
target/arm/arm-powerctl.c +1 -1
@@ -24,7 +25,7 @@
 #define DPRINTF(fmt, args...) \
     do { \
         if (DEBUG_ARM_POWERCTL) { \
-            fprintf(stderr, "[ARM]%s: " fmt , __func__, ##args); \
+            error_report("[ARM]%s: " fmt , __func__, ##args); \

Using error_report for debug printing sounds wrong to me. These strings are not errors. Maybe info_report would be a better choice? ... or maybe just leave it as fprintf, since this is just a debug macro.

target/arm/arm-powerctl.c CPUState *arm_get_cpu_by_id(uint64_t id) · line 39

Quoted 12 lines
target/arm/arm-powerctl.c +1 -1
         } \
     } while (0)
 
@@ -32,7 +33,7 @@ CPUState *arm_get_cpu_by_id(uint64_t id)
 {
     CPUState *cpu;
 
-    DPRINTF("cpu %" PRId64 "\n", id);
+    DPRINTF("cpu %" PRId64 "", id);
 
     CPU_FOREACH(cpu) {
         ARMCPU *armcpu = ARM_CPU(cpu);

This looks incomplete. There are more DPRINTF statements in this file, so if you really want to convert this, you've got to touch all of them.

target/arm/translate-a64.c static inline void assert_fp_access_checked(DisasContext *s) · line 509

Quoted 12 lines
target/arm/translate-a64.c +2 -2
index a39b9d3633..9c736481f6 100644
@@ -505,8 +505,8 @@ static inline void assert_fp_access_checked(DisasContext *s)
 {
 #ifdef CONFIG_DEBUG_TCG
     if (unlikely(!s->fp_access_checked || s->fp_excp_el)) {
-        fprintf(stderr, "target-arm: FP access check missing for "
-                "instruction 0x%08x\n", s->insn);
+        error_report("target-arm: FP access check missing for "
+                "instruction 0x%08x", s->insn);

Bad indentation.

Quoted 21 lines
target/arm/translate-a64.c +0 -0
         abort();
     }
 #endif
target/arm/translate.c +1 -1
index 4da1a4cbc6..55bdcad97e 100644
@@ -861,7 +861,7 @@ void arm_test_cc(DisasCompare *cmp, int cc)
         goto no_invert;
 
     default:
-        fprintf(stderr, "Bad condition code 0x%x\n", cc);
+        error_report("Bad condition code 0x%x", cc);
         abort();
     }
 
target/cris/helper.c +0 -0
index af78cca8b9..ba9ce538c3 100644

target/cris/helper.c hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) · line 285

Quoted 5 lines
target/cris/helper.c +1 -1
@@ -282,7 +282,7 @@ hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
     if (!miss) {
         phy = res.phy;
     }
-    D(fprintf(stderr, "%s %x -> %x\n", __func__, addr, phy));
+    D(error_report("%s %x -> %x", __func__, addr, phy));

I think it would be better to remove the D() macro from this file and turn this statement into a qemu_log_mask(CPU_LOG_MMU, ...).

Quoted 133 lines
target/ppc/kvm.c +15 -15
index 9d57debf0e..b87f3d6f84 100644
@@ -159,8 +159,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     cap_ppc_pvr_compat = false;
 
     if (!cap_interrupt_level) {
-        fprintf(stderr, "KVM: Couldn't find level irq capability. Expect the "
-                        "VM to stall at times!\n");
+        error_report("KVM: Couldn't find level irq capability. Expect the "
+                        "VM to stall at times!");
     }
 
     kvm_ppc_register_host_cpu_type(ms);
@@ -188,7 +188,7 @@ static int kvm_arch_sync_sregs(PowerPCCPU *cpu)
         return 0;
     } else {
         if (!cap_segstate) {
-            fprintf(stderr, "kvm error: missing PVR setting capability\n");
+            error_report("kvm error: missing PVR setting capability");
             return -ENOSYS;
         }
     }
@@ -237,7 +237,7 @@ static int kvm_booke206_tlb_init(PowerPCCPU *cpu)
 
     ret = kvm_vcpu_enable_cap(cs, KVM_CAP_SW_TLB, 0, (uintptr_t)&cfg);
     if (ret < 0) {
-        fprintf(stderr, "%s: couldn't enable KVM_CAP_SW_TLB: %s\n",
+        error_report("%s: couldn't enable KVM_CAP_SW_TLB: %s",
                 __func__, strerror(-ret));
         return ret;
     }
@@ -552,7 +552,7 @@ static void kvmppc_hw_debug_points_init(CPUPPCState *cenv)
     }
 
     if ((max_hw_breakpoint + max_hw_watchpoint) > MAX_HW_BKPTS) {
-        fprintf(stderr, "Error initializing h/w breakpoints\n");
+        error_report("Error initializing h/w breakpoints");
         return;
     }
 }
@@ -623,7 +623,7 @@ static void kvm_sw_tlb_put(PowerPCCPU *cpu)
 
     ret = kvm_vcpu_ioctl(cs, KVM_DIRTY_TLB, &dirty_tlb);
     if (ret) {
-        fprintf(stderr, "%s: KVM_DIRTY_TLB: %s\n",
+        error_report("%s: KVM_DIRTY_TLB: %s",
                 __func__, strerror(-ret));
     }
 
@@ -1480,7 +1480,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu)
 static int kvmppc_handle_dcr_read(CPUPPCState *env, uint32_t dcrn, uint32_t *data)
 {
     if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0)
-        fprintf(stderr, "Read to unhandled DCR (0x%x)\n", dcrn);
+        error_report("Read to unhandled DCR (0x%x)", dcrn);
 
     return 0;
 }
@@ -1488,7 +1488,7 @@ static int kvmppc_handle_dcr_read(CPUPPCState *env, uint32_t dcrn, uint32_t *dat
 static int kvmppc_handle_dcr_write(CPUPPCState *env, uint32_t dcrn, uint32_t data)
 {
     if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0)
-        fprintf(stderr, "Write to unhandled DCR (0x%x)\n", dcrn);
+        error_report("Write to unhandled DCR (0x%x)", dcrn);
 
     return 0;
 }
@@ -1799,7 +1799,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
         break;
 
     default:
-        fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
+        error_report("KVM: unknown exit reason %d", run->exit_reason);
         ret = -1;
         break;
     }
@@ -1863,7 +1863,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
 
     ret = kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_BOOKE_WATCHDOG, 0);
     if (ret < 0) {
-        fprintf(stderr, "%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s\n",
+        error_report("%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s",
                 __func__, strerror(-ret));
         return ret;
     }
@@ -2198,7 +2198,7 @@ off_t kvmppc_alloc_rma(void **rma)
 
     fd = kvm_vm_ioctl(kvm_state, KVM_ALLOCATE_RMA, &ret);
     if (fd < 0) {
-        fprintf(stderr, "KVM: Error on KVM_ALLOCATE_RMA: %s\n",
+        error_report("KVM: Error on KVM_ALLOCATE_RMA: %s",
                 strerror(errno));
         return -1;
     }
@@ -2207,7 +2207,7 @@ off_t kvmppc_alloc_rma(void **rma)
 
     *rma = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (*rma == MAP_FAILED) {
-        fprintf(stderr, "KVM: Error mapping RMA: %s\n", strerror(errno));
+        error_report("KVM: Error mapping RMA: %s", strerror(errno));
         return -1;
     };
 
@@ -2309,7 +2309,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
         }
         fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args);
         if (fd < 0) {
-            fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n",
+            error_report("KVM: Failed to create TCE table for liobn 0x%x",
                     liobn);
             return NULL;
         }
@@ -2322,7 +2322,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
 
     table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (table == MAP_FAILED) {
-        fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n",
+        error_report("KVM: Failed to map TCE table for liobn 0x%x",
                 liobn);
         close(fd);
         return NULL;
@@ -2584,7 +2584,7 @@ int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns)
     do {
         rc = read(fd, buf, bufsize);
         if (rc < 0) {
-            fprintf(stderr, "Error reading data from KVM HTAB fd: %s\n",
+            error_report("Error reading data from KVM HTAB fd: %s",
                     strerror(errno));
             return rc;
         } else if (rc) {

target/ppc/kvm.c int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, · line 2635

Quoted 8 lines
target/ppc/kvm.c +1 -1
@@ -2629,13 +2629,13 @@ int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
 
     rc = write(fd, buf, chunksize);
     if (rc < 0) {
-        fprintf(stderr, "Error writing KVM hash table: %s\n",
+        error_report("Error writing KVM hash table: %s",
                 strerror(errno));
         return rc;
     }

Wrong indentation in the above hunks.

target/ppc/mmu-hash64.c static int ppc_hash64_amr_prot(PowerPCCPU *cpu, ppc_hash_pte64_t pte) · line 381

Quoted 11 lines
target/ppc/mmu-hash64.c +1 -1
index 14d34e512f..8713ed6682 100644
@@ -377,7 +377,7 @@ static int ppc_hash64_amr_prot(PowerPCCPU *cpu, ppc_hash_pte64_t pte)
     key = HPTE64_R_KEY(pte.pte1);
     amrbits = (env->spr[SPR_AMR] >> 2*(31 - key)) & 0x3;
 
-    /* fprintf(stderr, "AMR protection: key=%d AMR=0x%" PRIx64 "\n", key, */
+    /* error_report("AMR protection: key=%d AMR=0x%" PRIx64 "", key, */
     /*         env->spr[SPR_AMR]); */

It's just a comment but still - indentation in the second line is wrong here, too.

Thomas

#70 lore raw

Re: [Qemu-devel] [PATCH v3 42/46] util: Replace fprintf(stderr, "*\n" with error_report()

In reply to Thomas Huth
Quoted 38 lines · Thomas Huth
Quoted 32 lines · Stefan Weil

Am 19.10.2017 um 19:53 schrieb Thomas Huth:

Quoted 22 lines · Alistair Francis
Quoted 3 lines

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.

[...]

Quoted 17 lines
util/aio-posix.c +1 -1
index 5946ac09f0..29fff51fcf 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/error-report.h"
 #include "block/block.h"
 #include "qemu/rcu_queue.h"
 #include "qemu/sockets.h"
@@ -703,8 +704,8 @@ void aio_context_setup(AioContext *ctx)
 {
     /* TODO remove this in final patch submission */
     if (getenv("QEMU_AIO_POLL_MAX_NS")) {
-        fprintf(stderr, "The QEMU_AIO_POLL_MAX_NS environment variable has "
Quoted 8 lines

util/aio-posix.c void aio_context_setup(AioContext *ctx) · line 710

Quoted 5 lines
util/aio-posix.c +2 -1
-                "been replaced with -object iothread,poll-max-ns=NUM\n");
+        error_report("The QEMU_AIO_POLL_MAX_NS environment variable has "
+                "been replaced with -object iothread,poll-max-ns=NUM");
         exit(1);
     }

The comment in front of this code block indicates that this should rather be removed completely. Stefan, do you agree?

Quoted 1 line

I assume you asked the other Stefan, but I think he'll agree as I do,

Right, the code has been introduced by this commit:

commit 4a1cba3802554a3b077d436002519ff1fb0c18bf

Quoted 8 lines
Author: Stefan Hajnoczi <[email protected]>
Date:   Thu Dec 1 19:26:42 2016 +0000

aio: add polling mode to AioContext

and apparently the environment variable has never been used in the committed code base, so removing this code block sounds like the right way to go.

Yes, feel free to remove it.

Initially the RFC patches used the QEMU_AIO_POLL_MAX_NS environment variable. When I wrote a proper command-line interface for this setting I left the error to help any of the people testing this optimization migrate their scripts to the new interface.

...Then I forgot to remove it for the final non-RFC patch which got merged :).

Stefan

#71 lore raw

Re: [Qemu-devel] [PATCH v3 42/46] util: Replace fprintf(stderr, "*\n" with error_report()

Quoted 50 lines · Stefan Hajnoczi
Quoted 38 lines · Thomas Huth
Quoted 32 lines · Stefan Weil

Am 19.10.2017 um 19:53 schrieb Thomas Huth:

Quoted 22 lines · Alistair Francis
Quoted 3 lines

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.

[...]

Quoted 17 lines
util/aio-posix.c +1 -1
index 5946ac09f0..29fff51fcf 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/error-report.h"
 #include "block/block.h"
 #include "qemu/rcu_queue.h"
 #include "qemu/sockets.h"
@@ -703,8 +704,8 @@ void aio_context_setup(AioContext *ctx)
 {
     /* TODO remove this in final patch submission */
     if (getenv("QEMU_AIO_POLL_MAX_NS")) {
-        fprintf(stderr, "The QEMU_AIO_POLL_MAX_NS environment variable has "
Quoted 8 lines

util/aio-posix.c void aio_context_setup(AioContext *ctx) · line 710

Quoted 5 lines
util/aio-posix.c +2 -1
-                "been replaced with -object iothread,poll-max-ns=NUM\n");
+        error_report("The QEMU_AIO_POLL_MAX_NS environment variable has "
+                "been replaced with -object iothread,poll-max-ns=NUM");
         exit(1);
     }

The comment in front of this code block indicates that this should rather be removed completely. Stefan, do you agree?

Quoted 1 line

I assume you asked the other Stefan, but I think he'll agree as I do,

Right, the code has been introduced by this commit:

commit 4a1cba3802554a3b077d436002519ff1fb0c18bf

Quoted 8 lines
Author: Stefan Hajnoczi <[email protected]>
Date:   Thu Dec 1 19:26:42 2016 +0000

aio: add polling mode to AioContext

and apparently the environment variable has never been used in the committed code base, so removing this code block sounds like the right way to go.

Yes, feel free to remove it.

Quoted 7 lines

Initially the RFC patches used the QEMU_AIO_POLL_MAX_NS environment variable. When I wrote a proper command-line interface for this setting I left the error to help any of the people testing this optimization migrate their scripts to the new interface.

...Then I forgot to remove it for the final non-RFC patch which got merged :).

Ok, I will remove it in the next version.

Thanks,
Alistair

Quoted 2 lines

Stefan

#78 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 46/46] target: Replace fprintf(stderr, "*\n" with error_report()

In reply to Thomas Huth
Quoted 32 lines · Thomas Huth
Quoted 3 lines · Alistair Francis

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.

[...]

Quoted 18 lines
 target/arm/arm-powerctl.c    |  5 +++--
 target/arm/arm-semi.c        |  3 ++-
 target/arm/helper.c          |  4 ++--
 target/arm/kvm.c             | 16 ++++++-------
 target/arm/kvm32.c           |  2 +-
 target/arm/kvm64.c           |  2 +-
 target/arm/translate-a64.c   |  4 ++--
 target/arm/translate.c       |  2 +-
 target/cris/helper.c         |  2 +-
 target/i386/hax-all.c        | 53 ++++++++++++++++++++++----------------------
 target/i386/hax-darwin.c     | 26 +++++++++++-----------
 target/i386/hax-mem.c        |  4 ++--
 target/i386/hax-windows.c    | 43 +++++++++++++++++------------------
 target/i386/kvm.c            | 38 +++++++++++++++----------------
 target/i386/misc_helper.c    | 12 +++++-----
 target/lm32/op_helper.c      |  4 ++--
 target/mips/mips-semi.c      |  3 ++-
 target/mips/translate.c      |  2 +-
Quoted 8 lines
 target/ppc/excp_helper.c     |  4 ++--
 target/ppc/kvm.c             | 34 ++++++++++++++--------------
 target/ppc/mmu-hash64.c      |  2 +-
 target/ppc/mmu_helper.c      |  2 +-
 target/ppc/translate_init.c  | 53 ++++++++++++++++++++++----------------------
 target/s390x/kvm.c           | 20 ++++++++---------
 target/s390x/misc_helper.c   |  2 +-
 target/unicore32/translate.c |  2 +-
Quoted 3 lines

If you want to get this committed, it's likely better to split it up into the individual subsystems and send the patches to the according maintainers, I think.

I think you are right. I really don't want a 50+ patch series though, so I might wait until other patches have been merged before splitting this up.

Quoted 10 lines
Quoted 10 lines
 26 files changed, 175 insertions(+), 169 deletions(-)
target/arm/arm-powerctl.c +0 -0
index 25207cb850..2d56d5d579 100644
@@ -9,6 +9,7 @@
  */
 
Quoted 15 lines

target/arm/arm-powerctl.c line 28

Quoted 11 lines
target/arm/arm-powerctl.c +2 -1
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "cpu.h"
 #include "cpu-qom.h"
 #include "internals.h"
@@ -24,7 +25,7 @@
 #define DPRINTF(fmt, args...) \
     do { \
         if (DEBUG_ARM_POWERCTL) { \
-            fprintf(stderr, "[ARM]%s: " fmt , __func__, ##args); \
+            error_report("[ARM]%s: " fmt , __func__, ##args); \

Using error_report for debug printing sounds wrong to me. These strings are not errors. Maybe info_report would be a better choice? ... or maybe just leave it as fprintf, since this is just a debug macro.

This should be qemu_log(), I can fix that.

Quoted 8 lines
Quoted 8 lines
target/arm/arm-powerctl.c +0 -0
         } \
     } while (0)
 
@@ -32,7 +33,7 @@ CPUState *arm_get_cpu_by_id(uint64_t id)
 {
     CPUState *cpu;
 
Quoted 8 lines

target/arm/arm-powerctl.c CPUState *arm_get_cpu_by_id(uint64_t id) · line 39

Quoted 5 lines
target/arm/arm-powerctl.c +1 -1
-    DPRINTF("cpu %" PRId64 "\n", id);
+    DPRINTF("cpu %" PRId64 "", id);
 
     CPU_FOREACH(cpu) {
         ARMCPU *armcpu = ARM_CPU(cpu);

This looks incomplete. There are more DPRINTF statements in this file, so if you really want to convert this, you've got to touch all of them.

Yeah, this was a find/replace error.

Quoted 32 lines

target/arm/translate-a64.c static inline void assert_fp_access_checked(DisasContext *s) · line 509

Quoted 13 lines
target/arm/translate-a64.c +2 -2
index a39b9d3633..9c736481f6 100644
@@ -505,8 +505,8 @@ static inline void assert_fp_access_checked(DisasContext *s)
 {
 #ifdef CONFIG_DEBUG_TCG
     if (unlikely(!s->fp_access_checked || s->fp_excp_el)) {
-        fprintf(stderr, "target-arm: FP access check missing for "
-                "instruction 0x%08x\n", s->insn);
+        error_report("target-arm: FP access check missing for "
+                "instruction 0x%08x", s->insn);

Bad indentation.

Quoted 16 lines
target/arm/translate-a64.c +0 -0
         abort();
     }
 #endif
target/arm/translate.c +1 -1
index 4da1a4cbc6..55bdcad97e 100644
@@ -861,7 +861,7 @@ void arm_test_cc(DisasCompare *cmp, int cc)
         goto no_invert;
 
     default:
-        fprintf(stderr, "Bad condition code 0x%x\n", cc);
+        error_report("Bad condition code 0x%x", cc);
         abort();
     }
 
Quoted 13 lines

target/cris/helper.c hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) · line 285

Quoted 10 lines
target/cris/helper.c +1 -1
index af78cca8b9..ba9ce538c3 100644
@@ -282,7 +282,7 @@ hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
     if (!miss) {
         phy = res.phy;
     }
-    D(fprintf(stderr, "%s %x -> %x\n", __func__, addr, phy));
+    D(error_report("%s %x -> %x", __func__, addr, phy));

I think it would be better to remove the D() macro from this file and turn this statement into a qemu_log_mask(CPU_LOG_MMU, ...).

Fixed.

Quoted 153 lines
Quoted 134 lines
target/ppc/kvm.c +15 -15
index 9d57debf0e..b87f3d6f84 100644
@@ -159,8 +159,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     cap_ppc_pvr_compat = false;
 
     if (!cap_interrupt_level) {
-        fprintf(stderr, "KVM: Couldn't find level irq capability. Expect the "
-                        "VM to stall at times!\n");
+        error_report("KVM: Couldn't find level irq capability. Expect the "
+                        "VM to stall at times!");
     }
 
     kvm_ppc_register_host_cpu_type(ms);
@@ -188,7 +188,7 @@ static int kvm_arch_sync_sregs(PowerPCCPU *cpu)
         return 0;
     } else {
         if (!cap_segstate) {
-            fprintf(stderr, "kvm error: missing PVR setting capability\n");
+            error_report("kvm error: missing PVR setting capability");
             return -ENOSYS;
         }
     }
@@ -237,7 +237,7 @@ static int kvm_booke206_tlb_init(PowerPCCPU *cpu)
 
     ret = kvm_vcpu_enable_cap(cs, KVM_CAP_SW_TLB, 0, (uintptr_t)&cfg);
     if (ret < 0) {
-        fprintf(stderr, "%s: couldn't enable KVM_CAP_SW_TLB: %s\n",
+        error_report("%s: couldn't enable KVM_CAP_SW_TLB: %s",
                 __func__, strerror(-ret));
         return ret;
     }
@@ -552,7 +552,7 @@ static void kvmppc_hw_debug_points_init(CPUPPCState *cenv)
     }
 
     if ((max_hw_breakpoint + max_hw_watchpoint) > MAX_HW_BKPTS) {
-        fprintf(stderr, "Error initializing h/w breakpoints\n");
+        error_report("Error initializing h/w breakpoints");
         return;
     }
 }
@@ -623,7 +623,7 @@ static void kvm_sw_tlb_put(PowerPCCPU *cpu)
 
     ret = kvm_vcpu_ioctl(cs, KVM_DIRTY_TLB, &dirty_tlb);
     if (ret) {
-        fprintf(stderr, "%s: KVM_DIRTY_TLB: %s\n",
+        error_report("%s: KVM_DIRTY_TLB: %s",
                 __func__, strerror(-ret));
     }
 
@@ -1480,7 +1480,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu)
 static int kvmppc_handle_dcr_read(CPUPPCState *env, uint32_t dcrn, uint32_t *data)
 {
     if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0)
-        fprintf(stderr, "Read to unhandled DCR (0x%x)\n", dcrn);
+        error_report("Read to unhandled DCR (0x%x)", dcrn);
 
     return 0;
 }
@@ -1488,7 +1488,7 @@ static int kvmppc_handle_dcr_read(CPUPPCState *env, uint32_t dcrn, uint32_t *dat
 static int kvmppc_handle_dcr_write(CPUPPCState *env, uint32_t dcrn, uint32_t data)
 {
     if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0)
-        fprintf(stderr, "Write to unhandled DCR (0x%x)\n", dcrn);
+        error_report("Write to unhandled DCR (0x%x)", dcrn);
 
     return 0;
 }
@@ -1799,7 +1799,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
         break;
 
     default:
-        fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
+        error_report("KVM: unknown exit reason %d", run->exit_reason);
         ret = -1;
         break;
     }
@@ -1863,7 +1863,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu)
 
     ret = kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_BOOKE_WATCHDOG, 0);
     if (ret < 0) {
-        fprintf(stderr, "%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s\n",
+        error_report("%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s",
                 __func__, strerror(-ret));
         return ret;
     }
@@ -2198,7 +2198,7 @@ off_t kvmppc_alloc_rma(void **rma)
 
     fd = kvm_vm_ioctl(kvm_state, KVM_ALLOCATE_RMA, &ret);
     if (fd < 0) {
-        fprintf(stderr, "KVM: Error on KVM_ALLOCATE_RMA: %s\n",
+        error_report("KVM: Error on KVM_ALLOCATE_RMA: %s",
                 strerror(errno));
         return -1;
     }
@@ -2207,7 +2207,7 @@ off_t kvmppc_alloc_rma(void **rma)
 
     *rma = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (*rma == MAP_FAILED) {
-        fprintf(stderr, "KVM: Error mapping RMA: %s\n", strerror(errno));
+        error_report("KVM: Error mapping RMA: %s", strerror(errno));
         return -1;
     };
 
@@ -2309,7 +2309,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
         }
         fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args);
         if (fd < 0) {
-            fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n",
+            error_report("KVM: Failed to create TCE table for liobn 0x%x",
                     liobn);
             return NULL;
         }
@@ -2322,7 +2322,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
 
     table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (table == MAP_FAILED) {
-        fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n",
+        error_report("KVM: Failed to map TCE table for liobn 0x%x",
                 liobn);
         close(fd);
         return NULL;
@@ -2584,7 +2584,7 @@ int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns)
     do {
         rc = read(fd, buf, bufsize);
         if (rc < 0) {
-            fprintf(stderr, "Error reading data from KVM HTAB fd: %s\n",
+            error_report("Error reading data from KVM HTAB fd: %s",
                     strerror(errno));
             return rc;
         } else if (rc) {

target/ppc/kvm.c int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, · line 2635

Quoted 8 lines
target/ppc/kvm.c +1 -1
@@ -2629,13 +2629,13 @@ int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
 
     rc = write(fd, buf, chunksize);
     if (rc < 0) {
-        fprintf(stderr, "Error writing KVM hash table: %s\n",
+        error_report("Error writing KVM hash table: %s",
                 strerror(errno));
         return rc;
     }

Wrong indentation in the above hunks.

Quoted 8 lines
target/ppc/mmu-hash64.c +0 -0
index 14d34e512f..8713ed6682 100644
@@ -377,7 +377,7 @@ static int ppc_hash64_amr_prot(PowerPCCPU *cpu, ppc_hash_pte64_t pte)
     key = HPTE64_R_KEY(pte.pte1);
     amrbits = (env->spr[SPR_AMR] >> 2*(31 - key)) & 0x3;
 
Quoted 6 lines

target/ppc/mmu-hash64.c static int ppc_hash64_amr_prot(PowerPCCPU *cpu, ppc_hash_pte64_t pte) · line 381

Quoted 3 lines
target/ppc/mmu-hash64.c +1 -1
-    /* fprintf(stderr, "AMR protection: key=%d AMR=0x%" PRIx64 "\n", key, */
+    /* error_report("AMR protection: key=%d AMR=0x%" PRIx64 "", key, */
     /*         env->spr[SPR_AMR]); */

It's just a comment but still - indentation in the second line is wrong here, too.

I fixed all the other comments.

Thanks,
Alistair

Quoted 2 lines

Thomas

Acked-by on v3 41/46
#65 lore raw

Re: [Qemu-devel] [PATCH v3 41/46] hw/xen*: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 38 lines · Alistair Francis

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}' \
    {} +
Quoted 7 lines

Some lines where then manually tweaked to pass checkpatch.

xen_pt_log() was left with an fprintf(stderr,

Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Signature · 1 line
Anthony PERARD
Reviewed-by on v3 16/46
#34 lore raw

Re: [Qemu-devel] [PATCH v3 16/46] hw/ide: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis

Hi Alistair,

Quoted 55 lines · Alistair Francis

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}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

---
V2:
- Split hw patch into individual directories

 hw/ide/ahci.c | 6 +++---
 hw/ide/core.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
hw/ide/ahci.c +0 -0
index c25e293d88..2ed015285a 100644

hw/ide/ahci.c static void ahci_mem_write(void *opaque, hwaddr addr, · line 414

Quoted 7 lines
hw/ide/ahci.c +2 -2
@@ -410,8 +410,8 @@ static void ahci_mem_write(void *opaque, hwaddr addr,
 
     /* Only aligned reads are allowed on AHCI */
     if (addr & 3) {
-        fprintf(stderr, "ahci: Mis-aligned write to addr 0x"
-                TARGET_FMT_plx "\n", addr);
+        error_report("ahci: Mis-aligned write to addr 0x"
+                     TARGET_FMT_plx "", addr);

removing this trailing "":

Quoted 17 lines
hw/ide/ahci.c +1 -1
         return;
     }
 
@@ -1053,7 +1053,7 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
     g_assert(is_ncq(ncq_fis->command));
     if (ncq_tfs->used) {
         /* error - already in use */
-        fprintf(stderr, "%s: tag %d already used\n", __func__, tag);
+        error_report("%s: tag %d already used", __func__, tag);
         return;
     }
 
hw/ide/core.c +0 -0
index 5f1cd3b91f..0ea34f62ba 100644

hw/ide/core.c static int ide_drive_pio_pre_save(void *opaque) · line 2766

Quoted 6 lines
hw/ide/core.c +1 -1
@@ -2762,7 +2762,7 @@ static int ide_drive_pio_pre_save(void *opaque)
 
     idx = transfer_end_table_idx(s->end_transfer_func);
     if (idx == -1) {
-        fprintf(stderr, "%s: invalid end_transfer_func for DRQ_STAT\n",
+        error_report("%s: invalid end_transfer_func for DRQ_STAT",
                         __func__);

eventually indent this line?

                        __func__);
Quoted 2 lines
hw/ide/core.c +0 -0
         s->end_transfer_fn_idx = 2;
     } else {
Reviewed-by on v3 34/46
#56 lore raw

Re: [Qemu-devel] [PATCH v3 34/46] hw/sd: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 107 lines · Alistair Francis

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}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

Some of the prints in hw/sd/sd.c were manually converted to using DPRINTF() instead.

---
V3:
- Fixup some DPRINTF() prints being wrong
V2:
- Split hw patch into individual directories

 hw/sd/pl181.c |  5 +++--
 hw/sd/sd.c    | 15 ++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)
hw/sd/pl181.c +3 -2
index 55c8098ecd..2b878a0c5e 100644
@@ -8,6 +8,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
@@ -146,7 +147,7 @@ static void pl181_fifo_push(PL181State *s, uint32_t value)
     int n;
 
     if (s->fifo_len == PL181_FIFO_LEN) {
-        fprintf(stderr, "pl181: FIFO overflow\n");
+        error_report("pl181: FIFO overflow");
         return;
     }
     n = (s->fifo_pos + s->fifo_len) & (PL181_FIFO_LEN - 1);
@@ -160,7 +161,7 @@ static uint32_t pl181_fifo_pop(PL181State *s)
     uint32_t value;
 
     if (s->fifo_len == 0) {
-        fprintf(stderr, "pl181: FIFO underflow\n");
+        error_report("pl181: FIFO underflow");
         return 0;
     }
     value = s->fifo[s->fifo_pos];
hw/sd/sd.c +2 -2
index 35347a5bbc..5d7fa3e418 100644
@@ -700,7 +700,7 @@ static void sd_lock_command(SDState *sd)
         sd->card_status &= ~CARD_IS_LOCKED;
         sd->pwd_len = 0;
         /* Erasing the entire card here! */
-        fprintf(stderr, "SD: Card force-erased by CMD42\n");
+        error_report("SD: Card force-erased by CMD42");
         return;
     }
 
@@ -1282,7 +1282,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
         return sd_r1;
 
     case 56:	/* CMD56:  GEN_CMD */
-        fprintf(stderr, "SD: GEN_CMD 0x%08x\n", req.arg);
+        error_report("SD: GEN_CMD 0x%08x", req.arg);
 
         switch (sd->state) {
         case sd_transfer_state:

hw/sd/sd.c send_response: · line 1570

Quoted 10 lines
hw/sd/sd.c +4 -3
@@ -1564,9 +1564,10 @@ send_response:
     if (rsplen) {
         int i;
         DPRINTF("Response:");
-        for (i = 0; i < rsplen; i++)
-            fprintf(stderr, " %02x", response[i]);
-        fprintf(stderr, " state %d\n", sd->state);
+        for (i = 0; i < rsplen; i++) {
+            DPRINTF(" %02x", response[i]);
+        }
+        DPRINTF(" state %d\n", sd->state);

We'll get ride of those later.

Quoted 21 lines
hw/sd/sd.c +2 -2
     } else {
         DPRINTF("No response %d\n", sd->state);
     }
@@ -1580,14 +1581,14 @@ static void sd_blk_read(SDState *sd, uint64_t addr, uint32_t len)
     DPRINTF("sd_blk_read: addr = 0x%08llx, len = %d\n",
             (unsigned long long) addr, len);
     if (!sd->blk || blk_pread(sd->blk, addr, sd->data, len) < 0) {
-        fprintf(stderr, "sd_blk_read: read error on host side\n");
+        error_report("sd_blk_read: read error on host side");
     }
 }
 
 static void sd_blk_write(SDState *sd, uint64_t addr, uint32_t len)
 {
     if (!sd->blk || blk_pwrite(sd->blk, addr, sd->data, len, 0) < 0) {
-        fprintf(stderr, "sd_blk_write: write error on host side\n");
+        error_report("sd_blk_write: write error on host side");
     }
 }
 
#63 lore raw

Re: [Qemu-devel] [PATCH v3 40/46] hw/watchdog: Replace fprintf(stderr, "*\n" with error_report()

In reply to Alistair Francis
Quoted 62 lines · Alistair Francis

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}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

---
V2:
- Split hw patch into individual directories

 hw/watchdog/watchdog.c     | 9 +++++----
 hw/watchdog/wdt_i6300esb.c | 8 +++++---
 2 files changed, 10 insertions(+), 7 deletions(-)
hw/watchdog/watchdog.c +1 -0
index 670114ecfe..d6d11ef1e5 100644
@@ -20,6 +20,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/queue.h"

hw/watchdog/watchdog.c int select_watchdog(const char *p) · line 57

Quoted 6 lines
hw/watchdog/watchdog.c +1 -1
@@ -52,7 +53,7 @@ int select_watchdog(const char *p)
     /* -watchdog ? lists available devices and exits cleanly. */
     if (is_help_option(p)) {
         QLIST_FOREACH(model, &watchdog_list, entry) {
-            fprintf(stderr, "\t%s\t%s\n",
+            error_report("\t%s\t%s",
                      model->wdt_name, model->wdt_description);

align?

hw/watchdog/watchdog.c int select_watchdog(const char *p) · line 75

Quoted 12 lines
hw/watchdog/watchdog.c +2 -2
         }
         return 2;
@@ -68,9 +69,9 @@ int select_watchdog(const char *p)
         }
     }
 
-    fprintf(stderr, "Unknown -watchdog device. Supported devices are:\n");
+    error_report("Unknown -watchdog device. Supported devices are:");
     QLIST_FOREACH(model, &watchdog_list, entry) {
-        fprintf(stderr, "\t%s\t%s\n",
+        error_report("\t%s\t%s",
                  model->wdt_name, model->wdt_description);

align?

Quoted 25 lines
hw/watchdog/watchdog.c +1 -1
     }
     return 1;
@@ -126,7 +127,7 @@ void watchdog_perform_action(void)
 
     case WATCHDOG_ACTION_DEBUG:
         qapi_event_send_watchdog(WATCHDOG_ACTION_DEBUG, &error_abort);
-        fprintf(stderr, "watchdog: timer fired\n");
+        error_report("watchdog: timer fired");
         break;
 
     case WATCHDOG_ACTION_NONE:
hw/watchdog/wdt_i6300esb.c +1 -1
index e596b0804d..c5f5190e55 100644
@@ -20,7 +20,7 @@
  */
 
 #include "qemu/osdep.h"
-
+#include "qemu/error-report.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "sysemu/watchdog.h"

hw/watchdog/wdt_i6300esb.c static void i6300esb_timer_expired(void *vp) · line 190

Quoted 6 lines
hw/watchdog/wdt_i6300esb.c +2 -1
@@ -186,10 +186,12 @@ static void i6300esb_timer_expired(void *vp)
         /* What to do at the end of stage 1? */
         switch (d->int_type) {
         case INT_TYPE_IRQ:
-            fprintf(stderr, "i6300esb_timer_expired: I would send APIC 1 INT 10 here if I knew how (XXX)\n");
+            error_report("i6300esb_timer_expired: I would send APIC 1 INT 10"
+                          "here if I knew how (XXX)");

I'm not sure this is an useful message...

What about:

qemu_log_mask(LOG_UNIMP,
"i6300esb: tmr expired but System " "APIC 1 INT10 _NOT_ emitted\n");

hw/watchdog/wdt_i6300esb.c static void i6300esb_timer_expired(void *vp) · line 194

Quoted 5 lines
hw/watchdog/wdt_i6300esb.c +2 -1
             break;
         case INT_TYPE_SMI:
-            fprintf(stderr, "i6300esb_timer_expired: I would send SMI here if I knew how (XXX)\n");
+            error_report("i6300esb_timer_expired: I would send SMI here if I"
+                         "knew how (XXX)");

qemu_log_mask(LOG_UNIMP,
"i6300esb: tmr expired but System " "Management Interrupt _NOT_ emitted\n");

Quoted 4 lines
hw/watchdog/wdt_i6300esb.c +0 -0
             break;
         }
 
Reviewed-by on v3 1/46
#2 lore raw

Re: [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Alistair Francis
Quoted 15 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

One line in hcd-musb.c was manually tweaked to pass checkpatch.

Cc Gerd Hoffmann <[email protected]>
Cc Andrzej Zaborowski <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc John Snow <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Yongbok Kim <[email protected]>
Cc Peter Crosthwaite <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 8 lines
Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v3 1/46
#3 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Alistair Francis
Quoted 15 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

One line in hcd-musb.c was manually tweaked to pass checkpatch.

Cc Gerd Hoffmann <[email protected]>
Cc Andrzej Zaborowski <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc John Snow <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Yongbok Kim <[email protected]>
Cc Peter Crosthwaite <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 8 lines
Signature · 1 line
Anthony PERARD
Reviewed-by on v3 1/46
#4 lore raw

Re: [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Alistair Francis
Quoted 15 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

One line in hcd-musb.c was manually tweaked to pass checkpatch.

Cc Gerd Hoffmann <[email protected]>
Cc Andrzej Zaborowski <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc John Snow <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Yongbok Kim <[email protected]>
Cc Peter Crosthwaite <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 8 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 13 lines
audio/audio_int.h +1 -1
index 5bcb1c60e1..543b1bd8d5 100644
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Later, Juan.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v3 1/46
#5 lore raw

Re: [Qemu-arm] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Alistair Francis
Quoted 15 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

One line in hcd-musb.c was manually tweaked to pass checkpatch.

Cc Gerd Hoffmann <[email protected]>
Cc Andrzej Zaborowski <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc John Snow <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Yongbok Kim <[email protected]>
Cc Peter Crosthwaite <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 8 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 13 lines
audio/audio_int.h +1 -1
index 5bcb1c60e1..543b1bd8d5 100644
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Later, Juan.

Acked-by
#35 lore raw

Re: [Qemu-devel] [Qemu-block] [PATCH v3 16/46] hw/ide: Replace fprintf(stderr, "*\n" with error_report()

In reply to Philippe Mathieu-Daudé
Quoted 67 lines · Philippe Mathieu-Daudé

Hi Alistair,

Quoted 55 lines · Alistair Francis

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}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

---
V2:
- Split hw patch into individual directories

 hw/ide/ahci.c | 6 +++---
 hw/ide/core.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
hw/ide/ahci.c +0 -0
index c25e293d88..2ed015285a 100644

hw/ide/ahci.c static void ahci_mem_write(void *opaque, hwaddr addr, · line 414

Quoted 7 lines
hw/ide/ahci.c +2 -2
@@ -410,8 +410,8 @@ static void ahci_mem_write(void *opaque, hwaddr addr,
 
     /* Only aligned reads are allowed on AHCI */
     if (addr & 3) {
-        fprintf(stderr, "ahci: Mis-aligned write to addr 0x"
-                TARGET_FMT_plx "\n", addr);
+        error_report("ahci: Mis-aligned write to addr 0x"
+                     TARGET_FMT_plx "", addr);

removing this trailing "":

Quoted 2 lines

^ ACK

Quoted 32 lines
Quoted 17 lines
hw/ide/ahci.c +1 -1
         return;
     }
 
@@ -1053,7 +1053,7 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
     g_assert(is_ncq(ncq_fis->command));
     if (ncq_tfs->used) {
         /* error - already in use */
-        fprintf(stderr, "%s: tag %d already used\n", __func__, tag);
+        error_report("%s: tag %d already used", __func__, tag);
         return;
     }
 
hw/ide/core.c +0 -0
index 5f1cd3b91f..0ea34f62ba 100644

hw/ide/core.c static int ide_drive_pio_pre_save(void *opaque) · line 2766

Quoted 6 lines
hw/ide/core.c +1 -1
@@ -2762,7 +2762,7 @@ static int ide_drive_pio_pre_save(void *opaque)
 
     idx = transfer_end_table_idx(s->end_transfer_func);
     if (idx == -1) {
-        fprintf(stderr, "%s: invalid end_transfer_func for DRQ_STAT\n",
+        error_report("%s: invalid end_transfer_func for DRQ_STAT",
                         __func__);

eventually indent this line?

                        __func__);
Quoted 2 lines
hw/ide/core.c +0 -0
         s->end_transfer_fn_idx = 2;
     } else {
#6 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Juan Quintela
Quoted 35 lines · Juan Quintela
Quoted 15 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

One line in hcd-musb.c was manually tweaked to pass checkpatch.

Cc Gerd Hoffmann <[email protected]>
Cc Andrzej Zaborowski <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc John Snow <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Yongbok Kim <[email protected]>
Cc Peter Crosthwaite <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 8 lines
Quoted 7 lines
audio/audio_int.h +0 -0
index 5bcb1c60e1..543b1bd8d5 100644
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
Quoted 9 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 6 lines
audio/audio_int.h +1 -1
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Juan Quintela
Quoted 35 lines · Juan Quintela
Quoted 15 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

One line in hcd-musb.c was manually tweaked to pass checkpatch.

Cc Gerd Hoffmann <[email protected]>
Cc Andrzej Zaborowski <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc John Snow <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Yongbok Kim <[email protected]>
Cc Peter Crosthwaite <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 8 lines
Quoted 7 lines
audio/audio_int.h +0 -0
index 5bcb1c60e1..543b1bd8d5 100644
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
Quoted 9 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 6 lines
audio/audio_int.h +1 -1
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

#8 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

Quoted 21 lines · Markus Armbruster
Quoted 9 lines · Juan Quintela
Quoted 8 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

+++ b/audio/audio_int.h

audio/audio_int.h +0 -0
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
Quoted 9 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 6 lines
audio/audio_int.h +1 -1
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Markus Armbruster
Quoted 21 lines · Markus Armbruster
Quoted 9 lines · Juan Quintela
Quoted 8 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

+++ b/audio/audio_int.h

audio/audio_int.h +0 -0
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
Quoted 9 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 6 lines
audio/audio_int.h +1 -1
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#10 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

Quoted 22 lines · Eric Blake
Quoted 21 lines · Markus Armbruster
Quoted 18 lines · Juan Quintela
Quoted 6 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

+++ b/audio/audio_int.h

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 8 lines
audio/audio_int.h +1 -1
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Quoted 7 lines
Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Eric Blake
Quoted 22 lines · Eric Blake
Quoted 21 lines · Markus Armbruster
Quoted 18 lines · Juan Quintela
Quoted 6 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

+++ b/audio/audio_int.h

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 8 lines
audio/audio_int.h +1 -1
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Quoted 7 lines
Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

#12 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

Quoted 29 lines · Markus Armbruster
Quoted 27 lines · Eric Blake
Quoted 25 lines · Markus Armbruster
Quoted 9 lines · Juan Quintela
Quoted 8 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

+++ b/audio/audio_int.h

audio/audio_int.h +0 -0
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
Quoted 9 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 6 lines
audio/audio_int.h +1 -1
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Quoted 6 lines
Quoted 2 lines

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

I would really like to avoid that, as the conflicts will be a bit of a mess. The way I see it there will be a lot of churn no matter what, so we don't gain much by swapping the order around.

I have a new series ready to send today, so I'm going to send that through as I would like at least some of these patches to make it in 2.11. After that if you think strongly the order should be changed I can change it in the next version.

Thanks,
Alistair

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Markus Armbruster
Quoted 29 lines · Markus Armbruster
Quoted 27 lines · Eric Blake
Quoted 25 lines · Markus Armbruster
Quoted 9 lines · Juan Quintela
Quoted 8 lines · Alistair Francis

Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC specific __func__.

+++ b/audio/audio_int.h

audio/audio_int.h +0 -0
@@ -253,7 +253,7 @@ static inline int audio_ring_dist (int dst, int src, int len)
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
 
Quoted 9 lines

audio/audio_int.h static inline int audio_ring_dist (int dst, int src, int len) · line 259

Quoted 6 lines
audio/audio_int.h +1 -1
 #if defined _MSC_VER || defined __GNUC__
-#define AUDIO_FUNC __FUNCTION__
+#define AUDIO_FUNC __func__
 #else
 #define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
 #endif

Unrelated to this patch ....
Do we really support other compilers than msc and gcc?

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Quoted 6 lines
Quoted 2 lines

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

I would really like to avoid that, as the conflicts will be a bit of a mess. The way I see it there will be a lot of churn no matter what, so we don't gain much by swapping the order around.

I have a new series ready to send today, so I'm going to send that through as I would like at least some of these patches to make it in 2.11. After that if you think strongly the order should be changed I can change it in the next version.

Thanks,
Alistair

#14 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

Quoted 12 lines · Alistair Francis
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

Quoted 8 lines

I would really like to avoid that, as the conflicts will be a bit of a mess. The way I see it there will be a lot of churn no matter what, so we don't gain much by swapping the order around.

I have a new series ready to send today, so I'm going to send that through as I would like at least some of these patches to make it in 2.11. After that if you think strongly the order should be changed I can change it in the next version.

I think the reorder is not that hard. Put 3/46 first (changing AUDIO_FUNC to __func__), and then 1/46 doesn't have to touch any of the files that used to use AUDIO_FUNC, because there is no intermediate state using __FUNCTION__.

If I'm reading it correctly, the rebase conflict is limited to a slight rewording of the commit message for 3/46, and one line in 1/46 to the definition of AUDIO_FUNC (that will no longer be present).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Alistair Francis
Quoted 12 lines · Alistair Francis
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

Quoted 8 lines

I would really like to avoid that, as the conflicts will be a bit of a mess. The way I see it there will be a lot of churn no matter what, so we don't gain much by swapping the order around.

I have a new series ready to send today, so I'm going to send that through as I would like at least some of these patches to make it in 2.11. After that if you think strongly the order should be changed I can change it in the next version.

I think the reorder is not that hard. Put 3/46 first (changing AUDIO_FUNC to __func__), and then 1/46 doesn't have to touch any of the files that used to use AUDIO_FUNC, because there is no intermediate state using __FUNCTION__.

If I'm reading it correctly, the rebase conflict is limited to a slight rewording of the commit message for 3/46, and one line in 1/46 to the definition of AUDIO_FUNC (that will no longer be present).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#16 lore raw

Re: [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

Quoted 23 lines · Eric Blake
Quoted 12 lines · Alistair Francis
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

Quoted 8 lines

I would really like to avoid that, as the conflicts will be a bit of a mess. The way I see it there will be a lot of churn no matter what, so we don't gain much by swapping the order around.

I have a new series ready to send today, so I'm going to send that through as I would like at least some of these patches to make it in 2.11. After that if you think strongly the order should be changed I can change it in the next version.

Quoted 8 lines

I think the reorder is not that hard. Put 3/46 first (changing AUDIO_FUNC to __func__), and then 1/46 doesn't have to touch any of the files that used to use AUDIO_FUNC, because there is no intermediate state using __FUNCTION__.

If I'm reading it correctly, the rebase conflict is limited to a slight rewording of the commit message for 3/46, and one line in 1/46 to the definition of AUDIO_FUNC (that will no longer be present).

That's true, it didn't end up being that hard. I'm launching my tests now, so I should be able to send the series out later today.

Hopefully some of this can make it in 2.11 :)

Thanks,
Alistair

Quoted 6 lines

--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#17 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

In reply to Eric Blake
Quoted 23 lines · Eric Blake
Quoted 12 lines · Alistair Francis
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Let me rephrase the question: do we really support compilers that don't understand __func__? The presence of numerous unconditional uses of __func__ in the tree means the answer is no. Let's replace AUDIO_FUNC by plain __func__.

Answered elsewhere in patch 3/46 (where we DO replace AUDIO_FUNC by __func__).

I see.

Put 03/46 first, so we don't have to mess with AUDIO_FUNC twice?

Quoted 8 lines

I would really like to avoid that, as the conflicts will be a bit of a mess. The way I see it there will be a lot of churn no matter what, so we don't gain much by swapping the order around.

I have a new series ready to send today, so I'm going to send that through as I would like at least some of these patches to make it in 2.11. After that if you think strongly the order should be changed I can change it in the next version.

Quoted 8 lines

I think the reorder is not that hard. Put 3/46 first (changing AUDIO_FUNC to __func__), and then 1/46 doesn't have to touch any of the files that used to use AUDIO_FUNC, because there is no intermediate state using __FUNCTION__.

If I'm reading it correctly, the rebase conflict is limited to a slight rewording of the commit message for 3/46, and one line in 1/46 to the definition of AUDIO_FUNC (that will no longer be present).

That's true, it didn't end up being that hard. I'm launching my tests now, so I should be able to send the series out later today.

Hopefully some of this can make it in 2.11 :)

Thanks,
Alistair

Quoted 6 lines

--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org