From 99e9412c021e724970421a19aeb2d464e0feb910 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Fri, 19 May 2017 09:24:59 +0200 Subject: [PATCH] Silence GCC unnamed union warning We need the unnamed struct/union support, this is user-facing API. So, silence the -Wpedantic warning. --- compiler/c++.capnp.h | 8 +++ compiler/capnpc-c.c | 11 +++- compiler/schema.capnp.h | 50 ++++++++------- compiler/test.capnp.c | 132 ++++++++++++++++------------------------ compiler/test.capnp.h | 52 +++++++++------- 5 files changed, 130 insertions(+), 123 deletions(-) diff --git a/compiler/c++.capnp.h b/compiler/c++.capnp.h index afe1b1c..1bdbe0f 100644 --- a/compiler/c++.capnp.h +++ b/compiler/c++.capnp.h @@ -7,6 +7,14 @@ #error "version mismatch between capnp_c.h and generated code" #endif +#ifndef capnp_nowarn +# ifdef __GNUC__ +# define capnp_nowarn __extension__ +# else +# define capnp_nowarn +# endif +#endif + #ifdef __cplusplus extern "C" { diff --git a/compiler/capnpc-c.c b/compiler/capnpc-c.c index b9c81de..53af14c 100644 --- a/compiler/capnpc-c.c +++ b/compiler/capnpc-c.c @@ -758,7 +758,7 @@ static void do_union(struct strings *s, struct node *n, struct field *first_fiel union_cases(s, n, first_field, (1 << Type_data)); union_cases(s, n, first_field, (1 << Type__struct) | (1 << Type__interface) | (1 << Type_anyPointer) | (1 << Type__list)); - str_addf(&s->decl, "%sunion {\n", s->dtab.str); + str_addf(&s->decl, "%scapnp_nowarn union {\n", s->dtab.str); str_add(&s->dtab, "\t", -1); /* when we have defaults or groups we have to emit each case seperately */ @@ -883,7 +883,7 @@ static void define_group(struct strings *s, struct node *n, const char *group_na } if (named_struct) { - str_addf(&s->decl, "%sstruct {\n", s->dtab.str); + str_addf(&s->decl, "%scapnp_nowarn struct {\n", s->dtab.str); str_add(&s->dtab, "\t", 1); } @@ -1289,6 +1289,13 @@ int main() { str_addf(&HDR, "#if CAPN_VERSION != 1\n"); str_addf(&HDR, "#error \"version mismatch between capnp_c.h and generated code\"\n"); str_addf(&HDR, "#endif\n\n"); + str_addf(&HDR, "#ifndef capnp_nowarn\n" + "# ifdef __GNUC__\n" + "# define capnp_nowarn __extension__\n" + "# else\n" + "# define capnp_nowarn\n" + "# endif\n" + "#endif\n\n"); for (j = 0; j < capn_len(file_req.imports); j++) { struct CodeGeneratorRequest_RequestedFile_Import im; diff --git a/compiler/schema.capnp.h b/compiler/schema.capnp.h index f5358ea..665b243 100644 --- a/compiler/schema.capnp.h +++ b/compiler/schema.capnp.h @@ -7,6 +7,14 @@ #error "version mismatch between capnp_c.h and generated code" #endif +#ifndef capnp_nowarn +# ifdef __GNUC__ +# define capnp_nowarn __extension__ +# else +# define capnp_nowarn +# endif +#endif + #include "c++.capnp.h" #include "c.capnp.h" @@ -95,8 +103,8 @@ struct Node { Node_NestedNode_list nestedNodes; Annotation_list annotations; enum Node_which which; - union { - struct { + capnp_nowarn union { + capnp_nowarn struct { uint16_t dataWordCount; uint16_t pointerCount; enum ElementSize preferredListEncoding; @@ -105,18 +113,18 @@ struct Node { uint32_t discriminantOffset; Field_list fields; } _struct; - struct { + capnp_nowarn struct { Enumerant_list enumerants; } _enum; - struct { + capnp_nowarn struct { Method_list methods; Superclass_list superclasses; } _interface; - struct { + capnp_nowarn struct { Type_ptr type; Value_ptr value; } _const; - struct { + capnp_nowarn struct { Type_ptr type; unsigned targetsFile : 1; unsigned targetsConst : 1; @@ -219,19 +227,19 @@ struct Field { Annotation_list annotations; uint16_t discriminantValue; enum Field_which which; - union { - struct { + capnp_nowarn union { + capnp_nowarn struct { uint32_t offset; Type_ptr type; Value_ptr defaultValue; unsigned hadExplicitDefault : 1; } slot; - struct { + capnp_nowarn struct { uint64_t typeId; } group; }; enum Field_ordinal_which ordinal_which; - union { + capnp_nowarn union { uint16_t _explicit; } ordinal; }; @@ -378,29 +386,29 @@ enum Type_which { struct Type { enum Type_which which; - union { - struct { + capnp_nowarn union { + capnp_nowarn struct { Type_ptr elementType; } _list; - struct { + capnp_nowarn struct { uint64_t typeId; Brand_ptr brand; } _enum; - struct { + capnp_nowarn struct { uint64_t typeId; Brand_ptr brand; } _struct; - struct { + capnp_nowarn struct { uint64_t typeId; Brand_ptr brand; } _interface; enum Type_anyPointer_which anyPointer_which; - union { - struct { + capnp_nowarn union { + capnp_nowarn struct { uint64_t scopeId; uint16_t parameterIndex; } parameter; - struct { + capnp_nowarn struct { uint16_t parameterIndex; } implicitMethodParameter; } anyPointer; @@ -434,7 +442,7 @@ enum Brand_Scope_which { struct Brand_Scope { uint64_t scopeId; enum Brand_Scope_which which; - union { + capnp_nowarn union { Brand_Binding_list bind; }; }; @@ -455,7 +463,7 @@ enum Brand_Binding_which { struct Brand_Binding { enum Brand_Binding_which which; - union { + capnp_nowarn union { Type_ptr type; }; }; @@ -489,7 +497,7 @@ enum Value_which { struct Value { enum Value_which which; - union { + capnp_nowarn union { unsigned _bool : 1; int8_t int8; int16_t int16; diff --git a/compiler/test.capnp.c b/compiler/test.capnp.c index 46dce92..d4d98ca 100644 --- a/compiler/test.capnp.c +++ b/compiler/test.capnp.c @@ -2,42 +2,18 @@ /* AUTO GENERATED - DO NOT EDIT */ static const capn_text capn_val0 = {0,"",0}; static const capn_ptr capn_null = {CAPN_NULL}; -static const uint8_t capn_buf[264] = { +static const uint8_t capn_buf[72] = { 102,111,111,0,0,0,0,0, 98,97,114,0,0,0,0,0, - 1,244,128,13,14,16,76,251, - 78,115,232,56,166,51,0,0, - 90,0,210,4,20,136,98,3, - 210,10,111,18,33,25,204,4, - 95,112,9,175,2,0,0,0, - 0,0,0,0,0,144,117,64, - 77,0,0,0,34,0,0,0, - 77,0,0,0,26,0,0,0, - 2,0,0,0,1,0,0,0, - 73,0,0,0,24,0,0,0, - 69,0,0,0,41,0,0,0, - 69,0,0,0,34,0,0,0, - 69,0,0,0,35,0,0,0, - 194,1,0,0,1,0,0,0, - 218,1,0,0,1,0,0,0, - 2,2,0,0,1,0,0,0, - 18,2,0,0,1,0,0,0, - 34,2,0,0,1,0,0,0, - 58,2,0,0,1,0,0,0, - 98,2,0,0,1,0,0,0, - 130,2,0,0,1,0,0,0, - 186,2,0,0,1,0,0,0, - 242,2,0,0,1,0,0,0, - 42,3,0,0,1,0,0,0, - 218,5,0,0,1,0,0,0, - 0,0,0,0,0,0,0,0, - 98,97,122,0,0,0,0,0, - 113,117,120,0,0,0,0,0, - 26,0,0,0,0,0,0,0, - 12,222,128,127,0,0,0,0, - 210,4,210,233,0,128,255,127 + 9,0,0,0,0,0,0,0, + 111,145,0,0,0,0,0,0, + 103,43,153,212,0,0,0,0, + 199,107,159,6,57,148,96,249, + 199,113,196,43,171,117,107,15, + 57,142,59,212,84,138,148,240, + 111,222,0,0,0,0,0,0 }; -static const struct capn_segment capn_seg = {{0},0,0,0,(char*)&capn_buf[0],264,264,0}; +static const struct capn_segment capn_seg = {{0},0,0,0,(char*)&capn_buf[0],72,72,0}; union capn_conv_f32 TestWholeFloatDefault_constant = {0x43e40000u}; union capn_conv_f32 TestWholeFloatDefault_bigConstant = {0x7249f2cau}; unsigned TestConstants_boolConst = 1; @@ -53,29 +29,29 @@ union capn_conv_f32 TestConstants_float32Const = {0x449a5000u}; union capn_conv_f64 TestConstants_float64Const = {((uint64_t) 0xc9b58b82u << 32) | 0xc0e0bb00u}; capn_text TestConstants_textConst = {3,(char*)&capn_buf[0],(struct capn_segment*)&capn_seg}; capn_data TestConstants_dataConst = {{2,0,0,0,1,0,3,(char*)&capn_buf[8],(struct capn_segment*)&capn_seg}}; -TestAllTypes_ptr TestConstants_structConst = {{1,0,0,0,48,20,0,(char*)&capn_buf[16],(struct capn_segment*)&capn_seg}}; +TestAllTypes_ptr TestConstants_structConst = {{1,1,0,0,48,20,0,(char*)&capn_buf[0],(struct capn_segment*)&capn_seg}}; enum TestEnum TestConstants_enumConst = (enum TestEnum) 5u; -capn_ptr TestConstants_voidListConst = {2,0,0,0,0,0,6,(char*)&capn_buf[264],(struct capn_segment*)&capn_seg}; -capn_list1 TestConstants_boolListConst = {{4,1,0,0,1,0,4,(char*)&capn_buf[1512],(struct capn_segment*)&capn_seg}}; -capn_list8 TestConstants_int8ListConst = {{2,1,0,0,1,0,2,(char*)&capn_buf[1528],(struct capn_segment*)&capn_seg}}; -capn_list16 TestConstants_int16ListConst = {{2,1,0,0,2,0,2,(char*)&capn_buf[1544],(struct capn_segment*)&capn_seg}}; -capn_list32 TestConstants_int32ListConst = {{2,1,0,0,4,0,2,(char*)&capn_buf[1560],(struct capn_segment*)&capn_seg}}; -capn_list64 TestConstants_int64ListConst = {{2,1,0,0,8,0,2,(char*)&capn_buf[1576],(struct capn_segment*)&capn_seg}}; -capn_list8 TestConstants_uint8ListConst = {{2,1,0,0,1,0,2,(char*)&capn_buf[1600],(struct capn_segment*)&capn_seg}}; -capn_list16 TestConstants_uint16ListConst = {{2,1,0,0,2,0,2,(char*)&capn_buf[1616],(struct capn_segment*)&capn_seg}}; -capn_list32 TestConstants_uint32ListConst = {{2,1,0,0,4,0,1,(char*)&capn_buf[1632],(struct capn_segment*)&capn_seg}}; -capn_list64 TestConstants_uint64ListConst = {{2,1,0,0,8,0,1,(char*)&capn_buf[1648],(struct capn_segment*)&capn_seg}}; -capn_list32 TestConstants_float32ListConst = {{2,1,0,0,4,0,4,(char*)&capn_buf[1664],(struct capn_segment*)&capn_seg}}; -capn_list64 TestConstants_float64ListConst = {{2,1,0,0,8,0,4,(char*)&capn_buf[1688],(struct capn_segment*)&capn_seg}}; -capn_ptr TestConstants_textListConst = {3,1,0,0,0,0,3,(char*)&capn_buf[1728],(struct capn_segment*)&capn_seg}; -capn_ptr TestConstants_dataListConst = {3,1,0,0,0,0,3,(char*)&capn_buf[1784],(struct capn_segment*)&capn_seg}; -TestAllTypes_list TestConstants_structListConst = {{2,1,0,1,48,20,3,(char*)&capn_buf[1856],(struct capn_segment*)&capn_seg}}; -capn_list16 TestConstants_enumListConst = {{2,1,0,0,2,0,2,(char*)&capn_buf[2536],(struct capn_segment*)&capn_seg}}; +capn_ptr TestConstants_voidListConst = {2,0,0,0,0,0,6,(char*)&capn_buf[16],(struct capn_segment*)&capn_seg}; +capn_list1 TestConstants_boolListConst = {{4,0,0,0,1,0,4,(char*)&capn_buf[16],(struct capn_segment*)&capn_seg}}; +capn_list8 TestConstants_int8ListConst = {{2,0,0,0,1,0,2,(char*)&capn_buf[24],(struct capn_segment*)&capn_seg}}; +capn_list16 TestConstants_int16ListConst = {{2,0,0,0,2,0,2,(char*)&capn_buf[32],(struct capn_segment*)&capn_seg}}; +capn_list32 TestConstants_int32ListConst = {{2,0,0,0,4,0,2,(char*)&capn_buf[40],(struct capn_segment*)&capn_seg}}; +capn_list64 TestConstants_int64ListConst = {{2,0,0,0,8,0,2,(char*)&capn_buf[48],(struct capn_segment*)&capn_seg}}; +capn_list8 TestConstants_uint8ListConst = {{2,0,0,0,1,0,2,(char*)&capn_buf[64],(struct capn_segment*)&capn_seg}}; +capn_list16 TestConstants_uint16ListConst = {{2,1,0,0,2,0,2,(char*)&capn_buf[1664],(struct capn_segment*)&capn_seg}}; +capn_list32 TestConstants_uint32ListConst = {{2,1,0,0,4,0,1,(char*)&capn_buf[1680],(struct capn_segment*)&capn_seg}}; +capn_list64 TestConstants_uint64ListConst = {{2,1,0,0,8,0,1,(char*)&capn_buf[1696],(struct capn_segment*)&capn_seg}}; +capn_list32 TestConstants_float32ListConst = {{2,1,0,0,4,0,4,(char*)&capn_buf[1712],(struct capn_segment*)&capn_seg}}; +capn_list64 TestConstants_float64ListConst = {{2,1,0,0,8,0,4,(char*)&capn_buf[1736],(struct capn_segment*)&capn_seg}}; +capn_ptr TestConstants_textListConst = {3,1,0,0,0,0,3,(char*)&capn_buf[1776],(struct capn_segment*)&capn_seg}; +capn_ptr TestConstants_dataListConst = {3,1,0,0,0,0,3,(char*)&capn_buf[1832],(struct capn_segment*)&capn_seg}; +TestAllTypes_list TestConstants_structListConst = {{2,1,0,1,48,20,3,(char*)&capn_buf[1904],(struct capn_segment*)&capn_seg}}; +capn_list16 TestConstants_enumListConst = {{2,1,0,0,2,0,2,(char*)&capn_buf[2584],(struct capn_segment*)&capn_seg}}; uint32_t globalInt = 12345u; -capn_text globalText = {6,(char*)&capn_buf[2552],(struct capn_segment*)&capn_seg}; -TestAllTypes_ptr globalStruct = {{1,1,0,0,48,20,0,(char*)&capn_buf[2568],(struct capn_segment*)&capn_seg}}; -TestPrintInlineStructs_ptr globalPrintableStruct = {{1,1,0,0,0,2,0,(char*)&capn_buf[2784],(struct capn_segment*)&capn_seg}}; -TestAllTypes_ptr derivedConstant = {{1,1,0,0,48,20,0,(char*)&capn_buf[2816],(struct capn_segment*)&capn_seg}}; +capn_text globalText = {6,(char*)&capn_buf[2600],(struct capn_segment*)&capn_seg}; +TestAllTypes_ptr globalStruct = {{1,1,0,0,48,20,0,(char*)&capn_buf[2616],(struct capn_segment*)&capn_seg}}; +TestPrintInlineStructs_ptr globalPrintableStruct = {{1,1,0,0,0,2,0,(char*)&capn_buf[2832],(struct capn_segment*)&capn_seg}}; +TestAllTypes_ptr derivedConstant = {{1,1,0,0,48,20,0,(char*)&capn_buf[2864],(struct capn_segment*)&capn_seg}}; TestAllTypes_ptr new_TestAllTypes(struct capn_segment *s) { TestAllTypes_ptr p; @@ -551,25 +527,25 @@ void TestAllTypes_set_interfaceList(TestAllTypes_ptr p, capn_ptr interfaceList) { capn_setp(p.p, 19, interfaceList); } -static capn_text capn_val1 = {3,(char*)&capn_buf[1408],(struct capn_segment*)&capn_seg}; -static capn_data capn_val2 = {{2,1,0,0,1,0,3,(char*)&capn_buf[1424],(struct capn_segment*)&capn_seg}}; -static TestAllTypes_ptr capn_val3 = {{1,1,0,0,48,20,0,(char*)&capn_buf[1440],(struct capn_segment*)&capn_seg}}; -static capn_ptr capn_val4 = {2,0,0,0,0,0,6,(char*)&capn_buf[264],(struct capn_segment*)&capn_seg}; -static capn_list1 capn_val5 = {{4,1,0,0,1,0,4,(char*)&capn_buf[3104],(struct capn_segment*)&capn_seg}}; -static capn_list8 capn_val6 = {{2,1,0,0,1,0,2,(char*)&capn_buf[3120],(struct capn_segment*)&capn_seg}}; -static capn_list16 capn_val7 = {{2,1,0,0,2,0,2,(char*)&capn_buf[3136],(struct capn_segment*)&capn_seg}}; -static capn_list32 capn_val8 = {{2,1,0,0,4,0,2,(char*)&capn_buf[3152],(struct capn_segment*)&capn_seg}}; -static capn_list64 capn_val9 = {{2,1,0,0,8,0,2,(char*)&capn_buf[3168],(struct capn_segment*)&capn_seg}}; -static capn_list8 capn_val10 = {{2,1,0,0,1,0,2,(char*)&capn_buf[3192],(struct capn_segment*)&capn_seg}}; -static capn_list16 capn_val11 = {{2,1,0,0,2,0,2,(char*)&capn_buf[3208],(struct capn_segment*)&capn_seg}}; -static capn_list32 capn_val12 = {{2,1,0,0,4,0,1,(char*)&capn_buf[3224],(struct capn_segment*)&capn_seg}}; -static capn_list64 capn_val13 = {{2,1,0,0,8,0,1,(char*)&capn_buf[3240],(struct capn_segment*)&capn_seg}}; -static capn_list32 capn_val14 = {{2,1,0,0,4,0,4,(char*)&capn_buf[3256],(struct capn_segment*)&capn_seg}}; -static capn_list64 capn_val15 = {{2,1,0,0,8,0,4,(char*)&capn_buf[3280],(struct capn_segment*)&capn_seg}}; -static capn_ptr capn_val16 = {3,1,0,0,0,0,3,(char*)&capn_buf[3320],(struct capn_segment*)&capn_seg}; -static capn_ptr capn_val17 = {3,1,0,0,0,0,3,(char*)&capn_buf[3376],(struct capn_segment*)&capn_seg}; +static capn_text capn_val1 = {3,(char*)&capn_buf[1464],(struct capn_segment*)&capn_seg}; +static capn_data capn_val2 = {{2,1,0,0,1,0,3,(char*)&capn_buf[1480],(struct capn_segment*)&capn_seg}}; +static TestAllTypes_ptr capn_val3 = {{1,1,0,0,48,20,0,(char*)&capn_buf[1496],(struct capn_segment*)&capn_seg}}; +static capn_ptr capn_val4 = {2,0,0,0,0,0,6,(char*)&capn_buf[72],(struct capn_segment*)&capn_seg}; +static capn_list1 capn_val5 = {{4,1,0,0,1,0,4,(char*)&capn_buf[3160],(struct capn_segment*)&capn_seg}}; +static capn_list8 capn_val6 = {{2,1,0,0,1,0,2,(char*)&capn_buf[3176],(struct capn_segment*)&capn_seg}}; +static capn_list16 capn_val7 = {{2,1,0,0,2,0,2,(char*)&capn_buf[3192],(struct capn_segment*)&capn_seg}}; +static capn_list32 capn_val8 = {{2,1,0,0,4,0,2,(char*)&capn_buf[3208],(struct capn_segment*)&capn_seg}}; +static capn_list64 capn_val9 = {{2,1,0,0,8,0,2,(char*)&capn_buf[3224],(struct capn_segment*)&capn_seg}}; +static capn_list8 capn_val10 = {{2,1,0,0,1,0,2,(char*)&capn_buf[3248],(struct capn_segment*)&capn_seg}}; +static capn_list16 capn_val11 = {{2,1,0,0,2,0,2,(char*)&capn_buf[3264],(struct capn_segment*)&capn_seg}}; +static capn_list32 capn_val12 = {{2,1,0,0,4,0,1,(char*)&capn_buf[3280],(struct capn_segment*)&capn_seg}}; +static capn_list64 capn_val13 = {{2,1,0,0,8,0,1,(char*)&capn_buf[3296],(struct capn_segment*)&capn_seg}}; +static capn_list32 capn_val14 = {{2,1,0,0,4,0,4,(char*)&capn_buf[3312],(struct capn_segment*)&capn_seg}}; +static capn_list64 capn_val15 = {{2,1,0,0,8,0,4,(char*)&capn_buf[3336],(struct capn_segment*)&capn_seg}}; +static capn_ptr capn_val16 = {3,1,0,0,0,0,3,(char*)&capn_buf[3376],(struct capn_segment*)&capn_seg}; +static capn_ptr capn_val17 = {3,1,0,0,0,0,3,(char*)&capn_buf[3432],(struct capn_segment*)&capn_seg}; static TestAllTypes_list capn_val18 = {{2,1,0,1,48,20,3,(char*)&capn_buf[8],(struct capn_segment*)&capn_seg}}; -static capn_list16 capn_val19 = {{2,1,0,0,2,0,2,(char*)&capn_buf[3440],(struct capn_segment*)&capn_seg}}; +static capn_list16 capn_val19 = {{2,1,0,0,2,0,2,(char*)&capn_buf[3496],(struct capn_segment*)&capn_seg}}; TestDefaults_ptr new_TestDefaults(struct capn_segment *s) { TestDefaults_ptr p; @@ -2000,10 +1976,10 @@ void set_TestInterleavedGroups(const struct TestInterleavedGroups *s, TestInterl p.p = capn_getp(l.p, i, 0); write_TestInterleavedGroups(s, p); } -static TestUnion_ptr capn_val20 = {{1,1,0,0,64,2,0,(char*)&capn_buf[3456],(struct capn_segment*)&capn_seg}}; -static TestUnion_ptr capn_val21 = {{1,1,0,0,64,2,0,(char*)&capn_buf[3544],(struct capn_segment*)&capn_seg}}; -static TestUnnamedUnion_ptr capn_val22 = {{1,1,0,0,16,2,0,(char*)&capn_buf[3640],(struct capn_segment*)&capn_seg}}; -static TestUnnamedUnion_ptr capn_val23 = {{1,1,0,0,16,2,0,(char*)&capn_buf[3680],(struct capn_segment*)&capn_seg}}; +static TestUnion_ptr capn_val20 = {{1,1,0,0,64,2,0,(char*)&capn_buf[3512],(struct capn_segment*)&capn_seg}}; +static TestUnion_ptr capn_val21 = {{1,1,0,0,64,2,0,(char*)&capn_buf[3600],(struct capn_segment*)&capn_seg}}; +static TestUnnamedUnion_ptr capn_val22 = {{1,1,0,0,16,2,0,(char*)&capn_buf[3696],(struct capn_segment*)&capn_seg}}; +static TestUnnamedUnion_ptr capn_val23 = {{1,1,0,0,16,2,0,(char*)&capn_buf[3736],(struct capn_segment*)&capn_seg}}; TestUnionDefaults_ptr new_TestUnionDefaults(struct capn_segment *s) { TestUnionDefaults_ptr p; @@ -3170,7 +3146,7 @@ void TestFieldZeroIsBit_set_thirdField(TestFieldZeroIsBit_ptr p, uint8_t thirdFi { capn_write8(p.p, 1, thirdField ^ 123u); } -static TestLists_ptr capn_val24 = {{1,1,0,0,0,10,0,(char*)&capn_buf[3736],(struct capn_segment*)&capn_seg}}; +static TestLists_ptr capn_val24 = {{1,1,0,0,0,10,0,(char*)&capn_buf[3792],(struct capn_segment*)&capn_seg}}; TestListDefaults_ptr new_TestListDefaults(struct capn_segment *s) { TestListDefaults_ptr p; @@ -3412,7 +3388,7 @@ void TestOldVersion_set_old3(TestOldVersion_ptr p, TestOldVersion_ptr old3) { capn_setp(p.p, 1, old3.p); } -static capn_text capn_val25 = {3,(char*)&capn_buf[1480],(struct capn_segment*)&capn_seg}; +static capn_text capn_val25 = {3,(char*)&capn_buf[1544],(struct capn_segment*)&capn_seg}; TestNewVersion_ptr new_TestNewVersion(struct capn_segment *s) { TestNewVersion_ptr p; diff --git a/compiler/test.capnp.h b/compiler/test.capnp.h index 28a6bd1..949913f 100644 --- a/compiler/test.capnp.h +++ b/compiler/test.capnp.h @@ -7,6 +7,14 @@ #error "version mismatch between capnp_c.h and generated code" #endif +#ifndef capnp_nowarn +# ifdef __GNUC__ +# define capnp_nowarn __extension__ +# else +# define capnp_nowarn +# endif +#endif + #include "c++.capnp.h" #include "c.capnp.h" @@ -705,7 +713,7 @@ enum TestUnion_union3_which { struct TestUnion { enum TestUnion_union0_which union0_which; - union { + capnp_nowarn union { unsigned u0f0s1 : 1; int8_t u0f0s8; int16_t u0f0s16; @@ -721,7 +729,7 @@ struct TestUnion { } union0; unsigned bit0 : 1; enum TestUnion_union1_which union1_which; - union { + capnp_nowarn union { unsigned u1f0s1 : 1; unsigned u1f1s1 : 1; int8_t u1f0s8; @@ -748,7 +756,7 @@ struct TestUnion { unsigned bit6 : 1; unsigned bit7 : 1; enum TestUnion_union2_which union2_which; - union { + capnp_nowarn union { int64_t u2f0s64; int32_t u2f0s32; int16_t u2f0s16; @@ -756,7 +764,7 @@ struct TestUnion { unsigned u2f0s1 : 1; } union2; enum TestUnion_union3_which union3_which; - union { + capnp_nowarn union { int64_t u3f0s64; int32_t u3f0s32; int16_t u3f0s16; @@ -811,7 +819,7 @@ enum TestUnnamedUnion_which { struct TestUnnamedUnion { capn_text before; enum TestUnnamedUnion_which which; - union { + capnp_nowarn union { uint16_t foo; uint32_t bar; }; @@ -839,9 +847,9 @@ enum TestUnionInUnion_outer_which { struct TestUnionInUnion { enum TestUnionInUnion_outer_which outer_which; - union { + capnp_nowarn union { enum TestUnionInUnion_outer_inner_which inner_which; - union { + capnp_nowarn union { int32_t foo; int32_t bar; } inner; @@ -862,18 +870,18 @@ enum TestGroups_groups_which { struct TestGroups { enum TestGroups_groups_which groups_which; - union { - struct { + capnp_nowarn union { + capnp_nowarn struct { int32_t corge; int64_t grault; capn_text garply; } foo; - struct { + capnp_nowarn struct { int32_t corge; capn_text grault; int64_t garply; } bar; - struct { + capnp_nowarn struct { int32_t corge; capn_text grault; capn_text garply; @@ -898,13 +906,13 @@ enum TestInterleavedGroups_group2_which { }; struct TestInterleavedGroups { - struct { + capnp_nowarn struct { uint32_t foo; uint64_t bar; enum TestInterleavedGroups_group1_which which; - union { + capnp_nowarn union { uint16_t qux; - struct { + capnp_nowarn struct { uint64_t grault; uint16_t garply; capn_text plugh; @@ -914,13 +922,13 @@ struct TestInterleavedGroups { }; capn_text waldo; } group1; - struct { + capnp_nowarn struct { uint32_t foo; uint64_t bar; enum TestInterleavedGroups_group2_which which; - union { + capnp_nowarn union { uint16_t qux; - struct { + capnp_nowarn struct { uint64_t grault; uint16_t garply; capn_text plugh; @@ -1362,13 +1370,13 @@ struct TestLateUnion { capn_text bar; int16_t baz; enum TestLateUnion_theUnion_which theUnion_which; - union { + capnp_nowarn union { capn_text qux; capn_list32 corge; float grault; } theUnion; enum TestLateUnion_anotherUnion_which anotherUnion_which; - union { + capnp_nowarn union { capn_text qux; capn_list32 corge; float grault; @@ -1457,7 +1465,7 @@ enum TestStructUnion_un_which { struct TestStructUnion { enum TestStructUnion_un_which un_which; - union { + capnp_nowarn union { TestStructUnion_SomeStruct_ptr _struct; TestAnyPointer_ptr object; } un; @@ -1656,13 +1664,13 @@ enum TestNameAnnotation_badlyNamedUnion_which { struct TestNameAnnotation { enum TestNameAnnotation_which which; - union { + capnp_nowarn union { unsigned badFieldName : 1; int8_t bar; }; enum TestNameAnnotation_BadlyNamedEnum anotherBadFieldName; enum TestNameAnnotation_badlyNamedUnion_which badlyNamedUnion_which; - union { + capnp_nowarn union { /* struct { -empty- } badlyNamedGroup; */ TestNameAnnotation_NestedStruct_ptr baz; } badlyNamedUnion;