Message ID | 20200214103911.7995-1-wl@xen.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | libxl: mark parameters in stub functions as unused | expand |
Wei Liu writes ("[PATCH] 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") > Signed-off-by: Wei Liu <wl@xen.org> > --- > Not able to test this locally, please review carefully... The syntax looks good to me. I haven't compiled it. Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Ian.
On Fri, Feb 14, 2020 at 11:00:44AM +0000, Ian Jackson wrote: > Wei Liu writes ("[PATCH] 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") > > Signed-off-by: Wei Liu <wl@xen.org> > > --- > > 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. > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Thanks. I will push it shortly. Wei. > > Ian.
Wei Liu writes ("Re: [PATCH] libxl: mark parameters in stub functions as unused"): > 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. > I don't have libvirt lying around though. That's what I didn't test. > > > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > > Thanks. I will push it shortly. Great, thanks. Ian.
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index d1d31b1e67..fde8548847 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -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 /*
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") Signed-off-by: Wei Liu <wl@xen.org> --- Not able to test this locally, please review carefully... --- tools/libxl/libxl.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)