diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-09-22 18:43:17 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-09-22 18:43:17 +0000 |
commit | f508cdd3cc283c3ce68f7070eec18ce68573dfe5 (patch) | |
tree | aa2123f60dd574234e8276bb9d92e7b592c39908 | |
parent | ddbefb7de3a84e64aea3514097100eeeef6e69ca (diff) |
net-mgmt/pmacct: mark unused but set variables with attributes
With clang 13, building net-mgmt/pmacct results in a number of warnings:
netflow9.c:2236:25: error: variable 'tot_len' set but not used [-Werror,-Wunused-but-set-variable]
u_int16_t flows = 0, tot_len = 0;
^
In this particular instance, the 'tot_len' variable does not seem to
have any purpose, nor does it have any further side-effects. There is
one more instance of a set but unused variable 'label' in src/sflow.c,
but the code there is also increasing a byte ptr, so it can't easily be
eliminated. For now mark these variables as unused, with an attribute.
Approved by: pi (maintainer)
PR: 258513
MFC: 2021Q3
-rw-r--r-- | net-mgmt/pmacct/Makefile | 1 | ||||
-rw-r--r-- | net-mgmt/pmacct/files/patch-src_nfprobe__plugin_netflow9.c | 11 | ||||
-rw-r--r-- | net-mgmt/pmacct/files/patch-src_sflow.c | 11 |
3 files changed, 23 insertions, 0 deletions
diff --git a/net-mgmt/pmacct/Makefile b/net-mgmt/pmacct/Makefile index 314230e3e2d4..15b98614f119 100644 --- a/net-mgmt/pmacct/Makefile +++ b/net-mgmt/pmacct/Makefile @@ -2,6 +2,7 @@ PORTNAME= pmacct DISTVERSION= 1.7.5 +PORTREVISION= 1 CATEGORIES= net-mgmt MASTER_SITES= http://www.pmacct.net/ diff --git a/net-mgmt/pmacct/files/patch-src_nfprobe__plugin_netflow9.c b/net-mgmt/pmacct/files/patch-src_nfprobe__plugin_netflow9.c new file mode 100644 index 000000000000..6ba07373eba9 --- /dev/null +++ b/net-mgmt/pmacct/files/patch-src_nfprobe__plugin_netflow9.c @@ -0,0 +1,11 @@ +--- src/nfprobe_plugin/netflow9.c.orig 2020-05-10 13:57:54 UTC ++++ src/nfprobe_plugin/netflow9.c +@@ -2233,7 +2233,7 @@ send_netflow_v9(struct FLOW **flows, int num_flows, in + + /* Refresh template headers if we need to */ + if (nf9_pkts_until_template <= 0) { +- u_int16_t flows = 0, tot_len = 0; ++ u_int16_t flows = 0, tot_len __attribute__((unused)) = 0; + + memcpy(packet + offset, &v4_template, v4_template.tot_len); + offset += v4_template.tot_len; diff --git a/net-mgmt/pmacct/files/patch-src_sflow.c b/net-mgmt/pmacct/files/patch-src_sflow.c new file mode 100644 index 000000000000..8a8df0620e6c --- /dev/null +++ b/net-mgmt/pmacct/files/patch-src_sflow.c @@ -0,0 +1,11 @@ +--- src/sflow.c.orig 2020-05-10 13:57:54 UTC ++++ src/sflow.c +@@ -306,7 +306,7 @@ void decodeIPV4(SFSample *sample) + + void decodeIPV6(SFSample *sample) + { +- u_int32_t label; ++ u_int32_t label __attribute__((unused)); + u_int32_t nextHeader; + u_char *end = sample->header + sample->headerLen; + |