diff --git a/protobuf-c/protobuf-c.h b/protobuf-c/protobuf-c.h index 18f18c0..437dab4 100644 --- a/protobuf-c/protobuf-c.h +++ b/protobuf-c/protobuf-c.h @@ -250,7 +250,10 @@ struct _ProtobufCFieldDescriptor { typedef enum { /* Set if the field is repeated and marked with the 'packed' option. */ PROTOBUF_C_FIELD_FLAG_PACKED = (1 << 0), -} ProtobufCFieldFlag; + + /* Set if the field is marked with the 'deprecated' option. */ + PROTOBUF_C_FIELD_FLAG_DEPRECATED = (1 << 1), +} ProtobufCFieldFlagType; /* * ProtobufCMessageDescriptor: description of a message. diff --git a/protoc-c/c_field.cc b/protoc-c/c_field.cc index cb7737d..f2afcea 100644 --- a/protoc-c/c_field.cc +++ b/protoc-c/c_field.cc @@ -130,6 +130,9 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer, && descriptor_->options().packed()) variables["flags"] += " | PROTOBUF_C_FIELD_FLAG_PACKED"; + if (descriptor_->options().deprecated()) + variables["flags"] += " | PROTOBUF_C_FIELD_FLAG_DEPRECATED"; + printer->Print(variables, "{\n" " \"$proto_name$\",\n"