git: f508cdd3cc28 - main - net-mgmt/pmacct: mark unused but set variables with attributes
Dimitry Andric
dim at FreeBSD.org
Wed Sep 22 18:46:36 UTC 2021
The branch main has been updated by dim (src committer):
URL: https://cgit.FreeBSD.org/ports/commit/?id=f508cdd3cc283c3ce68f7070eec18ce68573dfe5
commit f508cdd3cc283c3ce68f7070eec18ce68573dfe5
Author: Dimitry Andric <dim at FreeBSD.org>
AuthorDate: 2021-09-22 18:43:17 +0000
Commit: Dimitry Andric <dim at FreeBSD.org>
CommitDate: 2021-09-22 18:43:17 +0000
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
---
net-mgmt/pmacct/Makefile | 1 +
net-mgmt/pmacct/files/patch-src_nfprobe__plugin_netflow9.c | 11 +++++++++++
net-mgmt/pmacct/files/patch-src_sflow.c | 11 +++++++++++
3 files changed, 23 insertions(+)
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;
+
More information about the dev-commits-ports-all
mailing list