From 42ea2d0d1c3b8cafdfc9a383cbb1bab274eb0140 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 14 Jun 2019 15:20:52 -0400 Subject: fix `@export` for arrays and allow sections on extern variables previously `@export` for an array would panic with a TODO message. now it will do the export. However, it uses the variable's name rather than the name passed to `@export`. Issue #2679 remains open for that problem. --- src/ir.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 21d2646c3e..a1227fbd93 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13901,6 +13901,15 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio want_var_export = true; } break; + case ZigTypeIdArray: + if (!type_allowed_in_extern(ira->codegen, target->value.type->data.array.child_type)) { + ir_add_error(ira, target, + buf_sprintf("array element type '%s' not extern-compatible", + buf_ptr(&target->value.type->data.array.child_type->name))); + } else { + want_var_export = true; + } + break; case ZigTypeIdMetaType: { ZigType *type_value = target->value.data.x_type; switch (type_value->id) { @@ -13968,7 +13977,6 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio case ZigTypeIdInt: case ZigTypeIdFloat: case ZigTypeIdPointer: - case ZigTypeIdArray: case ZigTypeIdComptimeFloat: case ZigTypeIdComptimeInt: case ZigTypeIdUndefined: -- cgit v1.2.3