On 09/10/2023 13.45, Michael S. Tsirkin wrote:
On Mon, Oct 09, 2023 at 10:37:25AM +0200, Thomas Huth wrote:
Rename some variables to avoid compiler warnings when compiling
with -Wshadow=local.
Signed-off-by: Thomas Huth <th...@redhat.com>
---
v2: Renamed the variable to something more unique
contrib/vhost-user-gpu/vugpu.h | 8 ++++----
contrib/vhost-user-gpu/vhost-user-gpu.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h
index 509b679f03..654c392fbb 100644
--- a/contrib/vhost-user-gpu/vugpu.h
+++ b/contrib/vhost-user-gpu/vugpu.h
@@ -164,12 +164,12 @@ struct virtio_gpu_ctrl_command {
};
#define VUGPU_FILL_CMD(out) do { \
- size_t s; \
- s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \
+ size_t vugpufillcmd_s_ = \
+ iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \
&out, sizeof(out)); \
- if (s != sizeof(out)) { \
+ if (vugpufillcmd_s_ != sizeof(out)) { \
g_critical("%s: command size incorrect %zu vs %zu", \
- __func__, s, sizeof(out)); \
+ __func__, vugpufillcmd_s_, sizeof(out)); \
return; \
} \
} while (0)
I think I prefer VUGPU_FILL_CMD_s or VUGPU_FILL_CMD_s_ - makes it clear
it's related to a macro.
I have to say that I don't like that ... it's a variable after all, and
naming it with capital letters looks rather confusing that helpful to me. I
think it should be enough to have the underscore at the end here to make it
unique enough.
Thomas