dmd
dmd copied to clipboard
`__has_attribute(deprecated)` + `__attribute__((deprecated(msg)))`
#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 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(msg) __attribute__((deprecated(msg)))
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1)
/*
* GCC 3.1 through 4.4.
*
* Those support __attribute__((deprecated)) but not
* __attribute__((deprecated(msg))).
*/
#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
* 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(msg) _declspec(deprecated(msg)) // *** PREPROCESSOR SEES THIS ONE ***
#else
#define PCAP_DEPRECATED(msg)
#endif
ImportC is not selecting the first case in this C header; I see no reason why ImportC shouldn't be perfectly compatible with __has_attribute(deprecated), and it's probably an easy little win.
#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 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(msg) attribute((deprecated(msg))) #elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1) /
- GCC 3.1 through 4.4.
- Those support attribute((deprecated)) but not
- attribute((deprecated(msg))). / #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
- 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(msg) _declspec(deprecated(msg)) // *** PREPROCESSOR SEES THIS ONE *** #else #define PCAP_DEPRECATED(msg) #endif ImportC is not selecting the first case in this C header; I see no reason why ImportC shouldn't be perfectly compatible with
__has_attribute(deprecated), and it's probably an easy little win.