diff options
author | Joseph Mingrone <jrm@FreeBSD.org> | 2023-03-31 19:01:44 +0000 |
---|---|---|
committer | Joseph Mingrone <jrm@FreeBSD.org> | 2023-03-31 19:02:22 +0000 |
commit | 6f9cba8f8b5efd16249633e52483ea351876b67b (patch) | |
tree | 544c9dc831f12dad8ce0bf0af943eb68d07a845f /contrib/libpcap/ftmacros.h | |
parent | d860991a7289c673d19467ea7faae46df7681db1 (diff) | |
parent | 35af88c96350eb786f1198dfb6b29a171016e6bf (diff) | |
download | src-6f9cba8f8b5efd16249633e52483ea351876b67b.tar.gz src-6f9cba8f8b5efd16249633e52483ea351876b67b.zip |
Diffstat (limited to 'contrib/libpcap/ftmacros.h')
-rw-r--r-- | contrib/libpcap/ftmacros.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/contrib/libpcap/ftmacros.h b/contrib/libpcap/ftmacros.h index cd3daebdf175..7975463b3a69 100644 --- a/contrib/libpcap/ftmacros.h +++ b/contrib/libpcap/ftmacros.h @@ -45,7 +45,12 @@ * namespace to the maximum extent possible"? */ #if defined(sun) || defined(__sun) - #define __EXTENSIONS__ + /* + * On Solaris Clang defines __EXTENSIONS__ automatically. + */ + #ifndef __EXTENSIONS__ + #define __EXTENSIONS__ + #endif /* * We also need to define _XPG4_2 in order to get @@ -83,14 +88,18 @@ * least with HP's C compiler; hopefully doing so won't make it * *not* work with *un*-threaded code. */ -#elif defined(__linux__) || defined(linux) || defined(__linux) +#else /* * Turn on _GNU_SOURCE to get everything GNU libc has to offer, - * including asprintf(). + * including asprintf(), if we're using GNU libc. * * Unfortunately, one thing it has to offer is a strerror_r() * that's not POSIX-compliant, but we deal with that in * pcap_fmt_errmsg_for_errno(). + * + * We don't limit this to, for example, Linux and Cygwin, because + * this might, for example, be GNU/HURD or one of Debian's kFreeBSD + * OSes ("GNU/FreeBSD"). */ #define _GNU_SOURCE @@ -101,9 +110,18 @@ * don't whine about _BSD_SOURCE being deprecated; we still have * to define _BSD_SOURCE to handle older versions of GNU libc that * don't support _DEFAULT_SOURCE. + * + * But, if it's already defined, don't define it, so that we don't + * get a warning of it being redefined if it's defined as, for + * example, 1. */ - #define _DEFAULT_SOURCE - #define _BSD_SOURCE + #ifndef _DEFAULT_SOURCE + #define _DEFAULT_SOURCE + #endif + /* Avoid redefining _BSD_SOURCE if it's already defined as for ex. 1 */ + #ifndef _BSD_SOURCE + #define _BSD_SOURCE + #endif #endif #endif |