Patch to make FieldDescriptorCompare operator () const

371 views
Skip to first unread message

Ross Wang

unread,
Feb 16, 2017, 9:09:49 PM2/16/17
to Protocol Buffers
We're using a toolchain with a C++ <set> implementation that warns if the set uses a comparator without a const call operator:

In file included from ... /protobuf/src/google/protobuf/compiler/java/java_file.cc:41:
In file included from ... /stl/gcc3/set:12:
In file included from ... /include/c++/v1/set:389:
... include/c++/v1/__tree:1817:22: error: the specified comparator type does not provide a const call operator [-Werror,-Wuser-defined-warnings]
... include/c++/v1/set:400:28: note: in instantiation of member function 'std::__2::__tree<const google::protobuf::FieldDescriptor *, google::protobuf::compiler::java::(anonymous namespace)::FieldDescriptorCompare, std::__2::allocator<const google::protobuf::FieldDescriptor *> >::~__tree' requested here
class _LIBCPP_TEMPLATE_VIS set

Likely toolchain change:

This seems like a reasonable warning since a mutable comparator seems like the kind of thing that would defy expectations.

Any objections to patching src/google/protobuf/compiler/java/java_file.cc with a const operator ()?

Ross Wang

unread,
Feb 16, 2017, 9:12:34 PM2/16/17
to Protocol Buffers

Adam Cozzette

unread,
Feb 17, 2017, 6:18:54 PM2/17/17
to Ross Wang, Protocol Buffers
That sounds like a good change; feel free to send out a pull request if you haven't already.

--
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 protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages