Re: [PATCH v4 00/12] Compiler warning fixes for libvhost-user,libvduse

2022-12-23 Thread Marcel Holtmann
his is the first attempt at some >> obvious fixes that can be done without any harm to the code and its >> readability. >> Marcel Holtmann (12): >> libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU >> libvhost-user: Replace typeof with __typeof__ >>

[PATCH v4 04/12] libvhost-user: Use unsigned int i for some for-loop iterations

2022-12-22 Thread Marcel Holtmann
’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] 223 | for (i = 0; i < dev->nregions; i++) { | ^ Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[PATCH v4 07/12] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-22 Thread Marcel Holtmann
by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c index e089d4d546cf..c871bd331a6b 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects

[PATCH v4 05/12] libvhost-user: Declare uffdio_register early to make it C90 compliant

2022-12-22 Thread Marcel Holtmann
[-Werror=declaration-after-statement] 683 | struct uffdio_register reg_struct; | ^~ In this case, it is also simple enough and doesn't cause any extra ifdef additions. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daudé --- subprojects/libvhost-user

[PATCH v4 00/12] Compiler warning fixes for libvhost-user,libvduse

2022-12-22 Thread Marcel Holtmann
that can be done without any harm to the code and its readability. Marcel Holtmann (12): libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU libvhost-user: Replace typeof with __typeof__ libvhost-user: Cast rc variable to avoid compiler warning libvhost-user: Use unsigned int i

[PATCH v4 03/12] libvhost-user: Cast rc variable to avoid compiler warning

2022-12-22 Thread Marcel Holtmann
ler warning switched on. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 67d75ece53b7..bcdf32a24f60 100

[PATCH v4 02/12] libvhost-user: Replace typeof with __typeof__

2022-12-22 Thread Marcel Holtmann
’ [-Werror=implicit-function-declaration] 86 | typeof(x) _min1 = (x); \ | ^~ Changing these two users of typeof makes the compiler happy and no extra flags or pragmas need to be provided. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daudé

[PATCH v4 09/12] libvduse: Fix assignment in vring_set_avail_event

2022-12-22 Thread Marcel Holtmann
*)>vring.used->ring[vq->vring.num]) = htole16(val); | ~^ Signed-off-by: Marcel Holtmann Suggested-by: Xie Yongji Suggested-by: Paolo Bonzini --- subprojects/libvduse/libvduse.c | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH v4 08/12] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq

2022-12-22 Thread Marcel Holtmann
=sign-compare] 789 | if (vq->inuse >= vq->vring.num) { | ^~ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann Reviewed-by: Xie Yongji --- subprojects/libvduse/libvduse.c

[PATCH v4 12/12] libvduse: Add extra compiler warnings

2022-12-22 Thread Marcel Holtmann
In case libvhost-user is used externally, that projects compiler warnings might be more strict. Enforce an extra set of compiler warnings to catch issues early on. Signed-off-by: Marcel Holtmann Suggested-by: Paolo Bonzini --- subprojects/libvduse/meson.build | 8 +++- 1 file changed, 7

Re: [PATCH v3 10/10] libvduse: Fix assignment in vring_set_avail_event

2022-12-22 Thread Marcel Holtmann
Hi Paolo, >> static inline void vring_set_avail_event(VduseVirtq *vq, uint16_t val) >> { >> -*((uint16_t *)>vring.used->ring[vq->vring.num]) = htole16(val); >> +uint16_t *avail; >> + >> +avail = (uint16_t *)>vring.used->ring[vq->vring.num]; >> +*avail = htole16(val); > > That

[PATCH v4 11/12] libvhost-user: Add extra compiler warnings

2022-12-22 Thread Marcel Holtmann
In case libvhost-user is used externally, that projects compiler warnings might be more strict. Enforce an extra set of compiler warnings to catch issues early on. Signed-off-by: Marcel Holtmann Suggested-by: Paolo Bonzini --- subprojects/libvhost-user/meson.build | 8 +++- 1 file changed

[PATCH v4 10/12] libvhost-user: Fix assignment in vring_set_avail_event

2022-12-22 Thread Marcel Holtmann
Since it was proposed to change the code in libvduse.c to use memcpy instead of an assignment, the code in libvhost-user.c should also be changed to use memcpy. Signed-off-by: Marcel Holtmann Suggested-by: Paolo Bonzini --- subprojects/libvhost-user/libvhost-user.c | 5 ++--- 1 file changed, 2

Re: [PATCH v3 02/10] libvhost-user: Replace typeof with __typeof__

2022-12-22 Thread Marcel Holtmann
3: error: implicit declaration of function ‘typeof’ >> [-Werror=implicit-function-declaration] >>86 | typeof(x) _min1 = (x); \ >> | ^~ >> Changing these two users of typeof makes the compiler happy and no extra >> fl

[PATCH v4 01/12] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-22 Thread Marcel Holtmann
RCE if it is not already set by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index d6ee6e7d9168..b55b9e244d9a 100

[PATCH v4 06/12] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant

2022-12-22 Thread Marcel Holtmann
ter-statement] 1625 | struct uffdio_api api_struct; | ^~ Understandable, it might be desired to avoid else clauses, but in this case it seems clear enough and frankly the dev->postcopy_ufd is only assigned once. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu

[PATCH v3 08/10] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-21 Thread Marcel Holtmann
by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c index e089d4d546cf..c871bd331a6b 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects

[PATCH v3 07/10] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq

2022-12-21 Thread Marcel Holtmann
re] 2808 | if (num > vq->inuse) { | ^ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daudé --- subprojects/libvhost-user/libvhost-user.h | 2 +- 1

[PATCH v3 10/10] libvduse: Fix assignment in vring_set_avail_event

2022-12-21 Thread Marcel Holtmann
-aliasin] 603 | *((uint16_t *)>vring.used->ring[vq->vring.num]) = htole16(val); | ~^ Signed-off-by: Marcel Holtmann Suggested-by: Xie Yongji --- subprojects/libvduse/libvduse.c | 5 - 1 file changed, 4 insertions(+), 1

