diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-10-05 13:06:40 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-10-07 00:08:19 -0700 |
commit | 5463291a915ce89d0d807c11859d2750ab59de9e (patch) | |
tree | 5fdbb3a6b05f57532c23ffbdcd323a0835865705 /doc | |
parent | 6373b90fc8f9ab2bfa19a107d44cfad3404faf20 (diff) | |
download | bison-5463291a915ce89d0d807c11859d2750ab59de9e.tar.gz |
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.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/bison.texi | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/bison.texi b/doc/bison.texi index 6f4ca9e2..c78bd31e 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -1447,13 +1447,13 @@ anything other than their usual meanings. In some cases the Bison parser implementation file includes system headers, and in those cases your code should respect the identifiers -reserved by those headers. On some non-GNU hosts, @code{<alloca.h>}, -@code{<malloc.h>}, @code{<stddef.h>}, and @code{<stdlib.h>} are -included as needed to declare memory allocators and related types. +reserved by those headers. On some non-GNU hosts, @code{<limits.h>}, +@code{<stddef.h>}, @code{<stdint.h>} (if available), and @code{<stdlib.h>} +are included to declare memory allocators and integer types and constants. @code{<libintl.h>} is included if message translation is in use (@pxref{Internationalization}). Other system headers may be included -if you define @code{YYDEBUG} to a nonzero value (@pxref{Tracing, -,Tracing Your Parser}). +if you define @code{YYDEBUG} (@pxref{Tracing, ,Tracing Your Parser}) or +@code{YYSTACK_USE_ALLOCA} (@pxref{Table of Symbols}) to a nonzero value. @node Stages @section Stages in Using Bison |