From 8ab4ea7364641bf498ea2fc8c1078b9f871ae0ba Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Fri, 17 Jun 2022 19:35:49 +0800 Subject: Also check for C++ standard version when deciding to include Fixes: #517 Signed-off-by: Kang-Che Sung --- src/flexint_shared.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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 +# define YYFLEX_USE_STDINT +# endif # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* Include and not 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 +# else #include +# endif # if UINT_MAX >= 4294967295 # define YYFLEX_INT32_DEFINED typedef int flex_int32_t; -- cgit v1.2.1