From b1327c56f7f940f13886a1b6561a5132fa0a43b3 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 6 Jun 2020 07:22:53 +0200 Subject: [PATCH] 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. --- examples/c/bistromathic/parse.y | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y index dc048cfe..69c0dd12 100644 --- a/examples/c/bistromathic/parse.y +++ b/examples/c/bistromathic/parse.y @@ -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)