Silence empty struct warning

Last but not least, -Wpedantic warns about empty structs.  With this,
-Wpedantic build is now clean of warnings on gcc 5.4.0 and clang 4.0.
This commit is contained in:
David Lamparter 2017-05-19 09:44:09 +02:00
parent b0810da2c3
commit aa1f31d401
2 changed files with 10 additions and 8 deletions

View file

@ -960,7 +960,9 @@ static void define_struct(struct node *n) {
str_add(&HDR, s.enums.str, s.enums.len);
str_addf(&HDR, "\nstruct %s {\n", n->name.str);
str_addf(&HDR, "\n%sstruct %s {\n",
s.decl.len == 0 ? "capnp_nowarn " : "",
n->name.str);
str_add(&HDR, s.decl.str, s.decl.len);
str_addf(&HDR, "};\n");

View file

@ -1096,7 +1096,7 @@ void TestLists_set_textListList(TestLists_ptr p, capn_ptr textListList);
void TestLists_set_structListList(TestLists_ptr p, capn_ptr structListList);
struct TestLists_Struct0 {
capnp_nowarn struct TestLists_Struct0 {
};
static const size_t TestLists_Struct0_word_count = 0;
@ -1553,7 +1553,7 @@ void TestWholeFloatDefault_set_field(TestWholeFloatDefault_ptr p, float field);
void TestWholeFloatDefault_set_bigField(TestWholeFloatDefault_ptr p, float bigField);
struct TestEmptyStruct {
capnp_nowarn struct TestEmptyStruct {
};
static const size_t TestEmptyStruct_word_count = 0;
@ -1562,7 +1562,7 @@ static const size_t TestEmptyStruct_pointer_count = 0;
static const size_t TestEmptyStruct_struct_bytes_count = 0;
struct TestConstants {
capnp_nowarn struct TestConstants {
};
static const size_t TestConstants_word_count = 0;
@ -1618,7 +1618,7 @@ enum TestSturdyRefObjectId_Tag TestSturdyRefObjectId_get_tag(TestSturdyRefObject
void TestSturdyRefObjectId_set_tag(TestSturdyRefObjectId_ptr p, enum TestSturdyRefObjectId_Tag tag);
struct TestProvisionId {
capnp_nowarn struct TestProvisionId {
};
static const size_t TestProvisionId_word_count = 0;
@ -1627,7 +1627,7 @@ static const size_t TestProvisionId_pointer_count = 0;
static const size_t TestProvisionId_struct_bytes_count = 0;
struct TestRecipientId {
capnp_nowarn struct TestRecipientId {
};
static const size_t TestRecipientId_word_count = 0;
@ -1636,7 +1636,7 @@ static const size_t TestRecipientId_pointer_count = 0;
static const size_t TestRecipientId_struct_bytes_count = 0;
struct TestThirdPartyCapId {
capnp_nowarn struct TestThirdPartyCapId {
};
static const size_t TestThirdPartyCapId_word_count = 0;
@ -1645,7 +1645,7 @@ static const size_t TestThirdPartyCapId_pointer_count = 0;
static const size_t TestThirdPartyCapId_struct_bytes_count = 0;
struct TestJoinResult {
capnp_nowarn struct TestJoinResult {
};
static const size_t TestJoinResult_word_count = 0;