Change #286229
| Category | libpcap |
| Changed by | Denis Ovsienko <denis@ovsienko.info> |
| Changed at | Thu 15 Oct 2026 16:50:59 |
| Repository | https://git.tcpdump.org/libpcap |
| Project | libpcap |
| Branch | master |
| Revision | 79701794b4fe7a2802e896373ff3c8fbe069e9b4 |
Comments
Fix timeradd() and timersub() detection (again). My earlier commits 127da7e and 84c5f4c have not solved the problem exactly right, as can be seen on Debian 12/i686 (also reproduced on Hurd/i386 a while ago): $ tcc --version tcc version 0.9.27 (i386 Linux) In file included from rpcap-protocol.c:44: In file included from ./pcap/pcap.h:124: /usr/include/i386-linux-gnu/sys/time.h:246: warning: timeradd redefined In file included from rpcap-protocol.c:44: In file included from ./pcap/pcap.h:124: /usr/include/i386-linux-gnu/sys/time.h:255: warning: timersub redefined In file included from bpf_filter.c:51: /usr/include/i386-linux-gnu/sys/time.h:246: warning: timeradd redefined In file included from bpf_filter.c:51: /usr/include/i386-linux-gnu/sys/time.h:255: warning: timersub redefined It is wrong to use #ifndef at the compile time in portability.h, which can be (and in fact sometimes is) included before <sys/time.h>, which typically defines timeradd() and timersub(). To fix this, move the replacement macros from portability.h to the only .c file that requires these. If other .c files start requiring the macros in future and the replacements have to be in a shared header again, it will be necessary to involve the build systems again, but to test for a symbol rather than a function and to guard the replacement macros using HAVE_DECL_TIMERADD and HAVE_DECL_TIMERSUB.
Changed files
- portability.h
- testprogs/findalldevstest-perf.c