summaryrefslogtreecommitdiff
path: root/src/scan-gram.l
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2018-12-13 18:22:43 +0100
committerAkim Demaille <akim.demaille@gmail.com>2018-12-14 05:10:31 +0100
commit953a95695a882ccc203e34cd6bf42585419b27e2 (patch)
tree6f934fab80eaa7b91d1e44270f0dc67df3668271 /src/scan-gram.l
parentaadf6c0bf355359c7cee6e69d80a4b9c8ab91340 (diff)
downloadbison-953a95695a882ccc203e34cd6bf42585419b27e2.tar.gz
parser: warn about hexadecimal token numbers in Yacc mode
* src/scan-gram.l (scan_integer): Warn. * tests/input.at (Yacc warnings on symbols): Check.
Diffstat (limited to 'src/scan-gram.l')
-rw-r--r--src/scan-gram.l4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/scan-gram.l b/src/scan-gram.l
index d3662690..07192f2b 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -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)