summaryrefslogtreecommitdiff
path: root/netdissect-stdinc.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-08-18 20:11:43 -0700
committerGuy Harris <guy@alum.mit.edu>2017-08-18 20:11:43 -0700
commit141c1c6f498390820c8913408d8af6cf6e97152a (patch)
treeb87e7ece3db1dc714ca044c49aeb10f862095938 /netdissect-stdinc.h
parent3951a87cbe09333a11faa929f93508c848a93fd5 (diff)
downloadtcpdump-141c1c6f498390820c8913408d8af6cf6e97152a.tar.gz
Suppress UBSan warnings from EXTRACT_.
Yes, the behavior of an access with an improperly-aligned pointer is undefined according to the C standard, but if we're doing that in an EXTRACT_ function/macro, we're doing it because we know it's safe and because it's faster than picking the bytes out one by one and assembling them, so suppress those warnings. Pull over libpcap's funcattrs.h and use it to do a bunch of checks for various function attributes; that defines __has_attribute(), so we can use it to check for the "suppress sanitizer warnings" attribute. While we're at it, use other things it defines to specify "this function never returns", "this function is printf-like", and "this function argument is a printf-style format argument", rather than using various configure-script checks. That should let us declare some function attributes with Microsoft Visual Studio's compilers.
Diffstat (limited to 'netdissect-stdinc.h')
-rw-r--r--netdissect-stdinc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/netdissect-stdinc.h b/netdissect-stdinc.h
index fb385fb9..9af1ca17 100644
--- a/netdissect-stdinc.h
+++ b/netdissect-stdinc.h
@@ -394,6 +394,11 @@ struct in6_addr {
* end of Apple deprecation workaround macros
*/
+/*
+ * Function attributes, for various compilers.
+ */
+#include "funcattrs.h"
+
#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))
#endif