diff mbox series

[2/3] exec: avoid using C++ keywords in function parameters

Message ID 20240618224553.878869-1-rkir@google.com (mailing list archive)
State New, archived
Headers show
Series [1/3] exec: Make the MemOp enum cast explicit | expand

Commit Message

Roman Kiryanov June 18, 2024, 10:45 p.m. UTC
to use the QEMU headers with a C++ compiler.

Google-Bug-Id: 331190993
Change-Id: Ic4e49b9c791616bb22c973922772b0494706092c
Signed-off-by: Roman Kiryanov <rkir@google.com>
---
 include/exec/memory.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Henderson June 18, 2024, 10:59 p.m. UTC | #1
On 6/18/24 15:45, Roman Kiryanov wrote:
> to use the QEMU headers with a C++ compiler.
> 
> Google-Bug-Id: 331190993
> Change-Id: Ic4e49b9c791616bb22c973922772b0494706092c
> Signed-off-by: Roman Kiryanov<rkir@google.com>
> ---
>   include/exec/memory.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Philippe Mathieu-Daudé June 19, 2024, 10:22 a.m. UTC | #2
On 19/6/24 00:45, Roman Kiryanov wrote:
> to use the QEMU headers with a C++ compiler.
> 
> Google-Bug-Id: 331190993
> Change-Id: Ic4e49b9c791616bb22c973922772b0494706092c
> Signed-off-by: Roman Kiryanov <rkir@google.com>
> ---
>   include/exec/memory.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 1be58f694c..d7591a60d9 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -945,7 +945,7 @@ struct MemoryListener {
>        * the current transaction.
>        */
>       void (*log_start)(MemoryListener *listener, MemoryRegionSection *section,
> -                      int old, int new);
> +                      int old_val, int new_val);
>   
>       /**
>        * @log_stop:
> @@ -964,7 +964,7 @@ struct MemoryListener {
>        * the current transaction.
>        */
>       void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section,
> -                     int old, int new);
> +                     int old_val, int new_val);

OK but please keep the implementations in sync with the prototype
argument names:

accel/hvf/hvf-accel-ops.c:264: 
MemoryRegionSection *section, int old, int new)
accel/hvf/hvf-accel-ops.c:274: 
MemoryRegionSection *section, int old, int new)
accel/kvm/kvm-all.c:549:                          int old, int new)
accel/kvm/kvm-all.c:566:                          int old, int new)
hw/i386/xen/xen-hvm.c:430:                          int old, int new)
hw/i386/xen/xen-hvm.c:441:                         int old, int new)
hw/virtio/vhost.c:1070:                            int old, int new)
hw/virtio/vhost.c:1077:                           int old, int new)
include/exec/memory.h:948:                      int old, int new);
include/exec/memory.h:967:                     int old, int new);

See also:
target/arm/tcg/translate-a64.c:2161:        int new = a->imm * 3;
target/sparc/trace-events:23:sparc64_cpu_check_irqs_set_irq(unsigned int 
i, int old, int new) "Set CPU IRQ %d old=0x%x new=0x%x"
util/lockcnt.c:81:            int new = expected - 
QEMU_LOCKCNT_STATE_LOCKED + QEMU_LOCKCNT_STATE_WAITING;
util/trace-events:65:lockcnt_fast_path_attempt(const void *lockcnt, int 
expected, int new) "lockcnt %p fast path %d->%d"
util/trace-events:66:lockcnt_fast_path_success(const void *lockcnt, int 
expected, int new) "lockcnt %p fast path %d->%d succeeded"
util/trace-events:67:lockcnt_unlock_attempt(const void *lockcnt, int 
expected, int new) "lockcnt %p unlock %d->%d"
util/trace-events:68:lockcnt_unlock_success(const void *lockcnt, int 
expected, int new) "lockcnt %p unlock %d->%d succeeded"
util/trace-events:69:lockcnt_futex_wait_prepare(const void *lockcnt, int 
expected, int new) "lockcnt %p preparing slow path %d->%d"
util/trace-events:71:lockcnt_futex_wait_resume(const void *lockcnt, int 
new) "lockcnt %p after wait: %d"

