aboutsummaryrefslogtreecommitdiff
path: root/scanner.l
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-09-04 00:51:48 -0700
committerGuy Harris <guy@alum.mit.edu>2017-09-04 00:51:48 -0700
commita5514e389019adda62f2d34dd02555f95af0f6d9 (patch)
tree37eb924a593af1ea6bdf2705aad453b6db7ee07c /scanner.l
parent788b880617318c55db670e533ac3124ea77eafb9 (diff)
Put the stuff to get the sized integer types defined into pcap-types.h.
Have pcap-types.h arrange to define the intN_t/u_intN_t types, and the INTn_MAX/UINTn_MAX values, on all platforms, and use it wherever it's appropriate. Include it up front in scanner.l, to avoid redefinitions of the INTn_MAX/UINTn_MAX types.
Diffstat (limited to 'scanner.l')
-rw-r--r--scanner.l29
1 files changed, 19 insertions, 10 deletions
diff --git a/scanner.l b/scanner.l
index 346eb070..befcfdfd 100644
--- a/scanner.l
+++ b/scanner.l
@@ -3,6 +3,25 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+
+/*
+ * Must come first to avoid warnings on Windows.
+ *
+ * Flex-generated scanners may only include <inttypes.h> if __STDC_VERSION__
+ * is defined with a value >= 199901, meaning "full C99", and MSVC may not
+ * define it with that value, because it isn't 100% C99-compliant, even
+ * though it has an <inttypes.h> capable of defining everything the Flex
+ * scanner needs.
+ *
+ * We, however, will include it if we know we have an MSVC version that has
+ * it; this means that we may define the INTn_MAX and UINTn_MAX values in
+ * scanner.c, and then include <stdint.h>, which may define them differently
+ * (same value, but different string of characters), causing compiler warnings.
+ *
+ * If we include it here, and they're defined, that'll prevent scanner.c
+ * from defining them.
+ */
+#include <pcap-types.h>
}
/*
@@ -65,16 +84,6 @@
#ifdef _WIN32
#include <pcap-stdinc.h>
-#else
- #if HAVE_INTTYPES_H
- #include <inttypes.h>
- #elif HAVE_STDINT_H
- #include <stdint.h>
- #endif
- #ifdef HAVE_SYS_BITYPES_H
- #include <sys/bitypes.h>
- #endif
- #include <sys/types.h>
#endif
#include <ctype.h>