Skip to content

Commit

Permalink
Merge pull request #1952 from yebblies/missingdefault
Browse files Browse the repository at this point in the history
Add missing default cases to switches
  • Loading branch information
Don Clugston authored and WalterBright committed May 4, 2013
1 parent 9019ed0 commit 21dc76c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/cast.c
Expand Up @@ -1670,6 +1670,8 @@ Expression *Expression::integralPromotions(Scope *sc)
case Tdchar:
e = e->castTo(sc, Type::tuns32);
break;
default:
break;
}
return e;
}
Expand Down
2 changes: 2 additions & 0 deletions src/lexer.c
Expand Up @@ -930,6 +930,8 @@ void Lexer::scan(Token *t)
}
continue;
}
default:
break;
}
t->value = TOKdiv;
return;
Expand Down
13 changes: 10 additions & 3 deletions src/mtype.c
Expand Up @@ -1444,8 +1444,9 @@ int TypeBasic::isZeroInit(Loc loc)
case Tcomplex64:
case Tcomplex80:
return 0; // no
default:
return 1; // yes
}
return 1; // yes
}

int TypeBasic::isbit()
Expand Down Expand Up @@ -1909,6 +1910,8 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)
case Tnone:
error(loc, "can't have array of %s", tbn->toChars());
goto Lerror;
default:
break;
}
if (tbn->isscope())
{ error(loc, "cannot have array of auto %s", tbn->toChars());
Expand Down Expand Up @@ -2101,7 +2104,9 @@ Type *TypeDArray::semantic(Loc loc, Scope *sc)
case Tnone:
case Ttuple:
error(loc, "can't have array of %s", tbn->toChars());
tn = next = tint32;
case Terror:
return Type::terror;
default:
break;
}
if (tn->isscope())
Expand Down Expand Up @@ -2499,7 +2504,9 @@ Type *TypePointer::semantic(Loc loc, Scope *sc)
{
case Ttuple:
error(loc, "can't have pointer to %s", n->toChars());
n = tint32;
case Terror:
return Type::terror;
default:
break;
}
if (n != next)
Expand Down
2 changes: 2 additions & 0 deletions src/parse.c
Expand Up @@ -4937,6 +4937,8 @@ Expression *Parser::parseUnaryExp()
}
return e;
}
default:
break;
}
}
#endif
Expand Down

0 comments on commit 21dc76c

Please sign in to comment.