Main code is now compiled (for tests) with -pedantic -Wextra.
The test programs are not as strictly bound, but this should
improve the chances that atleast the core library compiles with
most compilers without warnings.
bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
{
- uint8_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 7) / 8] = {}; /* Used to check for required fields */
+ uint8_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 7) / 8] = {0}; /* Used to check for required fields */
pb_field_iterator_t iter;
pb_message_set_to_defaults(fields, dest_struct);
}
else
{
- pb_ostream_t sizestream = {0};
+ pb_ostream_t sizestream = {0,0,0,0};
p = pData;
for (i = 0; i < count; i++)
{
bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct)
{
/* First calculate the message size using a non-writing substream. */
- pb_ostream_t substream = {0};
+ pb_ostream_t substream = {0,0,0,0};
size_t size;
bool status;
DEPS=../pb_decode.h ../pb_encode.h ../pb.h person.pb.h callbacks.pb.h unittests.h unittestproto.pb.h alltypes.pb.h missing_fields.pb.h
TESTS=test_decode1 test_encode1 decode_unittests encode_unittests test_no_messages
+# More strict checks for the core part of nanopb
+CFLAGS_CORE=-pedantic -Wextra
+
all: breakpoints $(TESTS) run_unittests
clean:
$(CC) $(CFLAGS) -c -o $@ $<
pb_encode.o: ../pb_encode.c $(DEPS)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
pb_decode.o: ../pb_decode.c $(DEPS)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
test_decode1: test_decode1.o pb_decode.o person.pb.o
test_decode2: test_decode2.o pb_decode.o person.pb.o