[libvirt PATCH 31/31] tools: wireshark: fix compilation errors
With meson introduction which is using the same CFLAGS for the whole project some compilation errors were discovered. Signed-off-by: Pavel Hrdina --- tools/wireshark/src/packet-libvirt.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c index 20b7a3ec812..db8efe45a39 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -77,15 +77,15 @@ static gint ett_libvirt_stream_hole = -1; XDR_PRIMITIVE_DISSECTOR(int, gint32, int) XDR_PRIMITIVE_DISSECTOR(u_int, guint32, uint) -XDR_PRIMITIVE_DISSECTOR(short, gint16, int) +//XDR_PRIMITIVE_DISSECTOR(short, gint16, int) XDR_PRIMITIVE_DISSECTOR(u_short, guint16, uint) XDR_PRIMITIVE_DISSECTOR(char,gchar, int) XDR_PRIMITIVE_DISSECTOR(u_char, guchar, uint) XDR_PRIMITIVE_DISSECTOR(hyper, gint64, int64) XDR_PRIMITIVE_DISSECTOR(u_hyper, guint64, uint64) -XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) +//XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) XDR_PRIMITIVE_DISSECTOR(double, gdouble, double) -XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) +//XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) typedef gboolean (*vir_xdr_dissector_t)(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf); @@ -345,7 +345,9 @@ dissect_libvirt_num_of_fds(tvbuff_t *tvb, proto_tree *tree) } static void -dissect_libvirt_fds(tvbuff_t *tvb, gint start, gint32 nfds) +dissect_libvirt_fds(tvbuff_t *tvb G_GNUC_UNUSED, +gint start G_GNUC_UNUSED, +gint32 nfds G_GNUC_UNUSED) { /* TODO: NOP for now */ } @@ -420,8 +422,13 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree, return; /* No payload */ if (status == VIR_NET_OK) { -vir_xdr_dissector_t xd = find_payload_dissector(proc, type, get_program_data(prog, VIR_PROGRAM_DISSECTORS), -*(gsize *)get_program_data(prog, VIR_PROGRAM_DISSECTORS_LEN)); +const vir_dissector_index_t *pds = get_program_data(prog, VIR_PROGRAM_DISSECTORS); +const gsize *len = get_program_data(prog, VIR_PROGRAM_DISSECTORS_LEN); + +if (!len) +goto unknown; + +vir_xdr_dissector_t xd = find_payload_dissector(proc, type, pds, *len); if (xd == NULL) goto unknown; dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status, xd); -- 2.26.2
Re: [libvirt PATCH 31/31] tools: wireshark: fix compilation errors
On Thu, Jul 02, 2020 at 02:25:29PM +0200, Pavel Hrdina wrote: > With meson introduction which is using the same CFLAGS for the whole > project some compilation errors were discovered. > > Signed-off-by: Pavel Hrdina > --- > tools/wireshark/src/packet-libvirt.c | 19 +-- > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/tools/wireshark/src/packet-libvirt.c > b/tools/wireshark/src/packet-libvirt.c > index 20b7a3ec812..db8efe45a39 100644 > --- a/tools/wireshark/src/packet-libvirt.c > +++ b/tools/wireshark/src/packet-libvirt.c > @@ -77,15 +77,15 @@ static gint ett_libvirt_stream_hole = -1; > > XDR_PRIMITIVE_DISSECTOR(int, gint32, int) > XDR_PRIMITIVE_DISSECTOR(u_int, guint32, uint) > -XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > +//XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > XDR_PRIMITIVE_DISSECTOR(u_short, guint16, uint) > XDR_PRIMITIVE_DISSECTOR(char,gchar, int) > XDR_PRIMITIVE_DISSECTOR(u_char, guchar, uint) > XDR_PRIMITIVE_DISSECTOR(hyper, gint64, int64) > XDR_PRIMITIVE_DISSECTOR(u_hyper, guint64, uint64) > -XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > +//XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > XDR_PRIMITIVE_DISSECTOR(double, gdouble, double) > -XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > +//XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) This looks a bit iffy - what's the rationale for this ? Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
Re: [libvirt PATCH 31/31] tools: wireshark: fix compilation errors
On a Thursday in 2020, Pavel Hrdina wrote: With meson introduction which is using the same CFLAGS for the whole project some compilation errors were discovered. What were the errors? Signed-off-by: Pavel Hrdina --- tools/wireshark/src/packet-libvirt.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c index 20b7a3ec812..db8efe45a39 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -77,15 +77,15 @@ static gint ett_libvirt_stream_hole = -1; XDR_PRIMITIVE_DISSECTOR(int, gint32, int) XDR_PRIMITIVE_DISSECTOR(u_int, guint32, uint) -XDR_PRIMITIVE_DISSECTOR(short, gint16, int) +//XDR_PRIMITIVE_DISSECTOR(short, gint16, int) XDR_PRIMITIVE_DISSECTOR(u_short, guint16, uint) XDR_PRIMITIVE_DISSECTOR(char,gchar, int) XDR_PRIMITIVE_DISSECTOR(u_char, guchar, uint) XDR_PRIMITIVE_DISSECTOR(hyper, gint64, int64) XDR_PRIMITIVE_DISSECTOR(u_hyper, guint64, uint64) -XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) +//XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) XDR_PRIMITIVE_DISSECTOR(double, gdouble, double) -XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) +//XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) If we don't need these, we can just delete them instead of commenting them out. typedef gboolean (*vir_xdr_dissector_t)(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf); The rest of the changes look reasonable. Jano @@ -345,7 +345,9 @@ dissect_libvirt_num_of_fds(tvbuff_t *tvb, proto_tree *tree) } static void -dissect_libvirt_fds(tvbuff_t *tvb, gint start, gint32 nfds) +dissect_libvirt_fds(tvbuff_t *tvb G_GNUC_UNUSED, +gint start G_GNUC_UNUSED, +gint32 nfds G_GNUC_UNUSED) { /* TODO: NOP for now */ } @@ -420,8 +422,13 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree, return; /* No payload */ if (status == VIR_NET_OK) { -vir_xdr_dissector_t xd = find_payload_dissector(proc, type, get_program_data(prog, VIR_PROGRAM_DISSECTORS), -*(gsize *)get_program_data(prog, VIR_PROGRAM_DISSECTORS_LEN)); +const vir_dissector_index_t *pds = get_program_data(prog, VIR_PROGRAM_DISSECTORS); +const gsize *len = get_program_data(prog, VIR_PROGRAM_DISSECTORS_LEN); + +if (!len) +goto unknown; + +vir_xdr_dissector_t xd = find_payload_dissector(proc, type, pds, *len); if (xd == NULL) goto unknown; dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status, xd); -- 2.26.2 signature.asc Description: PGP signature
Re: [libvirt PATCH 31/31] tools: wireshark: fix compilation errors
On Thu, Jul 09, 2020 at 04:22:41PM +0100, Daniel P. Berrangé wrote: > On Thu, Jul 02, 2020 at 02:25:29PM +0200, Pavel Hrdina wrote: > > With meson introduction which is using the same CFLAGS for the whole > > project some compilation errors were discovered. > > > > Signed-off-by: Pavel Hrdina > > --- > > tools/wireshark/src/packet-libvirt.c | 19 +-- > > 1 file changed, 13 insertions(+), 6 deletions(-) > > > > diff --git a/tools/wireshark/src/packet-libvirt.c > > b/tools/wireshark/src/packet-libvirt.c > > index 20b7a3ec812..db8efe45a39 100644 > > --- a/tools/wireshark/src/packet-libvirt.c > > +++ b/tools/wireshark/src/packet-libvirt.c > > @@ -77,15 +77,15 @@ static gint ett_libvirt_stream_hole = -1; > > > > XDR_PRIMITIVE_DISSECTOR(int, gint32, int) > > XDR_PRIMITIVE_DISSECTOR(u_int, guint32, uint) > > -XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > > +//XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > > XDR_PRIMITIVE_DISSECTOR(u_short, guint16, uint) > > XDR_PRIMITIVE_DISSECTOR(char,gchar, int) > > XDR_PRIMITIVE_DISSECTOR(u_char, guchar, uint) > > XDR_PRIMITIVE_DISSECTOR(hyper, gint64, int64) > > XDR_PRIMITIVE_DISSECTOR(u_hyper, guint64, uint64) > > -XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > > +//XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > > XDR_PRIMITIVE_DISSECTOR(double, gdouble, double) > > -XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > > +//XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > > > This looks a bit iffy - what's the rationale for this ? To keep it here if we ever need to use these types and to illustrate that they are not used on purpose. But it can be completely removed as well. I have no preference here. Pavel signature.asc Description: PGP signature
Re: [libvirt PATCH 31/31] tools: wireshark: fix compilation errors
On Thu, Jul 09, 2020 at 05:33:14PM +0200, Pavel Hrdina wrote: > On Thu, Jul 09, 2020 at 04:22:41PM +0100, Daniel P. Berrangé wrote: > > On Thu, Jul 02, 2020 at 02:25:29PM +0200, Pavel Hrdina wrote: > > > With meson introduction which is using the same CFLAGS for the whole > > > project some compilation errors were discovered. > > > > > > Signed-off-by: Pavel Hrdina > > > --- > > > tools/wireshark/src/packet-libvirt.c | 19 +-- > > > 1 file changed, 13 insertions(+), 6 deletions(-) > > > > > > diff --git a/tools/wireshark/src/packet-libvirt.c > > > b/tools/wireshark/src/packet-libvirt.c > > > index 20b7a3ec812..db8efe45a39 100644 > > > --- a/tools/wireshark/src/packet-libvirt.c > > > +++ b/tools/wireshark/src/packet-libvirt.c > > > @@ -77,15 +77,15 @@ static gint ett_libvirt_stream_hole = -1; > > > > > > XDR_PRIMITIVE_DISSECTOR(int, gint32, int) > > > XDR_PRIMITIVE_DISSECTOR(u_int, guint32, uint) > > > -XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > > > +//XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > > > XDR_PRIMITIVE_DISSECTOR(u_short, guint16, uint) > > > XDR_PRIMITIVE_DISSECTOR(char,gchar, int) > > > XDR_PRIMITIVE_DISSECTOR(u_char, guchar, uint) > > > XDR_PRIMITIVE_DISSECTOR(hyper, gint64, int64) > > > XDR_PRIMITIVE_DISSECTOR(u_hyper, guint64, uint64) > > > -XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > > > +//XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > > > XDR_PRIMITIVE_DISSECTOR(double, gdouble, double) > > > -XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > > > +//XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > > > > > > This looks a bit iffy - what's the rationale for this ? > > To keep it here if we ever need to use these types and to illustrate > that they are not used on purpose. But it can be completely removed > as well. I have no preference here. Oh, so are you saying it was complaining about unused functions ? We could just use a pragma to squelch the warning flag in this source file. Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
Re: [libvirt PATCH 31/31] tools: wireshark: fix compilation errors
On Thu, Jul 09, 2020 at 04:41:29PM +0100, Daniel P. Berrangé wrote: > On Thu, Jul 09, 2020 at 05:33:14PM +0200, Pavel Hrdina wrote: > > On Thu, Jul 09, 2020 at 04:22:41PM +0100, Daniel P. Berrangé wrote: > > > On Thu, Jul 02, 2020 at 02:25:29PM +0200, Pavel Hrdina wrote: > > > > With meson introduction which is using the same CFLAGS for the whole > > > > project some compilation errors were discovered. > > > > > > > > Signed-off-by: Pavel Hrdina > > > > --- > > > > tools/wireshark/src/packet-libvirt.c | 19 +-- > > > > 1 file changed, 13 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/tools/wireshark/src/packet-libvirt.c > > > > b/tools/wireshark/src/packet-libvirt.c > > > > index 20b7a3ec812..db8efe45a39 100644 > > > > --- a/tools/wireshark/src/packet-libvirt.c > > > > +++ b/tools/wireshark/src/packet-libvirt.c > > > > @@ -77,15 +77,15 @@ static gint ett_libvirt_stream_hole = -1; > > > > > > > > XDR_PRIMITIVE_DISSECTOR(int, gint32, int) > > > > XDR_PRIMITIVE_DISSECTOR(u_int, guint32, uint) > > > > -XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > > > > +//XDR_PRIMITIVE_DISSECTOR(short, gint16, int) > > > > XDR_PRIMITIVE_DISSECTOR(u_short, guint16, uint) > > > > XDR_PRIMITIVE_DISSECTOR(char,gchar, int) > > > > XDR_PRIMITIVE_DISSECTOR(u_char, guchar, uint) > > > > XDR_PRIMITIVE_DISSECTOR(hyper, gint64, int64) > > > > XDR_PRIMITIVE_DISSECTOR(u_hyper, guint64, uint64) > > > > -XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > > > > +//XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) > > > > XDR_PRIMITIVE_DISSECTOR(double, gdouble, double) > > > > -XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > > > > +//XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) > > > > > > > > > This looks a bit iffy - what's the rationale for this ? > > > > To keep it here if we ever need to use these types and to illustrate > > that they are not used on purpose. But it can be completely removed > > as well. I have no preference here. > > Oh, so are you saying it was complaining about unused functions ? > > We could just use a pragma to squelch the warning flag in this > source file. Correct, I'll include a patch with this change to trigger the errors with autotools: diff --git a/tools/Makefile.am b/tools/Makefile.am index 53df930e0ac..eb8f269b486 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -378,7 +378,7 @@ if WITH_WIRESHARK_DISSECTOR ws_plugin_LTLIBRARIES = wireshark/src/libvirt.la wireshark_src_libvirt_la_CFLAGS = \ - -I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS) $(XDR_CFLAGS) + -I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS) $(XDR_CFLAGS) $(AM_CFLAGS) wireshark_src_libvirt_la_LDFLAGS = -avoid-version -module wireshark_src_libvirt_la_SOURCES = \ wireshark/src/packet-libvirt.h \ It will result in these errors: ../../tools/wireshark/src/packet-libvirt.c: In function 'dissect_libvirt_fds': ../../tools/wireshark/src/packet-libvirt.c:348:31: error: unused parameter 'tvb' [-Werror=unused-parameter] 348 | dissect_libvirt_fds(tvbuff_t *tvb, gint start, gint32 nfds) | ~~^~~ ../../tools/wireshark/src/packet-libvirt.c:348:41: error: unused parameter 'start' [-Werror=unused-parameter] 348 | dissect_libvirt_fds(tvbuff_t *tvb, gint start, gint32 nfds) |~^ ../../tools/wireshark/src/packet-libvirt.c:348:55: error: unused parameter 'nfds' [-Werror=unused-parameter] 348 | dissect_libvirt_fds(tvbuff_t *tvb, gint start, gint32 nfds) |~~~^~~~ At top level: ../../tools/wireshark/src/packet-libvirt.c:64:5: error: 'dissect_xdr_bool' defined but not used [-Werror=unused-function] 64 | dissect_xdr_##xtype(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf) \ | ^~~~ ../../tools/wireshark/src/packet-libvirt.c:88:1: note: in expansion of macro 'XDR_PRIMITIVE_DISSECTOR' 88 | XDR_PRIMITIVE_DISSECTOR(bool,bool_t, boolean) | ^~~ ../../tools/wireshark/src/packet-libvirt.c:64:5: error: 'dissect_xdr_float' defined but not used [-Werror=unused-function] 64 | dissect_xdr_##xtype(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf) \ | ^~~~ ../../tools/wireshark/src/packet-libvirt.c:86:1: note: in expansion of macro 'XDR_PRIMITIVE_DISSECTOR' 86 | XDR_PRIMITIVE_DISSECTOR(float, gfloat, float) | ^~~ ../../tools/wireshark/src/packet-libvirt.c:64:5: error: 'dissect_xdr_short' defined but not used [-Werror=unused-function] 64 | dissect_xdr_##xtype(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf) \ | ^~~~ ../../tools/wireshark/src/packet-libvirt.c:80:1: note: in expansion of macro 'XDR_PRIMITIVE_DISSECTOR' 80 | XDR_PRIMITIVE_DISSECTOR(short, gint16, int) | ^~~ ../../tools/wireshark/src/packet-libvirt.c: In function 'dissect_lib