]> The Tcpdump Group git mirrors - tcpdump/commit
Use basename() and dirname() right on FreeBSD. [skip appveyor]
authorDenis Ovsienko <[email protected]>
Thu, 5 Aug 2021 13:18:55 +0000 (14:18 +0100)
committerDenis Ovsienko <[email protected]>
Thu, 5 Aug 2021 13:39:45 +0000 (14:39 +0100)
commit780f86b43c33d3f0fd0c067e2c1847e2a6360dae
tree2f9b7573e78566111bb35c1d228d0087578fe1e4
parentac23514a0cc7a08eec383aac352fa3f7d39dec2c
Use basename() and dirname() right on FreeBSD. [skip appveyor]

On FreeBSD CMake runs Clang with -std=gnu99, which used to emit three
warnings in a Capsicum-specific block along the following lines:

tcpdump.c:2432:32: warning: '_Generic' is a C11 extension
  [-Wc11-extensions]
/usr/include/libgen.h:61:21: note: expanded from macro 'basename'
  basename)(x)
/usr/include/sys/cdefs.h:325:2: note: expanded from macro '__generic'
        _Generic(expr, t: yes, default: no)

(In the same context Autoconf does not request a specific C standard
from Clang, so it happens to use C17 and there is no warning.)

Type-generic expressions support in C99 mode seems to be a quirk of
Clang that cannot be disabled and is harmless in this context, so
introduce and use another pair of diagnostic control macros (for Clang
only) to squelch the warnings.

While at it, study the reason for _Generic use in /usr/include/libgen.h
and realize that tcpdump.c still assumes the behaviour before FreeBSD
12.0.  Add two temporary buffers around basename() and dirname() calls
to get consistent results regardless of which FreeBSD version it is.

Remove the last remaining exemption rule.
build.sh
diag-control.h
tcpdump.c