mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
parser: warn about hexadecimal token numbers in Yacc mode
* src/scan-gram.l (scan_integer): Warn. * tests/input.at (Yacc warnings on symbols): Check.
This commit is contained in:
@@ -846,6 +846,10 @@ static unsigned long
|
||||
scan_integer (char const *number, int base, location loc)
|
||||
{
|
||||
verify (INT_MAX < ULONG_MAX);
|
||||
if (base == 16)
|
||||
complain (&loc, Wyacc,
|
||||
_("POSIX Yacc does not support hexadecimal literals"));
|
||||
|
||||
unsigned long num = strtoul (number, NULL, base);
|
||||
|
||||
if (INT_MAX < num)
|
||||
|
||||
@@ -147,6 +147,9 @@ AT_BISON_CHECK([-fcaret -Wyacc input.y], [0], [],
|
||||
[[input.y:1.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc]
|
||||
%nterm exp
|
||||
^^^^^^
|
||||
input.y:2.12-15: warning: POSIX Yacc does not support hexadecimal literals [-Wyacc]
|
||||
%token NUM 0x40 "number"
|
||||
^^^^
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user