diff options
author | Guy Harris <gharris@sonic.net> | 2022-08-23 03:32:58 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2022-08-23 03:32:58 -0700 |
commit | c595ef58cf1bc66d475035966850f8b4e14ec175 (patch) | |
tree | 3df74bfc65a40b249474f4413452ecb1fd1af023 | |
parent | 2ec8514c38766248722152cafdec3c739e601fe4 (diff) |
Use _declspec(deprecated(msg)) rather than __pragma(deprecated).
_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.
-rw-r--r-- | pcap/funcattrs.h | 14 | ||||
-rw-r--r-- | pcap/namedb.h | 5 | ||||
-rw-r--r-- | pcap/pcap.h | 12 |
3 files changed, 15 insertions, 16 deletions
diff --git a/pcap/funcattrs.h b/pcap/funcattrs.h index 5dbc428c..3dcf6e61 100644 --- a/pcap/funcattrs.h +++ b/pcap/funcattrs.h @@ -290,10 +290,8 @@ * 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) \ @@ -306,7 +304,7 @@ * 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. @@ -314,7 +312,7 @@ * 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 @@ -323,9 +321,9 @@ * 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 /* diff --git a/pcap/namedb.h b/pcap/namedb.h index 34a0ae7e..51d1e318 100644 --- a/pcap/namedb.h +++ b/pcap/namedb.h @@ -59,8 +59,9 @@ PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *); 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 *); diff --git a/pcap/pcap.h b/pcap/pcap.h index 030b582c..78570744 100644 --- a/pcap/pcap.h +++ b/pcap/pcap.h @@ -439,8 +439,8 @@ PCAP_API int pcap_init(unsigned int, char *); * 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 *); @@ -662,9 +662,9 @@ PCAP_API int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, 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_DEPRECATED(pcap_compile_nopcap, "use pcap_open_dead(), pcap_compile() and pcap_close()"); + const char *, int, bpf_u_int32); /* XXX - this took two arguments in 0.4 and 0.5 */ PCAP_AVAILABLE_0_6 @@ -729,8 +729,8 @@ PCAP_API FILE *pcap_file(pcap_t *); * 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 *); |