From b557aee415eca57a865debbdf063e1f4d8b50de4 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 17 Oct 2017 15:14:38 +0200 Subject: [PATCH] isl_stream_eat: print error message on EOF isl_stream_eat is called in a situation where a specific token is expected and it already prints an error message when a different token is found. The callers therefore do not print any (extra) error message. However, in case of EOF, no error message was printed, resulting in an error condition without any indication of what went wrong. Print this error message. Signed-off-by: Sven Verdoolaege --- isl_stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/isl_stream.c b/isl_stream.c index cf1fd5e7..beb06a64 100644 --- a/isl_stream.c +++ b/isl_stream.c @@ -725,8 +725,11 @@ int isl_stream_eat(__isl_keep isl_stream *s, int type) struct isl_token *tok; tok = isl_stream_next_token(s); - if (!tok) + if (!tok) { + if (s->eof) + isl_stream_error(s, NULL, "unexpected EOF"); return -1; + } if (tok->type == type) { isl_token_free(tok); return 0; -- 2.11.4.GIT