Skip to content

Commit

Permalink
use assert(0) instead of null reference
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Sep 10, 2015
1 parent f407129 commit 8043c2c
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/dcast.d
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ extern (C++) MATCH implicitConvTo(Expression e, Type t)
{
printf("Expression::implicitConvTo(this=%s, type=%s, t=%s)\n", e.toChars(), e.type.toChars(), t.toChars());
}
//static int nest; if (++nest == 10) halt();
//static int nest; if (++nest == 10) assert(0);
if (t == Type.terror)
return;
if (!e.type)
Expand Down
2 changes: 1 addition & 1 deletion src/declaration.d
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ public:
printf(" stc = x%x\n", sc.stc);
printf(" storage_class = x%llx\n", storage_class);
printf("linkage = %d\n", sc.linkage);
//if (strcmp(toChars(), "mul") == 0) halt();
//if (strcmp(toChars(), "mul") == 0) assert(0);
}
// if (sem > SemanticStart)
// return;
Expand Down
3 changes: 1 addition & 2 deletions src/dmangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public:
}
// Write argument types
paramsToDecoBuffer(t.parameters);
//if (buf->data[buf->offset - 1] == '@') halt();
//if (buf->data[buf->offset - 1] == '@') assert(0);
buf.writeByte('Z' - t.varargs); // mark end of arg list
if (tret !is null)
visitWithMask(tret, 0);
Expand Down Expand Up @@ -805,7 +805,6 @@ public:
debug
{
printf("storageClass = x%llx\n", p.storageClass & (STCin | STCout | STCref | STClazy));
halt();
}
assert(0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/dstruct.d
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public:
final void semantic(Scope* sc)
{
//printf("+StructDeclaration::semantic(this=%p, %s '%s', sizeok = %d)\n", this, parent->toChars(), toChars(), sizeok);
//static int count; if (++count == 20) halt();
//static int count; if (++count == 20) assert(0);
if (semanticRun >= PASSsemanticdone)
return;
uint dprogress_save = Module.dprogress;
Expand Down
5 changes: 1 addition & 4 deletions src/errors.d
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,5 @@ extern (C++) void fatal()
*/
extern (C++) void halt()
{
debug
{
*cast(char*)0 = 0;
}
assert(0);
}
4 changes: 2 additions & 2 deletions src/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -2576,7 +2576,7 @@ public:
version (none)
{
print();
halt();
assert(0);
}
if (!global.gag)
type = Type.terror;
Expand Down Expand Up @@ -5777,7 +5777,7 @@ public:
{
super(loc, TOKvar, __traits(classInstanceSize, VarExp), var, hasOverloads);
//printf("VarExp(this = %p, '%s', loc = %s)\n", this, var->toChars(), loc.toChars());
//if (strcmp(var->ident->toChars(), "func") == 0) halt();
//if (strcmp(var->ident->toChars(), "func") == 0) assert(0);
this.type = var.type;
}

Expand Down
4 changes: 2 additions & 2 deletions src/init.d
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ public:
Expression toExpression(Type tx = null)
{
//printf("ArrayInitializer::toExpression(), dim = %d\n", dim);
//static int i; if (++i == 2) halt();
//static int i; if (++i == 2) assert(0);
Expressions* elements;
size_t edim;
Type t = null;
Expand Down Expand Up @@ -713,7 +713,7 @@ public:
{
Expression e;
//printf("ArrayInitializer::toAssocArrayInitializer()\n");
//static int i; if (++i == 2) halt();
//static int i; if (++i == 2) assert(0);
auto keys = new Expressions();
keys.setDim(value.dim);
auto values = new Expressions();
Expand Down
2 changes: 1 addition & 1 deletion src/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -7266,7 +7266,7 @@ public:
if (s)
{
s.error(loc, "is used as a type");
//halt();
//assert(0);
}
else
error(loc, "%s is used as a type", toChars());
Expand Down

0 comments on commit 8043c2c

Please sign in to comment.