_declspec(deprecated(msg)) doesn't require the function name, and takes
a message as an argument and causes it to be used as the warning/error
message for use of an undeclared function.
(cherry picked from commit
c595ef58cf1bc66d475035966850f8b4e14ec175)
* PCAP_DEPRECATED(func, msg), after a function declaration, marks the
* function as deprecated.
*
* 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) \
*/
#if __has_attribute(deprecated) \
|| PCAP_IS_AT_LEAST_GNUC_VERSION(4,5) \
* incorrectly, that anything that supports __has_attribute() is
* recent enough to support __attribute__((deprecated(msg)))).
*/
* 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.
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1)
/*
* GCC 3.1 through 4.4.
* Those support __attribute__((deprecated)) but not
* __attribute__((deprecated(msg))).
*/
* 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
#elif defined(_MSC_VER) && !defined(BUILDING_PCAP)
/*
* MSVC, and we're not building libpcap itself; it's VS 2015
* If we *are* building libpcap, we don't want this, as it'll warn
* us even if we *define* the function.
*/
* 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))
- #define PCAP_DEPRECATED(func, msg)
+ #define PCAP_DEPRECATED(msg)
PCAP_API u_char *pcap_ether_hostton(const char*);
PCAP_API u_char *pcap_ether_aton(const char *);
PCAP_API u_char *pcap_ether_hostton(const char*);
PCAP_API u_char *pcap_ether_aton(const char *);
-PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *)
-PCAP_DEPRECATED(pcap_nametoaddr, "this is not reentrant; use 'pcap_nametoaddrinfo' instead");
+PCAP_API
+PCAP_DEPRECATED("this is not reentrant; use 'pcap_nametoaddrinfo' instead")
+bpf_u_int32 **pcap_nametoaddr(const char *);
PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
* should use pcap_findalldevs() and use the first device.
*/
PCAP_AVAILABLE_0_4
* should use pcap_findalldevs() and use the first device.
*/
PCAP_AVAILABLE_0_4
-PCAP_API char *pcap_lookupdev(char *)
-PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device");
+PCAP_DEPRECATED("use 'pcap_findalldevs' and use the first device")
+PCAP_API char *pcap_lookupdev(char *);
PCAP_AVAILABLE_0_4
PCAP_API int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
PCAP_AVAILABLE_0_4
PCAP_API int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
bpf_u_int32);
PCAP_AVAILABLE_0_5
bpf_u_int32);
PCAP_AVAILABLE_0_5
+PCAP_DEPRECATED("use pcap_open_dead(), pcap_compile() and pcap_close()")
PCAP_API int pcap_compile_nopcap(int, int, struct bpf_program *,
const char *, int, bpf_u_int32);
PCAP_API int pcap_compile_nopcap(int, int, struct bpf_program *,
const char *, int, bpf_u_int32);
* a Windows-only pcap_handle() API that returns the HANDLE.
*/
PCAP_AVAILABLE_0_4
* a Windows-only pcap_handle() API that returns the HANDLE.
*/
PCAP_AVAILABLE_0_4
-PCAP_API int pcap_fileno(pcap_t *)
-PCAP_DEPRECATED(pcap_fileno, "request a 'pcap_handle' that returns a HANDLE if you need it");
+PCAP_DEPRECATED("request a 'pcap_handle' that returns a HANDLE if you need it")
+PCAP_API int pcap_fileno(pcap_t *);
#else /* _WIN32 */
PCAP_AVAILABLE_0_4
PCAP_API int pcap_fileno(pcap_t *);
#else /* _WIN32 */
PCAP_AVAILABLE_0_4
PCAP_API int pcap_fileno(pcap_t *);