Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleExpansion.cc

    rd5556a3 r4c8621ac  
    144144
    145145        Expression * MemberTupleExpander::mutate( UntypedMemberExpr * memberExpr ) {
    146                 if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * > ( memberExpr->get_member() ) ) {
     146                if ( UntypedTupleExpr * tupleExpr = dynamic_cast< UntypedTupleExpr * > ( memberExpr->get_member() ) ) {
    147147                        Expression * aggr = memberExpr->get_aggregate()->clone()->acceptMutator( *this );
    148148                        // aggregate expressions which might be impure must be wrapped in unique expressions
     
    225225                                decl->get_parameters().push_back( tyParam );
    226226                        }
     227                        if ( tupleType->size() == 0 ) {
     228                                // empty structs are not standard C. Add a dummy field to empty tuples to silence warnings when a compound literal Tuple0 is created.
     229                                decl->get_members().push_back( new ObjectDecl( "dummy", DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
     230                        }
    227231                        typeMap[mangleName] = decl;
    228232                        addDeclaration( decl );
     
    315319                        qualifiers &= type->get_qualifiers();
    316320                } // for
     321                if ( exprs.empty() ) qualifiers = Type::Qualifiers();
    317322                return tupleType;
     323        }
     324
     325        TypeInstType * isTtype( Type * type ) {
     326                if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( type ) ) {
     327                        if ( inst->get_baseType()->get_kind() == TypeDecl::Ttype ) {
     328                                return inst;
     329                        }
     330                }
     331                return nullptr;
    318332        }
    319333
Note: See TracChangeset for help on using the changeset viewer.