Skip to content

Commit c60f0d9

Browse files
committed
build: use features that are now supported in the bootstrap compiler
1 parent 6f7b1ed commit c60f0d9

File tree

14 files changed

+5
-58
lines changed

14 files changed

+5
-58
lines changed

analyser/conversion_checker.c2

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ fn bool Checker.checkTypes(Checker* c, const Type* lcanon, const Type* rcanon) {
214214
c.diags.note(c.loc, "TODO CONVERSION %d)", res);
215215
return false;
216216
}
217-
218-
return true;
219217
}
220218

221219
fn bool Checker.checkBuiltins(Checker* c, const Type* lcanon, const Type* rcanon) {
@@ -441,8 +439,6 @@ fn bool Checker.checkEnum2Int(Checker* c, const Type* lcanon, const Type* rcanon
441439

442440
return c.check(c.lhs, impl, c.expr_ptr, c.loc);
443441
}
444-
445-
return true;
446442
}
447443

448444
fn bool Checker.checkFunc2Func(Checker* c, const Type* lcanon, const Type* rcanon) {
@@ -579,8 +575,6 @@ public fn bool Checker.checkCast(Checker* c, QualType lhs, QualType rhs, SrcLoc
579575
c.diags.note(c.loc, "TODO CONVERSION %d)", res);
580576
return false;
581577
}
582-
583-
return true;
584578
}
585579

586580
fn bool Checker.checkBuiltin2PointerCast(Checker* c, const Type* lcanon, const Type* rcanon) {

analyser/module_analyser_unaryop.c2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ fn QualType Analyser.analyseUnaryOperator(Analyser* ma, Expr** e_ptr, u32 side)
127127
ma.error(e.getLoc(), "indirection requires pointer operand ('%s' invalid)", t.diagName());
128128
return QualType_Invalid;
129129
}
130-
break;
131130
case Minus:
132131
QualType lhs = getMinusType(canon);
133132
if (!lhs.isValid()) goto invalid_type;

ast/ast_evaluator.c2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,6 @@ fn Cont WhileStmt.eval(WhileStmt* s, Evaluator* sf) {
501501
return cont;
502502
}
503503
}
504-
return Cont.Abort;
505504
}
506505

507506
fn Cont ForStmt.eval(ForStmt* s, Evaluator* sf) {
@@ -542,7 +541,6 @@ fn Cont ForStmt.eval(ForStmt* s, Evaluator* sf) {
542541
return Cont.Error;
543542
}
544543
}
545-
return Cont.Abort;
546544
}
547545

548546
fn Cont SwitchStmt.eval(SwitchStmt* s, Evaluator* sf) {

ast/type_ref.c2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ public fn SrcLoc TypeRef.getLoc(const TypeRef* r) {
342342
case User:
343343
if (r.hasPrefix()) return r.refs[1].loc;
344344
else return r.refs[0].loc;
345-
break;
346345
case StructMemberType:
347346
//TODO
348347
//return r.user.decl.getLoc();

ast/value.c2

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ public fn bool Value.checkRange(const Value* v, i64 min, u64 max) {
212212
return (v.uvalue <= (u64)~min + 1);
213213
else
214214
return (v.uvalue <= max);
215-
break;
216215
case Float:
217216
return (v.fvalue >= (f64)min && v.fvalue < (f64)max + 1);
218217
default:
@@ -567,7 +566,6 @@ public fn bool Value.is_less(const Value* v1, const Value* v2) {
567566
return !v2.negative || v1.uvalue > v2.uvalue;
568567
else
569568
return !v2.negative && v1.uvalue < v2.uvalue;
570-
break; // TODO: fix bogus error in Analyser.analyseCase
571569
case Float:
572570
return v1.toFloat() < v2.fvalue;
573571
default:
@@ -591,7 +589,6 @@ fn bool Value.is_less_equal(const Value* v1, const Value* v2) {
591589
return !v2.negative || v1.uvalue >= v2.uvalue;
592590
else
593591
return !v2.negative && v1.uvalue <= v2.uvalue;
594-
break; // TODO: fix bogus error in Analyser.analyseCase
595592
case Float:
596593
return v1.toFloat() <= v2.fvalue;
597594
default:
@@ -615,7 +612,6 @@ fn bool Value.is_greater(const Value* v1, const Value* v2) {
615612
return v2.negative && v1.uvalue < v2.uvalue;
616613
else
617614
return v2.negative || v1.uvalue > v2.uvalue;
618-
break; // TODO: fix bogus error in Analyser.analyseCase
619615
case Float:
620616
return v1.toFloat() > v2.fvalue;
621617
default:
@@ -639,7 +635,6 @@ fn bool Value.is_greater_equal(const Value* v1, const Value* v2) {
639635
return v2.negative && v1.uvalue <= v2.uvalue;
640636
else
641637
return v2.negative || v1.uvalue >= v2.uvalue;
642-
break; // TODO: fix bogus error in Analyser.analyseCase
643638
case Float:
644639
return v1.toFloat() >= v2.fvalue;
645640
default:

common/utils.c2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public fn bool findProjectDir(PathInfo* info) {
8888
}
8989
strcat(rel_path, "../");
9090
}
91-
return false; // to satisfy compiler
9291
}
9392

9493
public fn const char* findBuildFile() @(unused) {

generator/ir/ir_generator.c2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ fn ir.Type Generator.type2irtype(Generator* gen, QualType qt) {
234234
default:
235235
return ir.Type.I64;
236236
}
237-
break;
238237
case Enum:
239238
EnumType* et = canon.getEnum();
240239
return gen.type2irtype(et.getImplType());

ir/context.c2

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public type Context struct @(opaque) {
6565
bool single_thread;
6666
bool print_all;
6767

68-
// TODO make full member if include bug is solved in bootstrap
69-
WorkQueue* queue;
68+
WorkQueue queue;
7069
}
7170

7271
public fn Context* create(bool print, const target_info.Info* info) {
@@ -75,8 +74,7 @@ public fn Context* create(bool print, const target_info.Info* info) {
7574
c.constants.init(128);
7675
c.symbols.init(128);
7776
c.init_values.init(128);
78-
//c.queue.init();
79-
c.queue = WorkQueue.create();
77+
c.queue.init();
8078
c.single_thread = true;
8179
c.print_all = print;
8280
//c.single_thread = false;

ir/target.c2

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ module ir_tools; // Note: in ir_tools to allow passing Tools*
1717

1818
import ir;
1919

20-
public type ApplyCallConvFn fn void (Tools* t, ir.FunctionInfo* f);
21-
2220
public type Target struct {
23-
// Need bootstrap update
24-
//fn void (Tools* t, ir.FunctionInfo* f) applyCallingConv;
25-
ApplyCallConvFn applyCallingConv;
21+
fn void (Tools* t, ir.FunctionInfo* f) applyCallingConv;
2622

2723
// layout of registers in one lineair array:
2824
// return reg (s)

ir/work_queue.c2

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,6 @@ type WorkQueue struct {
4343
ir.FunctionInfo** funcs;
4444
}
4545

46-
// TEMP to workaround include bug in bootstrap
47-
#if 1
48-
fn WorkQueue* WorkQueue.create() {
49-
WorkQueue* q = stdlib.malloc(sizeof(WorkQueue));
50-
memset(q, 0, sizeof(WorkQueue));
51-
q.lock.init(nil);
52-
q.resize(64);
53-
return q;
54-
}
55-
56-
fn void WorkQueue.free(WorkQueue* q) {
57-
stdlib.free(q.funcs);
58-
stdlib.free(q);
59-
}
60-
#else
6146
fn WorkQueue* WorkQueue.init(WorkQueue* q) {
6247
memset(q, 0, sizeof(WorkQueue));
6348
q.lock.init(nil);
@@ -68,7 +53,6 @@ fn WorkQueue* WorkQueue.init(WorkQueue* q) {
6853
fn void WorkQueue.free(WorkQueue* q) {
6954
stdlib.free(q.funcs);
7055
}
71-
#endif
7256

7357
fn void WorkQueue.add(WorkQueue* q, ir.FunctionInfo* fi) {
7458
// Adding is done single-threaded, no need to lock

0 commit comments

Comments
 (0)