git: ac3110dc9ec0 - main - <net/if_strings.h>: Conditionally export table of bit names
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Apr 2025 17:07:34 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=ac3110dc9ec06a9a1fb928902ac2ba742747be15
commit ac3110dc9ec06a9a1fb928902ac2ba742747be15
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-04-28 17:05:38 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-04-28 17:05:38 +0000
<net/if_strings.h>: Conditionally export table of bit names
Only export the array of string names if _WANT_IFCAP_BIT_NAMES is
defined. Exporting them unconditionally can trigger unused variable
warnings if a consumer doesn't use the array.
Reviewed by: olce, bz, brooks
Differential Revision: https://reviews.freebsd.org/D49954
---
sbin/ifconfig/ifconfig_netlink.c | 2 ++
sys/net/if_strings.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
index 5a986e840d7f..c1e6b7be587f 100644
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -25,6 +25,8 @@
* SUCH DAMAGE.
*/
+#define _WANT_IFCAP_BIT_NAMES
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/sys/net/if_strings.h b/sys/net/if_strings.h
index a127fa273a8b..a40debd30ed5 100644
--- a/sys/net/if_strings.h
+++ b/sys/net/if_strings.h
@@ -66,6 +66,7 @@
#define IFCAP2_RXTLS6_NAME IFCAP_RXTLS6_NAME
#define IFCAP2_IPSEC_OFFLOAD_NAME IFCAP_IPSEC_OFFLOAD_NAME
+#ifdef _WANT_IFCAP_BIT_NAMES
static const char *ifcap_bit_names[] = {
IFCAP_RXCSUM_NAME,
IFCAP_TXCSUM_NAME,
@@ -108,5 +109,6 @@ static const char *ifcap_bit_names[] = {
_Static_assert(sizeof(ifcap_bit_names) >= IFCAP_B_SIZE * sizeof(char *),
"ifcap bit names missing from ifcap_bit_names");
#endif
+#endif
#endif