mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-27 13:31:02 +08:00
956ea86712
This commit fixes a problem identified in #251. When generating the PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE directive at the end of the enum values generated for a oneof, we inadvertently only included the protobuf class name in the call to the directive. This breaks if there is more than one oneof per protobuf class, which causes duplicate enum names to be generated. This issue is fixed by also appending the oneof's name to the protobuf class name when generating the PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE directive, which should cause unique enum names to be generated. This changes the enum name that is generated, but these names are implementation details since they are sentinel values that only exist to force the compiler to size the enum type correctly. (The test case for #220 is updated since that test relies on the oneof implementation details in the code generator.)