mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 11:13:03 +00:00
examples: fix missing includes
* examples/c/bistromathic/parse.y: Use abort rather than assert so that the "unused result" warning is silenced even with -DNDEBUG.
This commit is contained in:
@@ -267,8 +267,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
int n = sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars);
|
if (sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars) != 1)
|
||||||
assert (n == 1);
|
abort ();
|
||||||
*line += nchars - 1;
|
*line += nchars - 1;
|
||||||
yylloc->last_column += nchars - 1;
|
yylloc->last_column += nchars - 1;
|
||||||
return TOK_NUM;
|
return TOK_NUM;
|
||||||
@@ -284,8 +284,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
int n = sscanf (*line - 1, "%99[a-z]%n", buf, &nchars);
|
if (sscanf (*line - 1, "%99[a-z]%n", buf, &nchars) != 1)
|
||||||
assert (n == 1);
|
abort ();
|
||||||
*line += nchars - 1;
|
*line += nchars - 1;
|
||||||
yylloc->last_column += nchars - 1;
|
yylloc->last_column += nchars - 1;
|
||||||
if (strcmp (buf, "exit") == 0)
|
if (strcmp (buf, "exit") == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user