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:
Akim Demaille
2020-06-06 07:22:53 +02:00
parent ae03b16785
commit b1327c56f7

View File

@@ -267,8 +267,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
case '5': case '6': case '7': case '8': case '9':
{
int nchars = 0;
int n = sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars);
assert (n == 1);
if (sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars) != 1)
abort ();
*line += nchars - 1;
yylloc->last_column += nchars - 1;
return TOK_NUM;
@@ -284,8 +284,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
{
int nchars = 0;
char buf[100];
int n = sscanf (*line - 1, "%99[a-z]%n", buf, &nchars);
assert (n == 1);
if (sscanf (*line - 1, "%99[a-z]%n", buf, &nchars) != 1)
abort ();
*line += nchars - 1;
yylloc->last_column += nchars - 1;
if (strcmp (buf, "exit") == 0)