The [U]INT{8,16,32}_{MIN,MAX} macros are never used in skeleton code.
Having them in skeleton just increases the chance of conflicts in case
that user defines them in non-C99 environment (see issue #307, when
flex code is built in Visual C++ (before VS2013)).
flexint.h is now split in two files. Only "flexint_shared.h" will be
included in skeleton now, which defines flex integral types.
flexint.h contains integer limits macros that would be used in flex
only.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
filter.c \
flexdef.h \
flexint.h \
+ flexint_shared.h \
gen.c \
main.c \
misc.c \
MAINTAINERCLEANFILES = skel.c
-skel.c: flex.skl mkskel.sh flexint.h tables_shared.h tables_shared.c
+skel.c: flex.skl mkskel.sh flexint_shared.h tables_shared.h tables_shared.c
$(SHELL) $(srcdir)/mkskel.sh $(srcdir) $(m4) $(VERSION) > $@.tmp
mv $@.tmp $@
%endif
/* end standard C headers. */
-%if-c-or-c++
-m4preproc_include(`flexint.h')
-%endif
-
/* begin standard C++ headers. */
%if-c++-only
#include <iostream>
/* end standard C++ headers. */
%endif
+%if-c-or-c++
+m4preproc_include(`flexint_shared.h')
+%endif
+
/* TODO: this is always defined, so inline it */
#define yyconst const
#ifndef FLEXINT_H
#define FLEXINT_H
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
/* C++ systems might need __STDC_LIMIT_MACROS defined before including
* <stdint.h>, if you want the limit (max/min) macros for int types.
*/
#define __STDC_LIMIT_MACROS 1
#endif
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
+/* "flexint_shared.h" will be included also in skeleton. It will include
+ * <inttypes.h> (if available) and define flex's integral types.
+ */
+#include "flexint_shared.h"
/* Limits of integral types. */
#ifndef INT8_MIN
#define SIZE_MAX (~(size_t)0)
#endif
-#endif /* ! C99 */
-
#endif /* ! FLEXINT_H */
--- /dev/null
+/* flex integer type definitions */
+
+/* Prefer C99 integer types if available. */
+#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.
+ */
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */