Skip to content

generated code broken for Data type with empty string as default #23

@assaf758

Description

@assaf758

The generated .c file for the below capnp does not compile due to undeclared capn_buf:

$ cat Test.capnp.c                 
#include "Test.capnp.h"            
/* AUTO GENERATED - DO NOT EDIT */ 
#ifdef __GNUC__                    
# define capnp_unused __attribute__((unused))                                                                                                 
# define capnp_use(x) (void) x;    
#else                              
# define capnp_unused              
# define capnp_use(x)              
#endif                             
                                                                       
static const capn_ptr capn_null = {CAPN_NULL};                         
static capn_data capn_val1 = {{2,0,0,0,1,0,0,(char*)&capn_buf[0],(struct capn_segment*)&capn_seg}};                                           
...

File Test.capnp:

@0xa4ba9dce9642ee58;

struct Record {
   info     @0: Data = "";
}

struct RootStruct {
   myList   @0: List(Record);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions