authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-02-09 08:46:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-02-09 08:46:55-07:00
log1d92700d089eb2e225d1db6de780e4288fa68452
tree643871fe14f6391b2989750cd0b9e5a6d1dc3634
parente18170ee0bf32996635397e8e919a14a21c88b56

fix build with GCC


4 files changed, 17 insertions(+), 5 deletions(-)

src/analyze.cpp+5-1
...@@ -183,6 +183,7 @@ static bool type_is_complete(TypeTableEntry *type_entry) {...@@ -183,6 +183,7 @@ static bool type_is_complete(TypeTableEntry *type_entry) {
183 case TypeTableEntryIdTypeDecl:183 case TypeTableEntryIdTypeDecl:
184 return true;184 return true;
185 }185 }
186 zig_unreachable();
186}187}
187188
188TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {189TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
...@@ -1593,6 +1594,7 @@ static bool type_has_codegen_value(TypeTableEntry *type_entry) {...@@ -1593,6 +1594,7 @@ static bool type_has_codegen_value(TypeTableEntry *type_entry) {
1593 case TypeTableEntryIdTypeDecl:1594 case TypeTableEntryIdTypeDecl:
1594 return type_has_codegen_value(type_entry->data.type_decl.canonical_type);1595 return type_has_codegen_value(type_entry->data.type_decl.canonical_type);
1595 }1596 }
1597 zig_unreachable();
1596}1598}
15971599
1598static void add_global_const_expr(CodeGen *g, AstNode *expr_node) {1600static void add_global_const_expr(CodeGen *g, AstNode *expr_node) {
...@@ -4671,6 +4673,7 @@ static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import,...@@ -4671,6 +4673,7 @@ static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import,
4671 case ReturnKindMaybe:4673 case ReturnKindMaybe:
4672 zig_panic("TODO");4674 zig_panic("TODO");
4673 }4675 }
4676 zig_unreachable();
4674}4677}
46754678
4676static void validate_voided_expr(CodeGen *g, AstNode *source_node, TypeTableEntry *type_entry) {4679static void validate_voided_expr(CodeGen *g, AstNode *source_node, TypeTableEntry *type_entry) {
...@@ -5916,7 +5919,7 @@ bool type_has_bits(TypeTableEntry *type_entry) {...@@ -5916,7 +5919,7 @@ bool type_has_bits(TypeTableEntry *type_entry) {
59165919
5917static TypeTableEntry *first_struct_field_type(TypeTableEntry *type_entry) {5920static TypeTableEntry *first_struct_field_type(TypeTableEntry *type_entry) {
5918 assert(type_entry->id == TypeTableEntryIdStruct);5921 assert(type_entry->id == TypeTableEntryIdStruct);
5919 for (int i = 0; i < type_entry->data.structure.src_field_count; i += 1) {5922 for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
5920 TypeStructField *tsf = &type_entry->data.structure.fields[i];5923 TypeStructField *tsf = &type_entry->data.structure.fields[i];
5921 if (tsf->gen_index == 0) {5924 if (tsf->gen_index == 0) {
5922 return tsf->type_entry;5925 return tsf->type_entry;
...@@ -5956,6 +5959,7 @@ static TypeTableEntry *type_of_first_thing_in_memory(TypeTableEntry *type_entry)...@@ -5956,6 +5959,7 @@ static TypeTableEntry *type_of_first_thing_in_memory(TypeTableEntry *type_entry)
5956 case TypeTableEntryIdPointer:5959 case TypeTableEntryIdPointer:
5957 return type_entry;5960 return type_entry;
5958 }5961 }
5962 zig_unreachable();
5959}5963}
59605964
5961uint64_t get_memcpy_align(CodeGen *g, TypeTableEntry *type_entry) {5965uint64_t get_memcpy_align(CodeGen *g, TypeTableEntry *type_entry) {
src/ast_render.cpp+6
...@@ -39,6 +39,7 @@ static const char *bin_op_str(BinOpType bin_op) {...@@ -39,6 +39,7 @@ static const char *bin_op_str(BinOpType bin_op) {
39 case BinOpTypeUnwrapMaybe: return "??";39 case BinOpTypeUnwrapMaybe: return "??";
40 case BinOpTypeStrCat: return "++";40 case BinOpTypeStrCat: return "++";
41 }41 }
42 zig_unreachable();
42}43}
4344
44static const char *prefix_op_str(PrefixOp prefix_op) {45static const char *prefix_op_str(PrefixOp prefix_op) {
...@@ -55,6 +56,7 @@ static const char *prefix_op_str(PrefixOp prefix_op) {...@@ -55,6 +56,7 @@ static const char *prefix_op_str(PrefixOp prefix_op) {
55 case PrefixOpUnwrapError: return "%%";56 case PrefixOpUnwrapError: return "%%";
56 case PrefixOpUnwrapMaybe: return "??";57 case PrefixOpUnwrapMaybe: return "??";
57 }58 }
59 zig_unreachable();
58}60}
5961
60static const char *return_prefix_str(ReturnKind kind) {62static const char *return_prefix_str(ReturnKind kind) {
...@@ -63,6 +65,7 @@ static const char *return_prefix_str(ReturnKind kind) {...@@ -63,6 +65,7 @@ static const char *return_prefix_str(ReturnKind kind) {
63 case ReturnKindMaybe: return "?";65 case ReturnKindMaybe: return "?";
64 case ReturnKindUnconditional: return "";66 case ReturnKindUnconditional: return "";
65 }67 }
68 zig_unreachable();
66}69}
6770
68static const char *visib_mod_string(VisibMod mod) {71static const char *visib_mod_string(VisibMod mod) {
...@@ -71,6 +74,7 @@ static const char *visib_mod_string(VisibMod mod) {...@@ -71,6 +74,7 @@ static const char *visib_mod_string(VisibMod mod) {
71 case VisibModPrivate: return "";74 case VisibModPrivate: return "";
72 case VisibModExport: return "export ";75 case VisibModExport: return "export ";
73 }76 }
77 zig_unreachable();
74}78}
7579
76static const char *extern_string(bool is_extern) {80static const char *extern_string(bool is_extern) {
...@@ -90,6 +94,7 @@ static const char *container_string(ContainerKind kind) {...@@ -90,6 +94,7 @@ static const char *container_string(ContainerKind kind) {
90 case ContainerKindEnum: return "enum";94 case ContainerKindEnum: return "enum";
91 case ContainerKindStruct: return "struct";95 case ContainerKindStruct: return "struct";
92 }96 }
97 zig_unreachable();
93}98}
9499
95static const char *node_type_str(NodeType node_type) {100static const char *node_type_str(NodeType node_type) {
...@@ -191,6 +196,7 @@ static const char *node_type_str(NodeType node_type) {...@@ -191,6 +196,7 @@ static const char *node_type_str(NodeType node_type) {
191 case NodeTypeTypeLiteral:196 case NodeTypeTypeLiteral:
192 return "TypeLiteral";197 return "TypeLiteral";
193 }198 }
199 zig_unreachable();
194}200}
195201
196202
src/codegen.cpp+5-4
...@@ -1733,6 +1733,7 @@ static LLVMValueRef gen_return_expr(CodeGen *g, AstNode *node) {...@@ -1733,6 +1733,7 @@ static LLVMValueRef gen_return_expr(CodeGen *g, AstNode *node) {
1733 case ReturnKindMaybe:1733 case ReturnKindMaybe:
1734 zig_panic("TODO");1734 zig_panic("TODO");
1735 }1735 }
1736 zig_unreachable();
1736}1737}
17371738
1738static LLVMValueRef gen_defer(CodeGen *g, AstNode *node) {1739static LLVMValueRef gen_defer(CodeGen *g, AstNode *node) {
...@@ -2685,7 +2686,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE...@@ -2685,7 +2686,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE
2685 case TypeTableEntryIdStruct:2686 case TypeTableEntryIdStruct:
2686 {2687 {
2687 LLVMValueRef *fields = allocate<LLVMValueRef>(type_entry->data.structure.gen_field_count);2688 LLVMValueRef *fields = allocate<LLVMValueRef>(type_entry->data.structure.gen_field_count);
2688 for (int i = 0; i < type_entry->data.structure.src_field_count; i += 1) {2689 for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
2689 TypeStructField *type_struct_field = &type_entry->data.structure.fields[i];2690 TypeStructField *type_struct_field = &type_entry->data.structure.fields[i];
2690 if (type_struct_field->gen_index == -1) {2691 if (type_struct_field->gen_index == -1) {
2691 continue;2692 continue;
...@@ -2701,7 +2702,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE...@@ -2701,7 +2702,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE
2701 TypeTableEntry *child_type = type_entry->data.array.child_type;2702 TypeTableEntry *child_type = type_entry->data.array.child_type;
2702 uint64_t len = type_entry->data.array.len;2703 uint64_t len = type_entry->data.array.len;
2703 LLVMValueRef *values = allocate<LLVMValueRef>(len);2704 LLVMValueRef *values = allocate<LLVMValueRef>(len);
2704 for (int i = 0; i < len; i += 1) {2705 for (uint64_t i = 0; i < len; i += 1) {
2705 ConstExprValue *field_value = const_val->data.x_array.fields[i];2706 ConstExprValue *field_value = const_val->data.x_array.fields[i];
2706 values[i] = gen_const_val(g, child_type, field_value);2707 values[i] = gen_const_val(g, child_type, field_value);
2707 }2708 }
...@@ -2793,6 +2794,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE...@@ -2793,6 +2794,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE
2793 zig_unreachable();2794 zig_unreachable();
27942795
2795 }2796 }
2797 zig_unreachable();
2796}2798}
27972799
2798static void gen_const_globals(CodeGen *g) {2800static void gen_const_globals(CodeGen *g) {
...@@ -3259,8 +3261,7 @@ static void define_builtin_types(CodeGen *g) {...@@ -3259,8 +3261,7 @@ static void define_builtin_types(CodeGen *g) {
3259 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref);3261 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref);
3260 uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref);3262 uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref);
3261 entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name),3263 entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name),
3262 debug_size_in_bits, debug_align_in_bits,3264 debug_size_in_bits, debug_align_in_bits, dwarf_tag);
3263 is_signed ? LLVMZigEncoding_DW_ATE_signed() : LLVMZigEncoding_DW_ATE_unsigned());
3264 entry->data.integral.is_signed = is_signed;3265 entry->data.integral.is_signed = is_signed;
3265 entry->data.integral.bit_count = size_in_bits;3266 entry->data.integral.bit_count = size_in_bits;
3266 g->primitive_type_table.put(&entry->name, entry);3267 g->primitive_type_table.put(&entry->name, entry);
src/parseh.cpp+1
...@@ -606,6 +606,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const...@@ -606,6 +606,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const
606 emit_warning(c, decl, "missed a '%s' type", ty->getTypeClassName());606 emit_warning(c, decl, "missed a '%s' type", ty->getTypeClassName());
607 return c->codegen->builtin_types.entry_invalid;607 return c->codegen->builtin_types.entry_invalid;
608 }608 }
609 zig_unreachable();
609}610}
610611
611static TypeTableEntry *resolve_qual_type_with_table(Context *c, QualType qt, const Decl *decl,612static TypeTableEntry *resolve_qual_type_with_table(Context *c, QualType qt, const Decl *decl,