I wanted to defined custom Field- and Message options by the same name 
(having the same meaning but in different scope). For example:

v--------------------------------------------------------------
import "descriptor.proto";
extend google.protobuf.FieldOptions {
  optional bool aligned = 2000;
}

extend google.protobuf.MessageOptions {
  optional bool aligned = 2000;              // line 293
}
^--------------------------------------------------------------

This results in the following protoc error:

tst_protobuf.proto(293) : error in column=17: "aligned" is already defined 
in "tst_protobuf".

However, if remove the option from the MessageOptions and try to compile a 
protocol with messages like:

v--------------------------------------------------------------
message test1
{
  optional int64 fld = 10 [(aligned)=true];
}

message test2
{
  option (aligned) = true;
  optional int64 fld = 10;
}
^--------------------------------------------------------------

Then I will get an error depending on which of the custom 'align' options I 
remove:

tst_protobuf.proto(293) : error in column=10: Option field "(aligned)" is 
not a field or extension of message "MessageOptions".

or

tst_protobuf.proto(298) : error in column=28: Option field "(aligned)" is 
not a field or extension of message "FieldOptions".

Is this a known/design limitation? Are there pattern in place for naming 
the options according to where they are used (like 'message_alignment' vs. 
'field_alignment')?

Regards,

Dror Harari

p.s. the original error is reported in descriptor.cc in AddSymbol...

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to