From: uz Date: Thu, 30 Dec 2010 19:30:54 +0000 (+0000) Subject: Fix consecutive false errors when a label without a following statement is X-Git-Tag: V2.13.3~562 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=212941ddb46b3855008fcda25b6e18c4d2719694;p=cc65 Fix consecutive false errors when a label without a following statement is encountered. git-svn-id: svn://svn.cc65.org/cc65/trunk@4894 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/stmt.c b/src/cc65/stmt.c index 5bc4df4a9..74fbf6ea9 100644 --- a/src/cc65/stmt.c +++ b/src/cc65/stmt.c @@ -71,7 +71,7 @@ -static void CheckLabelWithoutStatement (void) +static int CheckLabelWithoutStatement (void) /* Called from Statement() after a label definition. Will check for a * following closing curly brace. This means that a label is not followed * by a statement which is required by the standard. Output an error if so. @@ -79,6 +79,9 @@ static void CheckLabelWithoutStatement (void) { if (CurTok.Tok == TOK_RCURLY) { Error ("Label at end of compound statement"); + return 1; + } else { + return 0; } } @@ -569,7 +572,9 @@ int Statement (int* PendingToken) while (CurTok.Tok == TOK_IDENT && NextTok.Tok == TOK_COLON) { /* Handle the label */ DoLabel (); - CheckLabelWithoutStatement (); + if (CheckLabelWithoutStatement ()) { + return 0; + } } switch (CurTok.Tok) { @@ -653,7 +658,7 @@ int Statement (int* PendingToken) * void, emit a warning. */ GetCodePos (&End); - if (CodeRangeIsEmpty (&Start, &End) && + if (CodeRangeIsEmpty (&Start, &End) && !IsTypeVoid (Expr.Type) && IS_Get (&WarnNoEffect)) { Warning ("Statement has no effect");