summaryrefslogtreecommitdiffstats
path: root/freebsd/contrib/libpcap/extract.h
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/contrib/libpcap/extract.h')
-rw-r--r--freebsd/contrib/libpcap/extract.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/freebsd/contrib/libpcap/extract.h b/freebsd/contrib/libpcap/extract.h
index face5b7e..aa3ff991 100644
--- a/freebsd/contrib/libpcap/extract.h
+++ b/freebsd/contrib/libpcap/extract.h
@@ -23,6 +23,9 @@
#include <arpa/inet.h>
#endif
+#include <pcap/pcap-inttypes.h>
+#include <pcap/compiler-tests.h>
+
/*
* Macros to extract possibly-unaligned big-endian integral values.
*/
@@ -30,15 +33,16 @@
/*
* The processor doesn't natively handle unaligned loads.
*/
-#if defined(__GNUC__) && defined(HAVE___ATTRIBUTE__) && \
+#if PCAP_IS_AT_LEAST_GNUC_VERSION(2,0) && \
(defined(__alpha) || defined(__alpha__) || \
defined(__mips) || defined(__mips__))
-
/*
- * This is a GCC-compatible compiler and we have __attribute__, which
- * we assume that mean we have __attribute__((packed)), and this is
- * MIPS or Alpha, which has instructions that can help when doing
- * unaligned loads.
+ * This is MIPS or Alpha, which don't natively handle unaligned loads,
+ * but which have instructions that can help when doing unaligned
+ * loads, and this is GCC 2.0 or later or a compiler that claims to
+ * be GCC 2.0 or later, which we assume that mean we have
+ * __attribute__((packed)), which we can use to convince the compiler
+ * to generate those instructions.
*
* Declare packed structures containing a uint16_t and a uint32_t,
* cast the pointer to point to one of those, and fetch through it;