No "Statement has no effect" warnings on statements with errors.
This commit is contained in:
@@ -581,6 +581,7 @@ int Statement (int* PendingToken)
|
|||||||
ExprDesc Expr;
|
ExprDesc Expr;
|
||||||
int GotBreak;
|
int GotBreak;
|
||||||
CodeMark Start, End;
|
CodeMark Start, End;
|
||||||
|
unsigned PrevErrorCount = ErrorCount;
|
||||||
|
|
||||||
/* Assume no pending token */
|
/* Assume no pending token */
|
||||||
if (PendingToken) {
|
if (PendingToken) {
|
||||||
@@ -681,7 +682,8 @@ int Statement (int* PendingToken)
|
|||||||
GetCodePos (&End);
|
GetCodePos (&End);
|
||||||
if (CodeRangeIsEmpty (&Start, &End) &&
|
if (CodeRangeIsEmpty (&Start, &End) &&
|
||||||
!IsTypeVoid (Expr.Type) &&
|
!IsTypeVoid (Expr.Type) &&
|
||||||
IS_Get (&WarnNoEffect)) {
|
IS_Get (&WarnNoEffect) &&
|
||||||
|
PrevErrorCount == ErrorCount) {
|
||||||
Warning ("Statement has no effect");
|
Warning ("Statement has no effect");
|
||||||
}
|
}
|
||||||
CheckSemi (PendingToken);
|
CheckSemi (PendingToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user