tables: avoid warnings and save bits

The yydefgoto table uses -1 as an invalid for an impossible case (we
never use yydefgoto[0], since it corresponds to the reduction to
$accept, which never happens).  Since yydefgoto is a table of state
numbers, this -1 forces a signed type uselessly, which (1) might
trigger compiler warnings when storing a value from yydefgoto into a
state number (nonnegative), and (2) wastes bits which might result in
using a int16 where a uint8 suffices.

Reported by Jot Dot <jotdot@shaw.ca>.
https://lists.gnu.org/r/bug-bison/2020-11/msg00027.html

* src/tables.c (default_goto): Use 0 rather than -1 as invalid value.
* tests/regression.at: Adjust.
This commit is contained in:
Akim Demaille
2020-12-02 21:39:26 +01:00
parent 9840e5b621
commit 24233748ec
4 changed files with 15 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.7.3.118-d0ea7-dirty. */
/* A Bison parser, made by GNU Bison 3.7.4.133-f40c-dirty. */
/* Bison interface for Yacc-like parsers in C