]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix MSVC build.
authorGuy Harris <[email protected]>
Wed, 28 Mar 2018 23:40:49 +0000 (16:40 -0700)
committerGuy Harris <[email protected]>
Wed, 28 Mar 2018 23:40:49 +0000 (16:40 -0700)
gencode.c
pcap/funcattrs.h

index 3c2a35d4fd89382519719afffe0cacbacef52c10..74654fbb18f3115791feb15abb81489816db883a 100644 (file)
--- 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");
index 8753893f8862790c3331f51f7610d132adfd8cf2..a8b1932f4c6e187c5862bc87e352268c6e5345a8 100644 (file)
  * 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) \
    * 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
 
 /*