The Capsicum workaround I added in commit
706c79e causes a side effect
on FreeBSD 11.4, 12.2 and 13.0 with local libpcap when Capsicum is
enabled, that is, in CMake builds (Capsicum detection is broken in
Autoconf builds, as it turns out). Add a workaround for the side effect
as well and get rid of another warning and respective exemption:
tcpdump.c:2286:3: warning: implicit declaration of function 'bpf_dump'
is invalid in C99 [-Wimplicit-function-declaration]
(cherry picked from commit
51f9c3b947eac89254c4e3662902487e0844a699)
# shellcheck disable=SC2006
case `os_id`/"$CMAKE" in
FreeBSD-*/yes)
- # tcpdump.c:2290:3: error: implicit declaration of function 'bpf_dump'
- # [-Werror=implicit-function-declaration]
- [ "$BUILD_LIBPCAP" = yes ] && TCPDUMP_TAINTED=yes
case `cc_id` in
clang-*)
# tcpdump.c:2434:32: error: '_Generic' is a C11 extension
#ifndef HAVE_BPF_DUMP
struct bpf_program;
+#endif
+/*
+ * With Capsicum bpf_dump() may be not declared even if HAVE_BPF_DUMP is set.
+ */
+#if !defined(HAVE_BPF_DUMP) || \
+ (defined(HAVE_BPF_DUMP) && HAVE_CAPSICUM && !defined(bpf_dump))
extern void bpf_dump(const struct bpf_program *, int);
#endif
#endif
/* Capsicum-specific code requires macros from <net/bpf.h>, which will fail
* to compile if <pcap.h> has already been included; including the headers
- * in the opposite order works fine.
+ * in the opposite order works fine. For the most part anyway, because in
+ * FreeBSD <pcap/pcap.h> declares bpf_dump() instead of <net/bpf.h>. Thus
+ * interface.h takes care of it later to avoid a compiler warning.
*/
#ifdef HAVE_CAPSICUM
#include <sys/capsicum.h>