From: Guy Harris Date: Wed, 28 Mar 2018 23:40:49 +0000 (-0700) Subject: Fix MSVC build. X-Git-Tag: libpcap-1.9-bp~158 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/896a9514ecf0b2f216661fa18f973573b4b492cb Fix MSVC build. --- diff --git a/gencode.c b/gencode.c index 3c2a35d4..74654fbb 100644 --- a/gencode.c +++ b/gencode.c @@ -646,7 +646,7 @@ gen_retblk(compiler_state_t *cstate, int v) return b; } -static inline PCAP_NORETURN void +static inline PCAP_NORETURN_DEF void syntax(compiler_state_t *cstate) { bpf_error(cstate, "syntax error in filter expression"); diff --git a/pcap/funcattrs.h b/pcap/funcattrs.h index 8753893f..a8b1932f 100644 --- a/pcap/funcattrs.h +++ b/pcap/funcattrs.h @@ -151,6 +151,12 @@ * never returns". (It must go before the function declaration, e.g. * "extern PCAP_NORETURN func(...)" rather than after the function * declaration, as the MSVC version has to go before the declaration.) + * + * PCAP_NORETURN_DEF, before a function *definition*, means "this + * function never returns"; it would be used only for static functions + * that are defined before any use, and thus have no declaration. + * (MSVC doesn't support that; I guess the "decl" in "__declspec" + * means "declaration", and __declspec doesn't work with definitions.) */ #if __has_attribute(noreturn) \ || PCAP_IS_AT_LEAST_GNUC_VERSION(2,5) \ @@ -164,13 +170,16 @@ * HP aCC A.06.10 and later. */ #define PCAP_NORETURN __attribute((noreturn)) + #define PCAP_NORETURN_DEF __attribute((noreturn)) #elif defined(_MSC_VER) /* * MSVC. */ #define PCAP_NORETURN __declspec(noreturn) + #define PCAP_NORETURN_DEF #else #define PCAP_NORETURN + #define PCAP_NORETURN_DEF #endif /*