* [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow
@ 2023-10-06 17:35 Thomas Huth
2023-10-08 6:47 ` Marc-André Lureau
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Huth @ 2023-10-06 17:35 UTC (permalink / raw)
To: Marc-André Lureau, Gerd Hoffmann, Michael S. Tsirkin, qemu-devel
Cc: Markus Armbruster
Rename some variables to avoid compiler warnings when compiling
with -Wshadow=local.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
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..5cede45134 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 s_; \
+ s_ = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \
&out, sizeof(out)); \
- if (s != sizeof(out)) { \
+ if (s_ != sizeof(out)) { \
g_critical("%s: command size incorrect %zu vs %zu", \
- __func__, s, sizeof(out)); \
+ __func__, s_, sizeof(out)); \
return; \
} \
} while (0)
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
index aa304475a0..bb41758e34 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -834,7 +834,7 @@ vg_resource_flush(VuGpu *g,
.width = width,
.height = height,
};
- pixman_image_t *i =
+ pixman_image_t *img =
pixman_image_create_bits(pixman_image_get_format(res->image),
msg->payload.update.width,
msg->payload.update.height,
@@ -842,11 +842,11 @@ vg_resource_flush(VuGpu *g,
payload.update.data),
width * bpp);
pixman_image_composite(PIXMAN_OP_SRC,
- res->image, NULL, i,
+ res->image, NULL, img,
extents->x1, extents->y1,
0, 0, 0, 0,
width, height);
- pixman_image_unref(i);
+ pixman_image_unref(img);
vg_send_msg(g, msg, -1);
g_free(msg);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow
2023-10-06 17:35 [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow Thomas Huth
@ 2023-10-08 6:47 ` Marc-André Lureau
2023-10-08 8:54 ` Michael S. Tsirkin
2023-10-08 8:58 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2023-10-08 6:47 UTC (permalink / raw)
To: Thomas Huth
Cc: Gerd Hoffmann, Michael S. Tsirkin, qemu-devel, Markus Armbruster
On Fri, Oct 6, 2023 at 9:35 PM Thomas Huth <thuth@redhat.com> wrote:
>
> Rename some variables to avoid compiler warnings when compiling
> with -Wshadow=local.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> 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..5cede45134 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 s_; \
> + s_ = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \
> &out, sizeof(out)); \
> - if (s != sizeof(out)) { \
> + if (s_ != sizeof(out)) { \
> g_critical("%s: command size incorrect %zu vs %zu", \
> - __func__, s, sizeof(out)); \
> + __func__, s_, sizeof(out)); \
> return; \
> } \
> } while (0)
> diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
> index aa304475a0..bb41758e34 100644
> --- a/contrib/vhost-user-gpu/vhost-user-gpu.c
> +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
> @@ -834,7 +834,7 @@ vg_resource_flush(VuGpu *g,
> .width = width,
> .height = height,
> };
> - pixman_image_t *i =
> + pixman_image_t *img =
> pixman_image_create_bits(pixman_image_get_format(res->image),
> msg->payload.update.width,
> msg->payload.update.height,
> @@ -842,11 +842,11 @@ vg_resource_flush(VuGpu *g,
> payload.update.data),
> width * bpp);
> pixman_image_composite(PIXMAN_OP_SRC,
> - res->image, NULL, i,
> + res->image, NULL, img,
> extents->x1, extents->y1,
> 0, 0, 0, 0,
> width, height);
> - pixman_image_unref(i);
> + pixman_image_unref(img);
> vg_send_msg(g, msg, -1);
> g_free(msg);
> }
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow
2023-10-06 17:35 [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow Thomas Huth
2023-10-08 6:47 ` Marc-André Lureau
@ 2023-10-08 8:54 ` Michael S. Tsirkin
2023-10-08 8:58 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-10-08 8:54 UTC (permalink / raw)
To: Thomas Huth
Cc: Marc-André Lureau, Gerd Hoffmann, qemu-devel, Markus Armbruster
On Fri, Oct 06, 2023 at 07:35:18PM +0200, Thomas Huth wrote:
> Rename some variables to avoid compiler warnings when compiling
> with -Wshadow=local.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 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..5cede45134 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 s_; \
> + s_ = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \
> &out, sizeof(out)); \
> - if (s != sizeof(out)) { \
> + if (s_ != sizeof(out)) { \
> g_critical("%s: command size incorrect %zu vs %zu", \
> - __func__, s, sizeof(out)); \
> + __func__, s_, sizeof(out)); \
> return; \
> } \
> } while (0)
> diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
> index aa304475a0..bb41758e34 100644
> --- a/contrib/vhost-user-gpu/vhost-user-gpu.c
> +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
> @@ -834,7 +834,7 @@ vg_resource_flush(VuGpu *g,
> .width = width,
> .height = height,
> };
> - pixman_image_t *i =
> + pixman_image_t *img =
> pixman_image_create_bits(pixman_image_get_format(res->image),
> msg->payload.update.width,
> msg->payload.update.height,
> @@ -842,11 +842,11 @@ vg_resource_flush(VuGpu *g,
> payload.update.data),
> width * bpp);
> pixman_image_composite(PIXMAN_OP_SRC,
> - res->image, NULL, i,
> + res->image, NULL, img,
> extents->x1, extents->y1,
> 0, 0, 0, 0,
> width, height);
> - pixman_image_unref(i);
> + pixman_image_unref(img);
> vg_send_msg(g, msg, -1);
> g_free(msg);
> }
> --
> 2.41.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow
2023-10-06 17:35 [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow Thomas Huth
2023-10-08 6:47 ` Marc-André Lureau
2023-10-08 8:54 ` Michael S. Tsirkin
@ 2023-10-08 8:58 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-10-08 8:58 UTC (permalink / raw)
To: Thomas Huth
Cc: Marc-André Lureau, Gerd Hoffmann, qemu-devel, Markus Armbruster
On Fri, Oct 06, 2023 at 07:35:18PM +0200, Thomas Huth wrote:
> Rename some variables to avoid compiler warnings when compiling
> with -Wshadow=local.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> 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..5cede45134 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 s_; \
> + s_ = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \
> &out, sizeof(out)); \
> - if (s != sizeof(out)) { \
> + if (s_ != sizeof(out)) { \
> g_critical("%s: command size incorrect %zu vs %zu", \
> - __func__, s, sizeof(out)); \
> + __func__, s_, sizeof(out)); \
> return; \
> } \
> } while (0)
Oh wait this is the same issue. Fixes it now but can start failing
down the road. Let's use something specific to this macro.
VUGPU_FILL_CMD_s ?
> diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
> index aa304475a0..bb41758e34 100644
> --- a/contrib/vhost-user-gpu/vhost-user-gpu.c
> +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
> @@ -834,7 +834,7 @@ vg_resource_flush(VuGpu *g,
> .width = width,
> .height = height,
> };
> - pixman_image_t *i =
> + pixman_image_t *img =
> pixman_image_create_bits(pixman_image_get_format(res->image),
> msg->payload.update.width,
> msg->payload.update.height,
> @@ -842,11 +842,11 @@ vg_resource_flush(VuGpu *g,
> payload.update.data),
> width * bpp);
> pixman_image_composite(PIXMAN_OP_SRC,
> - res->image, NULL, i,
> + res->image, NULL, img,
> extents->x1, extents->y1,
> 0, 0, 0, 0,
> width, height);
> - pixman_image_unref(i);
> + pixman_image_unref(img);
> vg_send_msg(g, msg, -1);
> g_free(msg);
> }
> --
> 2.41.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-08 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 17:35 [PATCH] contrib/vhost-user-gpu: Fix compiler warning when compiling with -Wshadow Thomas Huth
2023-10-08 6:47 ` Marc-André Lureau
2023-10-08 8:54 ` Michael S. Tsirkin
2023-10-08 8:58 ` Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.