]> The Tcpdump Group git mirrors - tcpdump/blobdiff - funcattrs.h
Use more the ND_TTEST_1() macro
[tcpdump] / funcattrs.h
index 63d3f5656cf0900a8ec614cf3f27daedd586e620..cb0678eaa8a2be72680962b3b2121ceac56d92b8 100644 (file)
    * HP aCC A.06.10 and later.
    */
   #define NORETURN __attribute((noreturn))
+
+  /*
+   * However, GCC didn't support that for function *pointers* until GCC
+   * 4.1.0; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3481.
+   *
+   * Sun C/Oracle Studio C doesn't seem to support it, either.
+   */
+  #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 401)) \
+      || (defined(__SUNPRO_C))
+    #define NORETURN_FUNCPTR
+  #else
+    #define NORETURN_FUNCPTR __attribute((noreturn))
+  #endif
 #elif defined(_MSC_VER)
   /*
    * MSVC.
+   * It doesn't allow __declspec(noreturn) to be applied to function
+   * pointers.
    */
   #define NORETURN __declspec(noreturn)
+  #define NORETURN_FUNCPTR
 #else
   #define NORETURN
+  #define NORETURN_FUNCPTR
 #endif
 
 /*
    * or HP aCC A.06.10 and later.
    */
   #define PRINTFLIKE(x,y) __attribute__((__format__(__printf__,x,y)))
+
+  /*
+   * However, GCC didn't support that for function *pointers* until GCC
+   * 4.1.0; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3481.
+   */
+  #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 401))
+    #define PRINTFLIKE_FUNCPTR(x,y)
+  #else
+    #define PRINTFLIKE_FUNCPTR(x,y) __attribute__((__format__(__printf__,x,y)))
+  #endif
 #else
   #define PRINTFLIKE(x,y)
+  #define PRINTFLIKE_FUNCPTR(x,y)
 #endif
 
 /*