From 11a5f0edf156bf2bb828ede170a0d03aa2b4befd Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 3 Aug 2020 01:15:57 +0800 Subject: [PATCH] No "Statement has no effect" warnings on statements with errors. --- src/cc65/stmt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cc65/stmt.c b/src/cc65/stmt.c index b02ae1cd6..27665e619 100644 --- a/src/cc65/stmt.c +++ b/src/cc65/stmt.c @@ -581,6 +581,7 @@ int Statement (int* PendingToken) ExprDesc Expr; int GotBreak; CodeMark Start, End; + unsigned PrevErrorCount = ErrorCount; /* Assume no pending token */ if (PendingToken) { @@ -681,7 +682,8 @@ int Statement (int* PendingToken) GetCodePos (&End); if (CodeRangeIsEmpty (&Start, &End) && !IsTypeVoid (Expr.Type) && - IS_Get (&WarnNoEffect)) { + IS_Get (&WarnNoEffect) && + PrevErrorCount == ErrorCount) { Warning ("Statement has no effect"); } CheckSemi (PendingToken);