[PATCH v3 04/10] libvhost-user: Use unsigned int i for some for-loop iterations

2022-12-21 Thread Marcel Holtmann
’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] 223 | for (i = 0; i < dev->nregions; i++) { | ^ Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[PATCH v3 01/10] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-21 Thread Marcel Holtmann
RCE if it is not already set by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index d6ee6e7d9168..b55b9e244d9a 100

[PATCH v3 00/10] Compiler warning fixes for libvhost-user,libvduse

2022-12-21 Thread Marcel Holtmann
that can be done without any harm to the code and its readability. Marcel Holtmann (10): libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU libvhost-user: Replace typeof with __typeof__ libvhost-user: Cast rc variable to avoid compiler warning libvhost-user: Use unsigned int i

[PATCH v3 02/10] libvhost-user: Replace typeof with __typeof__

2022-12-21 Thread Marcel Holtmann
’ [-Werror=implicit-function-declaration] 86 | typeof(x) _min1 = (x); \ | ^~ Changing these two users of typeof makes the compiler happy and no extra flags or pragmas need to be provided. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daudé

[PATCH v3 05/10] libvhost-user: Declare uffdio_register early to make it C90 compliant

2022-12-21 Thread Marcel Holtmann
[-Werror=declaration-after-statement] 683 | struct uffdio_register reg_struct; | ^~ In this case, it is also simple enough and doesn't cause any extra ifdef additions. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daudé --- subprojects/libvhost-user

[PATCH v3 06/10] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant

2022-12-21 Thread Marcel Holtmann
ter-statement] 1625 | struct uffdio_api api_struct; | ^~ Understandable, it might be desired to avoid else clauses, but in this case it seems clear enough and frankly the dev->postcopy_ufd is only assigned once. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu

Re: [RFC v2 10/10] libvduse: Fix assignment in vring_set_avail_event

2022-12-21 Thread Marcel Holtmann
ng[vq->vring.num]) = >> htole16(val); >> | ~^~~~~ >> >> Signed-off-by: Marcel Holtmann >> --- >> subprojects/libvduse/libvduse.c | 5 - >> 1 file changed, 4 insertions(+), 1 deletion(-) >>

[PATCH v3 03/10] libvhost-user: Cast rc variable to avoid compiler warning

2022-12-21 Thread Marcel Holtmann
ler warning switched on. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 67d75ece53b7..bcdf32a24f60 100

[PATCH v3 09/10] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq

2022-12-21 Thread Marcel Holtmann
=sign-compare] 789 | if (vq->inuse >= vq->vring.num) { | ^~ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann Reviewed-by: Xie Yongji --- subprojects/libvduse/libvduse.c

[PATCH v2 06/10] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant

2022-12-20 Thread Marcel Holtmann
ter-statement] 1625 | struct uffdio_api api_struct; | ^~ Understandable, it might be desired to avoid else clauses, but in this case it seems clear enough and frankly the dev->postcopy_ufd is only assigned once. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/li

[PATCH v2 05/10] libvhost-user: Declare uffdio_register early to make it C90 compliant

2022-12-20 Thread Marcel Holtmann
[-Werror=declaration-after-statement] 683 | struct uffdio_register reg_struct; | ^~ In this case, it is also simple enough and doesn't cause any extra ifdef additions. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 +++- 1 file changed

[PATCH v2 03/10] libvhost-user: Cast rc variable to avoid compiler warning

2022-12-20 Thread Marcel Holtmann
ler warning switched on. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 67d75ece53b7..bcdf32a24f60 100

[PATCH v2 00/10] Compiler warning fixes for libvhost-user,libvduse

2022-12-20 Thread Marcel Holtmann
or it better be commented accordingly to tell the compiler that it got this part wrong. Marcel Holtmann (10): libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU libvhost-user: Replace typeof with __typeof__ libvhost-user: Cast rc variable to avoid compiler warning libvhost

[PATCH v2 08/10] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-20 Thread Marcel Holtmann
by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c index e089d4d546cf..c871bd331a6b 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects

