From e9627054372e14eeaf6f30b13d4859ed89825c51 Mon Sep 17 00:00:00 2001 From: Andrei Nigmatulin Date: Wed, 2 Apr 2014 00:57:13 +0100 Subject: [PATCH] added deprecated flag into ProtobufCFieldDescriptor->flags [edmonds@fsi.io: resolve merge conflicts, add documentation] --- protobuf-c/protobuf-c.h | 5 ++++- protoc-c/c_field.cc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) 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"