mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Use “least” types for integers in Yacc tables
This changes the Yacc skeleton to use “least” integer types to keep tables smaller on some platforms, which should lessen cache pressure. Since Bison uses the Yacc skeleton, it follows suit. * data/skeletons/yacc.c: Include limits.h and stdint.h if this seems to be needed. (yytype_uint8, yytype_int8, yytype_uint16, yytype_int16): If available, use GCC predefined macros __INT_MAX__ etc. to select a “least” type, as this avoids namespace hassles. Otherwise, if available fall back on selecting a “least” type via the C99 macros INT_MAX, INT_LEAST8_MAX, etc. Otherwise, fall further back on one of the builtin C99 types signed char, short, and int. Make sure that any selected type promotes to int. Ignore any macros YYTYPE_INT16, YYTYPE_INT8, YYTYPE_UINT16, YYTYPE_UINT8 defined by the user. (ptrdiff_t, PTRDIFF_MAX): Simplify in the light of the above. (yytype_uint8, yytype_uint16): Do not assume that unsigned char and unsigned short promote to int, as this isn’t true on some platforms (e.g., TI TMS320C55x). * src/parse-gram.y (YYTYPE_INT16, YYTYPE_INT8, YYTYPE_UINT16) (YYTYPE_UINT8): Remove, as these are no longer effective.
This commit is contained in:
6
NEWS
6
NEWS
@@ -69,7 +69,11 @@ GNU Bison NEWS
|
||||
|
||||
Bison templates now prefer signed to unsigned integer types when
|
||||
either will do, as the signed types are less error-prone and allow
|
||||
for better checking with 'gcc -fsanitize=undefined'.
|
||||
for better checking with 'gcc -fsanitize=undefined'. Also, the
|
||||
types chosen are now portable to unusual machines where char, short and
|
||||
int are all the same width. On non-GNU platforms this may entail
|
||||
including <limits.h> and (if available) <stdint.h> to define integer types
|
||||
and constants.
|
||||
|
||||
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user