From 798e5a60fc028f87b4e67cc49ce15fad6c8e0a83 Mon Sep 17 00:00:00 2001 From: Will Estes Date: Mon, 7 Oct 2002 15:29:46 +0000 Subject: [PATCH] ok, here goes; try to handle integral typedefs in one swell foop --- flex.skl | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- flexdef.h | 65 +------------------------------------------- 2 files changed, 80 insertions(+), 65 deletions(-) diff --git a/flex.skl b/flex.skl index 9ba57e2..cc42d47 100644 --- a/flex.skl +++ b/flex.skl @@ -33,6 +33,9 @@ m4_changecom #define YY_FLEX_VERSION VERSION /* First, we deal with platform-specific or compiler-specific issues. */ +#ifdef HAVE_CONFIG_H +#include +#endif /* begin standard C headers. */ %push @@ -41,10 +44,85 @@ m4_changecom #include #include #include + +/* We try to get some modern integral types defined */ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_INTTYPES_H +#include +#endif + +/* sometimes, inttypes.h doesn't do everything that we would have +hoped, so we make sure we have what we need. We try to avoid +redefinition warnings though. The idea is that if we have int8_t then +we probably have the other int*_t types. The logic is similar with +uint*_t types. */ + +#ifndef HAVE_INT8_T + +/* Exact integral types. */ + +/* Signed. */ + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +# if __WORDSIZE == 64 +typedef long int int64_t; +# else +__extension__ typedef long long int int64_t; +# endif +#endif /* ! HAVE_INT8_T */ + +#ifndef HAVE_UINT8_T + +/* Unsigned. */ + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; + +#if __WORDSIZE == 64 +typedef unsigned long int uint64_t; +#else +__extension__ typedef unsigned long long int uint64_t; +#endif +#endif /* ! HAVE_UINT8_T */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + %pop %if-tables-serialization -#include #include %endif /* end standard C headers. */ diff --git a/flexdef.h b/flexdef.h index df4270f..f5e40fb 100644 --- a/flexdef.h +++ b/flexdef.h @@ -48,73 +48,10 @@ #ifdef HAVE_LIMITS_H #include #endif -#ifdef HAVE_STDINT_H -#include -#endif -#ifndef HAVE_INTTYPES_H_WITH_UINTMAX -/* Exact integral types. */ - -/* Signed. */ - -#ifndef __int8_t_defined -# define __int8_t_defined -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; - -# if __WORDSIZE == 64 -typedef long int int64_t; -# else -__extension__ typedef long long int int64_t; -# endif -#endif - -/* Unsigned. */ -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; - -#if __WORDSIZE == 64 -typedef unsigned long int uint64_t; -#else -__extension__ typedef unsigned long long int uint64_t; -#endif -#endif /* ! HAVE_INTTYPES_H_WITH_UINTMAX */ - - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - - #ifdef HAVE_SYS_TYPES_H #include #endif + #ifdef HAVE_UNISTD_H #include #endif -- 2.40.0