diff options
author | John Hodge <tpg@ucc.asn.au> | 2018-08-21 20:22:34 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2018-08-21 20:22:34 +0800 |
commit | dd4e3c887fa2eef2db6fa2795d4283636a1cc26e (patch) | |
tree | ee835a853f7cf6b384a6bc306470c9e53a877b43 | |
parent | 74c2ec9d3c7eb09540a2a5de3127390fa8252179 (diff) | |
download | mrust-dd4e3c887fa2eef2db6fa2795d4283636a1cc26e.tar.gz |
Codegen C - Fix literals and omitted variants
-rw-r--r-- | src/trans/codegen_c.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index 836f9b25..ca038230 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -1526,23 +1526,23 @@ namespace { } else { - m_of << " .DATA = { .var_" << var_idx << " = {"; if( this->type_is_bad_zst(repr->fields[var_idx].ty) ) { - m_of << "\n\t\t0"; + m_of << " .DATA = { /* ZST Variant */ }"; } else { + m_of << " .DATA = { .var_" << var_idx << " = {"; for(unsigned int i = 0; i < e.size(); i ++) { if(i != 0) m_of << ","; m_of << "\n\t\t_" << i; } + m_of << "\n\t\t} }"; } - m_of << "\n\t\t}"; } - m_of << " }};\n"; + m_of << " };\n"; m_of << "\treturn rv;\n"; m_of << "}\n"; m_mir_res = nullptr; @@ -5224,7 +5224,7 @@ namespace { } break; TU_ARM(repr->variants, Values, ve) { emit_dst(); emit_enum_path(repr, ve.field); m_of << " = "; - + emit_enum_variant_val(repr, e.idx); if( TU_TEST1((*e.val), List, .empty() == false) ) { |