[PATCH v2 09/10] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq

2022-12-20 Thread Marcel Holtmann
=sign-compare] 789 | if (vq->inuse >= vq->vring.num) { | ^~ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 2 +- 1 file c

[PATCH v2 07/10] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq

2022-12-20 Thread Marcel Holtmann
re] 2808 | if (num > vq->inuse) { | ^ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daudé --- subprojects/libvhost-user/libvhost-user.h | 2 +- 1

[PATCH v2 04/10] libvhost-user: Use unsigned int i for some for-loop iterations

2022-12-20 Thread Marcel Holtmann
’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] 223 | for (i = 0; i < dev->nregions; i++) { | ^ Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[PATCH v2 01/10] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-20 Thread Marcel Holtmann
RCE if it is not already set by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index d6ee6e7d9168..b55b9e244d9a 100

[PATCH v2 02/10] libvhost-user: Replace typeof with __typeof__

2022-12-20 Thread Marcel Holtmann
’ [-Werror=implicit-function-declaration] 86 | typeof(x) _min1 = (x); \ | ^~ Changing these two users of typeof makes the compiler happy and no extra flags or pragmas need to be provided. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user

[RFC v2 10/10] libvduse: Fix assignment in vring_set_avail_event

2022-12-20 Thread Marcel Holtmann
ole16(val); | ~^ Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c index 338ad5e352e7..51a4ba1b6878 100644 --- a/su

Re: [PATCH 7/7] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq

2022-12-20 Thread Marcel Holtmann
omparison of integer expressions of >> different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] >> 2808 | if (num > vq->inuse) { >> | ^ >> >> Instead of casting the comparision to unsigned int, just make the inuse >&

Re: [PATCH 7/7] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq

2022-12-19 Thread Marcel Holtmann
son of integer expressions of >> different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] >> 2808 | if (num > vq->inuse) { >> | ^ >> Instead of casting the comparision to unsigned int, just make the inuse >> field unsigned int i

[PATCH 0/3] Compiler warning fixes for libvduse

2022-12-19 Thread Marcel Holtmann
the structures point of view the assignment that is done makes no sense to me. I might have to dig into specification to figure it out or it better be commented accordingly to tell the compiler that it got this part wrong. Marcel Holtmann (3): libvduse: Provide _GNU_SOURCE when compiling outside

[PATCH RFC 3/3] libvduse: Fix assignment in vring_set_avail_event

2022-12-19 Thread Marcel Holtmann
ole16(val); | ~^ Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c index 338ad5e352e7..51a4ba1b6878 100644 --- a/su

[PATCH 2/3] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq

2022-12-19 Thread Marcel Holtmann
=sign-compare] 789 | if (vq->inuse >= vq->vring.num) { | ^~ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 2 +- 1 file c

[PATCH 1/3] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-19 Thread Marcel Holtmann
by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c index e089d4d546cf..c871bd331a6b 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects

[PATCH 5/7] libvhost-user: Declare uffdio_register early to make it C90 compliant

2022-12-19 Thread Marcel Holtmann
[-Werror=declaration-after-statement] 683 | struct uffdio_register reg_struct; | ^~ In this case, it is also simple enough and doesn't cause any extra ifdef additions. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 +++- 1 file changed

[PATCH 3/7] libvhost-user: Cast rc variable to avoid compiler warning

2022-12-19 Thread Marcel Holtmann
ler warning switched on. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 67d75ece53b7..bcdf32a24f60 100

[PATCH 0/7] Various compiler warning fixes for libvhost-user

2022-12-19 Thread Marcel Holtmann
that can be done without any harm to the code and its readabilty. Marcel Holtmann (7): libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU libvhost-user: Replace typeof with __typeof__ libvhost-user: Cast rc variable to avoid compiler warning libvhost-user: Use unsigned int i

[PATCH 1/7] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU

2022-12-19 Thread Marcel Holtmann
RCE if it is not already set by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 1 file changed, 4 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index d6ee6e7d9168..b55b9e244d9a 100

[PATCH 2/7] libvhost-user: Replace typeof with __typeof__

2022-12-19 Thread Marcel Holtmann
’ [-Werror=implicit-function-declaration] 86 | typeof(x) _min1 = (x); \ | ^~ Changing these two users of typeof makes the compiler happy and no extra flags or pragmas need to be provided. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user

[PATCH 7/7] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq

2022-12-19 Thread Marcel Holtmann
re] 2808 | if (num > vq->inuse) { | ^ Instead of casting the comparision to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 4/7] libvhost-user: Use unsigned int i for some for-loop iterations

2022-12-19 Thread Marcel Holtmann
’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] 223 | for (i = 0; i < dev->nregions; i++) { | ^ Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[PATCH 6/7] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant

2022-12-19 Thread Marcel Holtmann
ter-statement] 1625 | struct uffdio_api api_struct; | ^~ Understandable, it might be desired to avoid else clauses, but in this case it seems clear enough and frankly the dev->postcopy_ufd is only assigned once. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/li