and:
$ git grep -wE 'u?int(8|16|32|64)_t new'
hw/core/trace-events:28:clock_set(const char *clk, uint64_t old, 
uint64_t new) "'%s', %"PRIu64"Hz->%"PRIu64"Hz"
hw/display/trace-events:5:jazz_led_write(uint64_t addr, uint8_t new) 
"write addr=0x%"PRIx64": 0x%x"
hw/display/trace-events:14:g364fb_write(uint64_t addr, uint32_t new) 
"write addr=0x%"PRIx64": 0x%x"
hw/gpio/aspeed_gpio.c:276:    uint32_t new = value;
hw/ide/trace-events:70:ahci_check_irq(void *s, uint32_t old, uint32_t 
new) "ahci(%p): check irq 0x%08x --> 0x%08x"
hw/ide/trace-events:71:ahci_trigger_irq(void *s, int port, const char 
*name, uint32_t val, uint32_t old, uint32_t new, uint32_t effective) 
"ahci(%p)[%d]: trigger irq +%s (0x%08x); irqstat: 0x%08x --> 0x%08x; 
effective: 0x%08x"
hw/intc/aspeed_vic.c:47:    uint64_t new = (s->raw & s->enable);
hw/intc/imx_avic.c:63:    uint64_t new = s->pending & s->enabled;
hw/net/opencores_eth.c:304:        uint32_t old, uint32_t new)
hw/net/rocker/rocker.c:762:static void 
rocker_port_phys_enable_write(Rocker *r, uint64_t new)
hw/net/rocker/rocker_desc.c:252:bool desc_ring_set_head(DescRing *ring, 
uint32_t new)
hw/net/rocker/rocker_desc.h:35:bool desc_ring_set_head(DescRing *ring, 
uint32_t new);
hw/net/trace-events:208:e1000e_irq_clear(uint32_t offset, uint32_t old, 
uint32_t new) "Clearing interrupt register 0x%x: 0x%x --> 0x%x"
hw/net/trace-events:209:e1000e_irq_set(uint32_t offset, uint32_t old, 
uint32_t new) "Setting interrupt register 0x%x: 0x%x --> 0x%x"
hw/ssi/aspeed_smc.c:285: 
uint64_t new)
hw/timer/aspeed_timer.c:380:                                 uint8_t 
old, uint8_t new)
hw/timer/hpet.c:137:static uint64_t hpet_fixup_reg(uint64_t new, 
uint64_t old, uint64_t mask)
hw/timer/hpet.c:144:static int activating_bit(uint64_t old, uint64_t 
new, uint64_t mask)
hw/timer/hpet.c:149:static int deactivating_bit(uint64_t old, uint64_t 
new, uint64_t mask)
hw/usb/trace-events:82:usb_ehci_opreg_change(uint32_t addr, const char 
*str, uint32_t new, uint32_t old) "ch mmio 0x%04x [%s] = 0x%x (old: 0x%x)"
hw/usb/trace-events:85:usb_ehci_portsc_change(uint32_t addr, uint32_t 
port, uint32_t new, uint32_t old) "ch mmio 0x%04x [port %d] = 0x%x (old: 
0x%x)"
hw/virtio/trace-events:134:virtio_iommu_set_page_size_mask(const char 
*name, uint64_t old, uint64_t new) "mr=%s old_mask=0x%"PRIx64" 
new_mask=0x%"PRIx64
hw/virtio/virtio.c:2406:                                    uint16_t 
off_wrap, uint16_t new,
include/hw/timer/a9gtimer.h:94:    uint64_t new;
target/arm/cpu.h:1202:void aarch64_set_svcr(CPUARMState *env, uint64_t 
new, uint64_t mask);
target/arm/helper.c:7350:void aarch64_set_svcr(CPUARMState *env, 
uint64_t new, uint64_t mask)
target/arm/tcg/mte_helper.c:334:        uint8_t new = deposit32(old, 
ofs, 4, tag);
target/i386/tcg/sysemu/excp_helper.c:107:static bool ptw_setl_slow(const 
PTETranslate *in, uint32_t old, uint32_t new)
target/i386/tcg/sysemu/excp_helper.c:124:        uint32_t new = old | set;
util/trace-events:6:poll_shrink(void *ctx, int64_t old, int64_t new) 
"ctx %p old %"PRId64" new %"PRId64
util/trace-events:7:poll_grow(void *ctx, int64_t old, int64_t new) "ctx 
%p old %"PRId64" new %"PRId64
Richard Henderson June 20, 2024, 1:47 a.m. UTC | #3
On 6/19/24 03:22, Philippe Mathieu-Daudé wrote:
> On 19/6/24 00:45, Roman Kiryanov wrote:
>> to use the QEMU headers with a C++ compiler.
>>
>> Google-Bug-Id: 331190993
>> Change-Id: Ic4e49b9c791616bb22c973922772b0494706092c
>> Signed-off-by: Roman Kiryanov <rkir@google.com>
>> ---
>>   include/exec/memory.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/exec/memory.h b/include/exec/memory.h
>> index 1be58f694c..d7591a60d9 100644
>> --- a/include/exec/memory.h
>> +++ b/include/exec/memory.h
>> @@ -945,7 +945,7 @@ struct MemoryListener {
>>        * the current transaction.
>>        */
>>       void (*log_start)(MemoryListener *listener, MemoryRegionSection *section,
>> -                      int old, int new);
>> +                      int old_val, int new_val);
>>       /**
>>        * @log_stop:
>> @@ -964,7 +964,7 @@ struct MemoryListener {
>>        * the current transaction.
>>        */
>>       void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section,
>> -                     int old, int new);
>> +                     int old_val, int new_val);
> 
> OK but please keep the implementations in sync with the prototype
> argument names:
> 
> accel/hvf/hvf-accel-ops.c:264: MemoryRegionSection *section, int old, int new)
> accel/hvf/hvf-accel-ops.c:274: MemoryRegionSection *section, int old, int new)
> accel/kvm/kvm-all.c:549:                          int old, int new)
> accel/kvm/kvm-all.c:566:                          int old, int new)
> hw/i386/xen/xen-hvm.c:430:                          int old, int new)
> hw/i386/xen/xen-hvm.c:441:                         int old, int new)
> hw/virtio/vhost.c:1070:                            int old, int new)
> hw/virtio/vhost.c:1077:                           int old, int new)
> include/exec/memory.h:948:                      int old, int new);
> include/exec/memory.h:967:                     int old, int new);
> 
> See also:
> target/arm/tcg/translate-a64.c:2161:        int new = a->imm * 3;

