summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Estes <westes@users.noreply.github.com>2022-06-17 07:46:28 -0400
committerGitHub <noreply@github.com>2022-06-17 07:46:28 -0400
commit1656033045225767dd312ec24b067a9857084b69 (patch)
treedd6cb12e411f382873cd685a8ac3cd8a0aa6729f
parent74a89fd6abf178f50f180f228613345682f7fd18 (diff)
parent8ab4ea7364641bf498ea2fc8c1078b9f871ae0ba (diff)
downloadflex-git-1656033045225767dd312ec24b067a9857084b69.tar.gz
Merge pull request #531 from Explorer09/flexint-include
Also check for C++ standard version when deciding to include <stdint.h>
-rw-r--r--src/flexint_shared.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/flexint_shared.h b/src/flexint_shared.h
index b58eee6..50c0a0a 100644
--- a/src/flexint_shared.h
+++ b/src/flexint_shared.h
@@ -4,6 +4,11 @@
#define YYFLEX_INTTYPES_DEFINED
/* Prefer C99 integer types if available. */
+
+# if defined(__cplusplus) && __cplusplus >= 201103L
+#include <cstdint>
+# define YYFLEX_USE_STDINT
+# endif
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* Include <inttypes.h> and not <stdint.h> because Solaris 2.6 has the former
* and not the latter.
@@ -33,7 +38,11 @@ typedef unsigned short int flex_uint16_t;
# ifdef __STDC__
typedef signed char flex_int8_t;
/* ISO C only requires at least 16 bits for int. */
+# ifdef __cplusplus
+#include <climits>
+# else
#include <limits.h>
+# endif
# if UINT_MAX >= 4294967295
# define YYFLEX_INT32_DEFINED
typedef int flex_int32_t;