mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-26 21:04:23 +08:00
c4a0e69337
protobuf 2.5.0 started warning that we would need to enable the 'allow_alias' option on this enum due to the duplicate enum values, and protobuf 2.6.0 turned this into an error. Turn this option on, now that protobuf 2.5.0 is more common (e.g., it's now in Ubuntu 14.04 LTS). This will break with older protobuf versions, so we now require >= 2.5.0. We should now see diagnostics like these disappear from the build log: [libprotobuf ERROR google/protobuf/descriptor.cc:4153] "foo.VALUE_B" uses the same enum value as "foo.VALUE_A". If this is intended, set 'option allow_alias = true;' to the enum definition. Based on a patch from Ilya Lipnitskiy.
There are two tests. "test-generated-code" is a simple test that can easily be adapted. "test-generated-code2" is a comprehensive test. -- If you have a quick problem, hack at "test-generated-code"; but i don't want that file to be too hard to navigate, so you must eventually add a test to "test-generated-code2". I appreciate additional test cases! Please submit them as issues in the tracking system, or email me. -- Here are the files involved in each test: test.proto Protobuf declarations for the simple test. test.pb-c.c Protobuf-C generated code based on test.proto test.pb-c.h Protobuf-C generated code based on test.proto test-full.proto Protobuf declarations for the exhaustive test. test-full.pb-c.c Protobuf-C generated code based on test-full.proto test-full.pb-c.h Protobuf-C generated code based on test-full.proto test-full.pb.cc Protobuf (C++) generated code based on test-full.proto test-full.pb.h Protobuf (C++) generated code based on test-full.proto generated-code/ test-generated-code.c Actual test code. test-generated-code Test executable. generated-code2/ cxx-generate-packed-data.cc C++ code to generated data to compare with C. cxx-generate-packed-data Program whichs generates data (using C++ api) test-full-cxx-output.inc Output of cxx-generate-packed-data. test-generated-code2.c Actual test code. test-generated-code2 Test executable.