linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] syntax errors in numbers are not fatal
@ 2020-07-14 21:43 Luc Van Oostenryck
  0 siblings, 0 replies; only message in thread
From: Luc Van Oostenryck @ 2020-07-14 21:43 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

When parsing expressions, if an invalid number is reached, a fatal
error is issued. But this is not the kind of error for which
continuing the processing doesn't make sense, since the token
was already categorized as a number during the tokenization.

So, change the fatal error into a normal one (and set the value to 0).

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 expression.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/expression.c b/expression.c
index 1160cd9cc593..02bb5b159d9f 100644
--- a/expression.c
+++ b/expression.c
@@ -379,7 +379,10 @@ Float:
 	return;
 
 Enoint:
-	error_die(expr->pos, "constant %s is not a valid number", show_token(token));
+	sparse_error(expr->pos, "constant %s is not a valid number", show_token(token));
+	expr->type = EXPR_VALUE;
+	expr->value = 0;
+	expr->ctype = &int_ctype;
 }
 
 static struct token *generic_selection(struct token *token, struct expression **tree)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-14 21:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 21:43 [PATCH] syntax errors in numbers are not fatal Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).