mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-26 21:04:23 +08:00
8194f4d91a
This is a first cut at adding proto3 support. As far as I understand protobuf-c already has pretty much everything needed once it is built using a new version of protobuf itself. The only missing thing is that in proto3 all fields are optional and having to manually set has_foo is inconvenient. This patch special cases the proto3 syntax files so that structs for the bytes, enum and primitive fields do not emit the has_ field. It also adds PROTOBUF_C_LABEL_NONE to the label enum that is used for proto3 fields. When a fields has this label, the quantifier is not consulted and instead the field is packed/unpacked depending on whether it has a value different from NULL/0.