aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-10-19 11:17:43 -0700
committerGuy Harris <gharris@sonic.net>2020-10-19 11:17:43 -0700
commit0d2277bca5fc1c259efca59adff9caaf247f1974 (patch)
treef1e5df28574d70d1a7ed72719e3c81db50f3b561 /wiretap
parenta76c11e290cc2ff9283d269f29a312ad1b8f7edf (diff)
Include <stdint.h> in YACC/Bison parsers if necessary.
MSVC doesn't, by default, define __STDC_VERSION__, which means that the code generated by newer versions of winflexbison3's Bison end up defining YYPTRDIFF_T as long, which is wrong on 64-bit Windows, as that's an LLP64 platform, not an LP64 platform, and causes warnings to be generated. Those warnings turn into errors. With MSVC, if __STDC_VERSION__ isn't defined, Forcibly include <stdint.h> here to work around that. Fixes #16924.
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ascend.y.in14
1 files changed, 14 insertions, 0 deletions
diff --git a/wiretap/ascend.y.in b/wiretap/ascend.y.in
index cbc9f91a7b..0b4dafe803 100644
--- a/wiretap/ascend.y.in
+++ b/wiretap/ascend.y.in
@@ -144,6 +144,20 @@ XMIT-Max7:20: (task "_brouterControlTask" at 0xb094ac20, time: 1481.51) 20 octet
#include "config.h"
+#if defined(_MSC_VER) && !defined(__STDC_VERSION__)
+ /*
+ * MSVC doesn't, by default, define __STDC_VERSION__, which
+ * means that the code generated by newer versions of winflexbison3's
+ * Bison end up defining YYPTRDIFF_T as long, which is wrong on
+ * 64-bit Windows, as that's an LLP64 platform, not an LP64 platform,
+ * and causes warnings to be generated. Those warnings turn into
+ * errors.
+ *
+ * With MSVC, if __STDC_VERSION__ isn't defined, Forcibly include
+ * <stdint.h> here to work around that.
+ */
+ #include <stdint.h>
+#endif
#include <stdlib.h>
#include <string.h>