We're not trying to purge "new" from the entire tree, only (some) header files.


r~
Paolo Bonzini June 20, 2024, 6:03 p.m. UTC | #4
On 6/19/24 00:45, Roman Kiryanov wrote:
> to use the QEMU headers with a C++ compiler.
> 
> Google-Bug-Id: 331190993
> Change-Id: Ic4e49b9c791616bb22c973922772b0494706092c
> Signed-off-by: Roman Kiryanov <rkir@google.com>
> ---
>   include/exec/memory.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 1be58f694c..d7591a60d9 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -945,7 +945,7 @@ struct MemoryListener {
>        * the current transaction.
>        */
>       void (*log_start)(MemoryListener *listener, MemoryRegionSection *section,
> -                      int old, int new);
> +                      int old_val, int new_val);
>   
>       /**
>        * @log_stop:
> @@ -964,7 +964,7 @@ struct MemoryListener {
>        * the current transaction.
>        */
>       void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section,
> -                     int old, int new);
> +                     int old_val, int new_val);
>   
>       /**
>        * @log_sync:

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 1be58f694c..d7591a60d9 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -945,7 +945,7 @@  struct MemoryListener {
      * the current transaction.
      */
     void (*log_start)(MemoryListener *listener, MemoryRegionSection *section,
-                      int old, int new);
+                      int old_val, int new_val);
 
     /**
      * @log_stop:
@@ -964,7 +964,7 @@  struct MemoryListener {
      * the current transaction.
      */
     void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section,
-                     int old, int new);
+                     int old_val, int new_val);
 
     /**
      * @log_sync: