aboutsummaryrefslogtreecommitdiff
path: root/pcap/funcattrs.h
diff options
context:
space:
mode:
Diffstat (limited to 'pcap/funcattrs.h')
-rw-r--r--pcap/funcattrs.h82
1 files changed, 48 insertions, 34 deletions
diff --git a/pcap/funcattrs.h b/pcap/funcattrs.h
index a2ca542b..37409499 100644
--- a/pcap/funcattrs.h
+++ b/pcap/funcattrs.h
@@ -118,14 +118,14 @@
#if PCAP_IS_AT_LEAST_GNUC_VERSION(3,4) \
|| PCAP_IS_AT_LEAST_XL_C_VERSION(12,0)
/*
- * GCC 3.4 or later, or some compiler asserting compatibility with
- * GCC 3.4 or later, or XL C 13.0 or later, so we have
+ * GCC 3.4 and later, or some compiler asserting compatibility with
+ * GCC 3.4 and later, or XL C 13.0 and later, so we have
* __attribute__((visibility()).
*/
#define PCAP_API_DEF __attribute__((visibility("default")))
#elif PCAP_IS_AT_LEAST_SUNC_VERSION(5,5)
/*
- * Sun C 5.5 or later, so we have __global.
+ * Sun C 5.5 and later, so we have __global.
* (Sun C 5.9 and later also have __attribute__((visibility()),
* but there's no reason to prefer it with Sun C.)
*/
@@ -161,6 +161,15 @@
* provided by Apple, so each release can come with a version compiled
* to use the APIs present in that release.)
*
+ * The non-macOS versioning is based on
+ *
+ * https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
+ *
+ * If there are any corrections, please submit it upstream to the
+ * libpcap maintainers, preferably as a pull request on
+ *
+ * https://github.com/the-tcpdump-group/libpcap
+ *
* We don't define it ourselves because, if you're building and
* installing libpcap on macOS yourself, the APIs will be available
* no matter what OS version you're installing it on.
@@ -172,25 +181,32 @@
* I've never seen earlier releases.
*/
#ifdef __APPLE__
-#define PCAP_AVAILABLE_MACOS(v) /* define to say "first appears in v" */
-#define PCAP_AVAILABLE_0_4 PCAP_AVAILABLE_MACOS(10.0) /* Did any version of Mac OS X ship with this? */
-#define PCAP_AVAILABLE_0_5 PCAP_AVAILABLE_MACOS(10.0) /* Did any version of Mac OS X ship with this? */
-#define PCAP_AVAILABLE_0_6 PCAP_AVAILABLE_MACOS(10.1)
-#define PCAP_AVAILABLE_0_7 PCAP_AVAILABLE_MACOS(10.4)
-#define PCAP_AVAILABLE_0_8 PCAP_AVAILABLE_MACOS(10.4)
-#define PCAP_AVAILABLE_0_9 PCAP_AVAILABLE_MACOS(10.5)
-#define PCAP_AVAILABLE_1_0 PCAP_AVAILABLE_MACOS(10.6)
+#include <Availability.h>
+/*
+ * When building as part of macOS, define this as __API_AVAILABLE(__VA_ARGS__).
+ *
+ * XXX - if there's some #define to indicate that this is being built
+ * as part of the macOS build process, we could make that Just Work.
+ */
+#define PCAP_AVAILABLE(...)
+#define PCAP_AVAILABLE_0_4 PCAP_AVAILABLE(macos(10.0)) /* Did any version of Mac OS X ship with this? */
+#define PCAP_AVAILABLE_0_5 PCAP_AVAILABLE(macos(10.0)) /* Did any version of Mac OS X ship with this? */
+#define PCAP_AVAILABLE_0_6 PCAP_AVAILABLE(macos(10.1))
+#define PCAP_AVAILABLE_0_7 PCAP_AVAILABLE(macos(10.4))
+#define PCAP_AVAILABLE_0_8 PCAP_AVAILABLE(macos(10.4))
+#define PCAP_AVAILABLE_0_9 PCAP_AVAILABLE(macos(10.5), ios(1.0))
+#define PCAP_AVAILABLE_1_0 PCAP_AVAILABLE(macos(10.6), ios(4.0))
/* #define PCAP_AVAILABLE_1_1 no routines added to the API */
-#define PCAP_AVAILABLE_1_2 PCAP_AVAILABLE_MACOS(10.9)
+#define PCAP_AVAILABLE_1_2 PCAP_AVAILABLE(macos(10.9), ios(6.0))
/* #define PCAP_AVAILABLE_1_3 no routines added to the API */
/* #define PCAP_AVAILABLE_1_4 no routines added to the API */
-#define PCAP_AVAILABLE_1_5 PCAP_AVAILABLE_MACOS(10.10)
+#define PCAP_AVAILABLE_1_5 PCAP_AVAILABLE(macos(10.10), ios(7.0), watchos(1.0))
/* #define PCAP_AVAILABLE_1_6 no routines added to the API */
-#define PCAP_AVAILABLE_1_7 PCAP_AVAILABLE_MACOS(10.12)
-#define PCAP_AVAILABLE_1_8 PCAP_AVAILABLE_MACOS(10.13) /* only Windows adds routines to the API; XXX - what version first had it? */
-#define PCAP_AVAILABLE_1_9 PCAP_AVAILABLE_MACOS(10.13)
+#define PCAP_AVAILABLE_1_7 PCAP_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
+#define PCAP_AVAILABLE_1_8 PCAP_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) /* only Windows adds routines to the API; XXX - what version first had it? */
+#define PCAP_AVAILABLE_1_9 PCAP_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0))
#define PCAP_AVAILABLE_1_10 /* not in macOS yet */
-#define PCAP_AVAILABLE_1_11 /* not released yet, so not in macOS yet */
+#define PCAP_AVAILABLE_1_11 /* not released yet, so not in macOS yet */
#else /* __APPLE__ */
#define PCAP_AVAILABLE_0_4
#define PCAP_AVAILABLE_0_5
@@ -230,11 +246,11 @@
|| PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \
|| PCAP_IS_AT_LEAST_HP_C_VERSION(6,10)
/*
- * Compiler with support for __attribute((noreturn)), or GCC 2.5 or
- * later, or some compiler asserting compatibility with GCC 2.5 or
- * later, or Solaris Studio 12 (Sun C 5.9) or later, or IBM XL C 10.1
- * or later (do any earlier versions of XL C support this?), or HP aCC
- * A.06.10 or later.
+ * Compiler with support for __attribute((noreturn)), or GCC 2.5 and
+ * later, or some compiler asserting compatibility with GCC 2.5 and
+ * later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
+ * and later (do any earlier versions of XL C support this?), or HP aCC
+ * A.06.10 and later.
*/
#define PCAP_NORETURN __attribute((noreturn))
#define PCAP_NORETURN_DEF __attribute((noreturn))
@@ -260,8 +276,8 @@
|| PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \
|| PCAP_IS_AT_LEAST_HP_C_VERSION(6,10)
/*
- * Compiler with support for it, or GCC 2.3 or later, or some compiler
- * asserting compatibility with GCC 2.3 or later, or IBM XL C 10.1
+ * Compiler with support for it, or GCC 2.3 and later, or some compiler
+ * asserting compatibility with GCC 2.3 and later, or IBM XL C 10.1
* and later (do any earlier versions of XL C support this?),
* or HP aCC A.06.10 and later.
*/
@@ -274,23 +290,21 @@
* PCAP_DEPRECATED(func, msg), after a function declaration, marks the
* function as deprecated.
*
- * The first argument is the name of the function; the second argument is
- * a string giving the warning message to use if the compiler supports that.
- *
- * (Thank you, Microsoft, for requiring the function name.)
+ * The argument is a string giving the warning message to use if the
+ * compiler supports that.
*/
#if __has_attribute(deprecated) \
|| PCAP_IS_AT_LEAST_GNUC_VERSION(4,5) \
|| PCAP_IS_AT_LEAST_SUNC_VERSION(5,13)
/*
* Compiler that supports __has_attribute and __attribute__((deprecated)),
- * or GCC 4.5 or later, or Sun/Oracle C 12.4 (Sun C 5.13) or later.
+ * or GCC 4.5 and later, or Sun/Oracle C 12.4 (Sun C 5.13) and later.
*
* Those support __attribute__((deprecated(msg))) (we assume, perhaps
* incorrectly, that anything that supports __has_attribute() is
* recent enough to support __attribute__((deprecated(msg)))).
*/
- #define PCAP_DEPRECATED(func, msg) __attribute__((deprecated(msg)))
+ #define PCAP_DEPRECATED(msg) __attribute__((deprecated(msg)))
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1)
/*
* GCC 3.1 through 4.4.
@@ -298,18 +312,18 @@
* Those support __attribute__((deprecated)) but not
* __attribute__((deprecated(msg))).
*/
- #define PCAP_DEPRECATED(func, msg) __attribute__((deprecated))
+ #define PCAP_DEPRECATED(msg) __attribute__((deprecated))
#elif defined(_MSC_VER) && !defined(BUILDING_PCAP)
/*
* MSVC, and we're not building libpcap itself; it's VS 2015
- * or later, so we have the deprecated pragma.
+ * and later, so we have __declspec(deprecated(...)).
*
* If we *are* building libpcap, we don't want this, as it'll warn
* us even if we *define* the function.
*/
- #define PCAP_DEPRECATED(func, msg) __pragma(deprecated(func))
+ #define PCAP_DEPRECATED(msg) _declspec(deprecated(msg))
#else
- #define PCAP_DEPRECATED(func, msg)
+ #define PCAP_DEPRECATED(msg)
#endif
/*