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:
Akim Demaille
2018-12-13 18:22:43 +01:00
parent aadf6c0bf3
commit 953a95695a
2 changed files with 7 additions and 0 deletions

View File

@@ -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)