aboutsummaryrefslogtreecommitdiff
path: root/extract.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-01-21 17:59:07 -0800
committerGuy Harris <guy@alum.mit.edu>2018-01-21 17:59:07 -0800
commit4e84397255c98aa19f83bb1359a33fab1d15397f (patch)
tree7cc5ad346a14a925f5114786019d7d53b6c1d9d2 /extract.h
parent3574778762c76f8d26c3f699cf2c6f126def71a4 (diff)
Don't test for __attribute__ in the configure script.
Instead, use compiler test macros for the one remaining case where we tested for __attribute__ to check whether that *particular* attribute is supported.
Diffstat (limited to 'extract.h')
-rw-r--r--extract.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/extract.h b/extract.h
index 8a8b6024..aa3ff991 100644
--- a/extract.h
+++ b/extract.h
@@ -24,6 +24,7 @@
#endif
#include <pcap/pcap-inttypes.h>
+#include <pcap/compiler-tests.h>
/*
* Macros to extract possibly-unaligned big-endian integral values.
@@ -32,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;