From b8cd15a84ffdf10d915b5b1a6331722a50a1470c Mon Sep 17 00:00:00 2001 From: Jurriaan Bremer Date: Sat, 18 May 2019 23:47:23 +0200 Subject: [PATCH] protobuf-c: Fix -Wdeclaration-after-statement warning in parse_oneof_member() * allow compilation with -pedantic (thanks @Bun) Can be reproduced with the following command: $ make CFLAGS=-pedantic protobuf-c/protobuf-c.o * put el-size on a separate line --- protobuf-c/protobuf-c.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/protobuf-c/protobuf-c.c b/protobuf-c/protobuf-c.c index c057870..708ee42 100644 --- a/protobuf-c/protobuf-c.c +++ b/protobuf-c/protobuf-c.c @@ -2636,6 +2636,8 @@ parse_oneof_member (ScannedMember *scanned_member, /* If we have already parsed a member of this oneof, free it. */ if (*oneof_case != 0) { + const ProtobufCFieldDescriptor *old_field; + size_t el_size; /* lookup field */ int field_index = int_range_lookup(message->descriptor->n_field_ranges, @@ -2643,9 +2645,8 @@ parse_oneof_member (ScannedMember *scanned_member, *oneof_case); if (field_index < 0) return FALSE; - const ProtobufCFieldDescriptor *old_field = - message->descriptor->fields + field_index; - size_t el_size = sizeof_elt_in_repeated_array(old_field->type); + old_field = message->descriptor->fields + field_index; + el_size = sizeof_elt_in_repeated_array(old_field->type); switch (old_field->type) { case PROTOBUF_C_TYPE_STRING: {