Commit 1d92700d08

Andrew Kelley <superjoe30@gmail.com>
2016-02-09 16:46:55
fix build with GCC
1 parent e18170e
src/analyze.cpp
@@ -183,6 +183,7 @@ static bool type_is_complete(TypeTableEntry *type_entry) {
         case TypeTableEntryIdTypeDecl:
             return true;
     }
+    zig_unreachable();
 }
 
 TypeTableEntry *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
@@ -1593,6 +1594,7 @@ static bool type_has_codegen_value(TypeTableEntry *type_entry) {
         case TypeTableEntryIdTypeDecl:
             return type_has_codegen_value(type_entry->data.type_decl.canonical_type);
     }
+    zig_unreachable();
 }
 
 static void add_global_const_expr(CodeGen *g, AstNode *expr_node) {
@@ -4671,6 +4673,7 @@ static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import,
         case ReturnKindMaybe:
             zig_panic("TODO");
     }
+    zig_unreachable();
 }
 
 static void validate_voided_expr(CodeGen *g, AstNode *source_node, TypeTableEntry *type_entry) {
@@ -5916,7 +5919,7 @@ bool type_has_bits(TypeTableEntry *type_entry) {
 
 static TypeTableEntry *first_struct_field_type(TypeTableEntry *type_entry) {
     assert(type_entry->id == TypeTableEntryIdStruct);
-    for (int i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
+    for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
         TypeStructField *tsf = &type_entry->data.structure.fields[i];
         if (tsf->gen_index == 0) {
             return tsf->type_entry;
@@ -5956,6 +5959,7 @@ static TypeTableEntry *type_of_first_thing_in_memory(TypeTableEntry *type_entry)
         case TypeTableEntryIdPointer:
             return type_entry;
     }
+    zig_unreachable();
 }
 
 uint64_t get_memcpy_align(CodeGen *g, TypeTableEntry *type_entry) {
src/ast_render.cpp
@@ -39,6 +39,7 @@ static const char *bin_op_str(BinOpType bin_op) {
         case BinOpTypeUnwrapMaybe:         return "??";
         case BinOpTypeStrCat:              return "++";
     }
+    zig_unreachable();
 }
 
 static const char *prefix_op_str(PrefixOp prefix_op) {
@@ -55,6 +56,7 @@ static const char *prefix_op_str(PrefixOp prefix_op) {
         case PrefixOpUnwrapError: return "%%";
         case PrefixOpUnwrapMaybe: return "??";
     }
+    zig_unreachable();
 }
 
 static const char *return_prefix_str(ReturnKind kind) {
@@ -63,6 +65,7 @@ static const char *return_prefix_str(ReturnKind kind) {
         case ReturnKindMaybe: return "?";
         case ReturnKindUnconditional: return "";
     }
+    zig_unreachable();
 }
 
 static const char *visib_mod_string(VisibMod mod) {
@@ -71,6 +74,7 @@ static const char *visib_mod_string(VisibMod mod) {
         case VisibModPrivate: return "";
         case VisibModExport: return "export ";
     }
+    zig_unreachable();
 }
 
 static const char *extern_string(bool is_extern) {
@@ -90,6 +94,7 @@ static const char *container_string(ContainerKind kind) {
         case ContainerKindEnum: return "enum";
         case ContainerKindStruct: return "struct";
     }
+    zig_unreachable();
 }
 
 static const char *node_type_str(NodeType node_type) {
@@ -191,6 +196,7 @@ static const char *node_type_str(NodeType node_type) {
         case NodeTypeTypeLiteral:
             return "TypeLiteral";
     }
+    zig_unreachable();
 }
 
 
src/codegen.cpp
@@ -1733,6 +1733,7 @@ static LLVMValueRef gen_return_expr(CodeGen *g, AstNode *node) {
         case ReturnKindMaybe:
             zig_panic("TODO");
     }
+    zig_unreachable();
 }
 
 static LLVMValueRef gen_defer(CodeGen *g, AstNode *node) {
@@ -2685,7 +2686,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE
         case TypeTableEntryIdStruct:
             {
                 LLVMValueRef *fields = allocate<LLVMValueRef>(type_entry->data.structure.gen_field_count);
-                for (int i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
+                for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
                     TypeStructField *type_struct_field = &type_entry->data.structure.fields[i];
                     if (type_struct_field->gen_index == -1) {
                         continue;
@@ -2701,7 +2702,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE
                 TypeTableEntry *child_type = type_entry->data.array.child_type;
                 uint64_t len = type_entry->data.array.len;
                 LLVMValueRef *values = allocate<LLVMValueRef>(len);
-                for (int i = 0; i < len; i += 1) {
+                for (uint64_t i = 0; i < len; i += 1) {
                     ConstExprValue *field_value = const_val->data.x_array.fields[i];
                     values[i] = gen_const_val(g, child_type, field_value);
                 }
@@ -2793,6 +2794,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, TypeTableEntry *type_entry, ConstE
             zig_unreachable();
 
     }
+    zig_unreachable();
 }
 
 static void gen_const_globals(CodeGen *g) {
@@ -3259,8 +3261,7 @@ static void define_builtin_types(CodeGen *g) {
             uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref);
             uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref);
             entry->di_type = LLVMZigCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name),
-                    debug_size_in_bits, debug_align_in_bits,
-                    is_signed ? LLVMZigEncoding_DW_ATE_signed() : LLVMZigEncoding_DW_ATE_unsigned());
+                    debug_size_in_bits, debug_align_in_bits, dwarf_tag);
             entry->data.integral.is_signed = is_signed;
             entry->data.integral.bit_count = size_in_bits;
             g->primitive_type_table.put(&entry->name, entry);
src/parseh.cpp
@@ -606,6 +606,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const
             emit_warning(c, decl, "missed a '%s' type", ty->getTypeClassName());
             return c->codegen->builtin_types.entry_invalid;
     }
+    zig_unreachable();
 }
 
 static TypeTableEntry *resolve_qual_type_with_table(Context *c, QualType qt, const Decl *decl,