[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 22/22] softmmu/physmem: Clean up local variable shadowing
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH v2 22/22] softmmu/physmem: Clean up local variable shadowing |
Date: |
Mon, 4 Sep 2023 18:12:34 +0200 |
Fix:
softmmu/physmem.c: In function ‘cpu_physical_memory_snapshot_and_clear_dirty’:
softmmu/physmem.c:916:27: warning: declaration of ‘offset’ shadows a
parameter [-Wshadow=compatible-local]
916 | unsigned long offset = page % DIRTY_MEMORY_BLOCK_SIZE;
| ^~~~~~
softmmu/physmem.c:892:31: note: shadowed declaration is here
892 | (MemoryRegion *mr, hwaddr offset, hwaddr length, unsigned client)
| ~~~~~~~^~~~~~
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
RFC: Please double-check how 'offset' is used few lines later.
---
softmmu/physmem.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 18277ddd67..db5b628a60 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -913,16 +913,16 @@ DirtyBitmapSnapshot
*cpu_physical_memory_snapshot_and_clear_dirty
while (page < end) {
unsigned long idx = page / DIRTY_MEMORY_BLOCK_SIZE;
- unsigned long offset = page % DIRTY_MEMORY_BLOCK_SIZE;
+ unsigned long ofs = page % DIRTY_MEMORY_BLOCK_SIZE;
unsigned long num = MIN(end - page,
- DIRTY_MEMORY_BLOCK_SIZE - offset);
+ DIRTY_MEMORY_BLOCK_SIZE - ofs);
- assert(QEMU_IS_ALIGNED(offset, (1 << BITS_PER_LEVEL)));
+ assert(QEMU_IS_ALIGNED(ofs, (1 << BITS_PER_LEVEL)));
assert(QEMU_IS_ALIGNED(num, (1 << BITS_PER_LEVEL)));
- offset >>= BITS_PER_LEVEL;
+ ofs >>= BITS_PER_LEVEL;
bitmap_copy_and_clear_atomic(snap->dirty + dest,
- blocks->blocks[idx] + offset,
+ blocks->blocks[idx] + ofs,
num);
page += num;
dest += num >> BITS_PER_LEVEL;
--
2.41.0
- [PATCH v2 16/22] crypto/cipher-gnutls.c: Clean up local variable shadowing, (continued)
- [PATCH v2 16/22] crypto/cipher-gnutls.c: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 17/22] util/vhost-user-server: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 18/22] semihosting/arm-compat: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 19/22] linux-user/strace: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 20/22] sysemu/device_tree: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [RFC PATCH v2 22/22] softmmu/physmem: Clean up local variable shadowing,
Philippe Mathieu-Daudé <=
- [PATCH v2 21/22] softmmu/memory: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- Re: [PATCH v2 00/22] (few more) Steps towards enabling -Wshadow, Markus Armbruster, 2023/09/29