Skip to contentSkip to conversation

libxl: mark parameters in stub functions as unused

PATCH In review Wei Liu 2 participants 4 messages Feb 14, 2020

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: mark parameters in stub functions as unused

Hopefully this can fix issues like:

In file included from ../../src/libxl/xen_xl.c:24:0:
/home/osstest/build.147035.build-amd64-libvirt/xendist/usr/local/include/libxl.h: In function 'libxl_cpuid_apply_policy':
/home/osstest/build.147035.build-amd64-libvirt/xendist/usr/local/include/libxl.h:2345:56: error: unused parameter 'ctx' [-Werror=unused-parameter]
static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) {}

Fixes dacb80f9 ("tools/libxl: Remove libxl_cpuid_{set,apply_policy}() from the API")

---
Not able to test this locally, please review carefully...

---
 tools/libxl/libxl.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tools/libxl/libxl.h +7 -3
index d1d31b1e67..fde8548847 100644
@@ -2342,9 +2342,13 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
  * change in some cases for existing software, but there is 0 of that in
  * practice.
  */
-static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) {}
-static inline void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
-                                   libxl_cpuid_policy_list cpuid) {}
+static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx __attribute__((unused)),
+                                            uint32_t domid __attribute__((unused)))
+{}
+static inline void libxl_cpuid_set(libxl_ctx *ctx __attribute__((unused)),
+                                   uint32_t domid __attribute__((unused)),
+                                   libxl_cpuid_policy_list cpuid __attribute__((unused)))
+{}
 #endif
 
 /*
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw

Wei Liu writes ("[PATCH] libxl: mark parameters in stub functions as unused"):

Quoted 11 lines

Hopefully this can fix issues like:

In file included from ../../src/libxl/xen_xl.c:24:0:
/home/osstest/build.147035.build-amd64-libvirt/xendist/usr/local/include/libxl.h: In function 'libxl_cpuid_apply_policy':
/home/osstest/build.147035.build-amd64-libvirt/xendist/usr/local/include/libxl.h:2345:56: error: unused parameter 'ctx' [-Werror=unused-parameter]
static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) {}

Fixes dacb80f9 ("tools/libxl: Remove libxl_cpuid_{set,apply_policy}() from the API")

---
Not able to test this locally, please review carefully...

The syntax looks good to me. I haven't compiled it.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#2 lore raw
Quoted 8 lines · Ian Jackson

Wei Liu writes ("[PATCH] libxl: mark parameters in stub functions as unused"):

Quoted 7 lines

Hopefully this can fix issues like:

In file included from ../../src/libxl/xen_xl.c:24:0:
/home/osstest/build.147035.build-amd64-libvirt/xendist/usr/local/include/libxl.h: In function 'libxl_cpuid_apply_policy':
/home/osstest/build.147035.build-amd64-libvirt/xendist/usr/local/include/libxl.h:2345:56: error: unused parameter 'ctx' [-Werror=unused-parameter]
static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) {}

Quoted 7 lines
Quoted 4 lines
Fixes dacb80f9 ("tools/libxl: Remove libxl_cpuid_{set,apply_policy}() from the API")

---
Not able to test this locally, please review carefully...

The syntax looks good to me. I haven't compiled it.

I have actually successfully compiled a C file written in a similar way and tried with / without -Wunused-paremeter. After adding the unused attribute gcc stopped spitting out a warning.

I don't have libvirt lying around though. That's what I didn't test.

Quoted 1 line

Thanks. I will push it shortly.

Wei.

Quoted 2 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Wei Liu writes ("Re: [PATCH] libxl: mark parameters in stub functions as unused"):

Quoted 3 lines

I have actually successfully compiled a C file written in a similar way and tried with / without -Wunused-paremeter. After adding the unused attribute gcc stopped spitting out a warning.

That sounds like a sufficient test to me.

Quoted 5 lines

I don't have libvirt lying around though. That's what I didn't test.

Quoted 1 line

Thanks. I will push it shortly.

Great, thanks.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel