mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
c: improve port of stdint.h usage to pre-C99
Oracle Solaris Studio 12.3 (Sun C 5.12 2011/11/16) by default does not conform to C99; it defines __STDC_VERSION__ to be 199409L, so the Bison code does not include <stdint.h> (not required by C89 amendment 1) even though this compiler does have <stdint.h>. On this platform <limits.h> defines INT_LEAST8_MAX (POSIX allows this) so the skeleton got confused and thought that <stdint.h> had been included even though it wasn’t. * data/skeletons/c.m4 (b4_c99_int_type_define) [!__PTRDIFF_MAX__]: Always include <limits.h>. (YY_STDINT_H): Define when <stdint.h> was included. All uses of expressions like ‘defined INT_LEAST8_MAX’ changed to ‘defined YY_STDINT_H’, since Sun C 5.12 <limits.h> defines macros like INT_LEAST8_MAX but does not declare types like int_least8_t.
This commit is contained in:
@@ -202,13 +202,10 @@ m4_define([b4_c99_int_type_define],
|
||||
so that the code can choose integer types of a good width. */
|
||||
|
||||
#ifndef __PTRDIFF_MAX__
|
||||
# ifndef INT_MAX
|
||||
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# endif
|
||||
# ifndef PTRDIFF_MAX
|
||||
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
||||
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# endif
|
||||
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
||||
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YY_STDINT_H
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -219,7 +216,7 @@ m4_define([b4_c99_int_type_define],
|
||||
|
||||
#ifdef __INT_LEAST8_MAX__
|
||||
typedef __INT_LEAST8_TYPE__ yytype_int8;
|
||||
#elif defined INT_LEAST8_MAX
|
||||
#elif defined YY_STDINT_H
|
||||
typedef int_least8_t yytype_int8;
|
||||
#else
|
||||
typedef signed char yytype_int8;
|
||||
@@ -227,7 +224,7 @@ typedef signed char yytype_int8;
|
||||
|
||||
#ifdef __INT_LEAST16_MAX__
|
||||
typedef __INT_LEAST16_TYPE__ yytype_int16;
|
||||
#elif defined INT_LEAST16_MAX
|
||||
#elif defined YY_STDINT_H
|
||||
typedef int_least16_t yytype_int16;
|
||||
#else
|
||||
typedef short yytype_int16;
|
||||
@@ -235,7 +232,7 @@ typedef short yytype_int16;
|
||||
|
||||
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
|
||||
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
|
||||
#elif (!defined __UINT_LEAST8_MAX__ && defined UINT_LEAST8_MAX \
|
||||
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
|
||||
&& UINT_LEAST8_MAX <= INT_MAX)
|
||||
typedef uint_least8_t yytype_uint8;
|
||||
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
|
||||
@@ -246,7 +243,7 @@ typedef short yytype_uint8;
|
||||
|
||||
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
|
||||
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
|
||||
#elif (!defined __UINT_LEAST16_MAX__ && defined UINT_LEAST16_MAX \
|
||||
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
|
||||
&& UINT_LEAST16_MAX <= INT_MAX)
|
||||
typedef uint_least16_t yytype_uint16;
|
||||
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
|
||||
|
||||
Reference in New Issue
Block a user