We have an obscure bug where packed-by-default repeated custom options defined
in proto3 files are not correctly treated as packed when dynamic extensions are
used. This CL introduces a simple fix and adds a test verifying the correct
behavior.
The bug was not a major problem in most cases, since parsers will accept both
the packed and unpacked encodings. It is useful to fix this to ensure that
descriptors are serialized in a consistent way, though.
PiperOrigin-RevId: 513249881
Fixes#12081.
The issue was the call to `MaybeDetachComment`: the conditional assumed that there was a next token, which was on the same line as the previous one, making attribution unclear. However, if there is no next token, we should not detach.
The actual fix is a one-liner. The rest of this PR is updates to the tests to verify this behavior under a handful of scenarios.
Closes#12082
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12082 from jhump:jh/fix-trailing-comment-attribution 767e41cb05
PiperOrigin-RevId: 513046172
Fixes#12081.
The issue was the call to `MaybeDetachComment`: the conditional assumed that there was a next token, which was on the same line as the previous one, making attribution unclear. However, if there is no next token, we should not detach.
The actual fix is a one-liner. The rest of this PR is updates to the tests to verify this behavior under a handful of scenarios.
Closes#12082
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12082 from jhump:jh/fix-trailing-comment-attribution 767e41cb05
PiperOrigin-RevId: 513046172
By default all protos are included in proto instrumentation when inject_field_listener_events option is set. Adding proto instrumentation callbacks for every proto in the binary adds codesize and runtime performance penalties. This cl introduces 'protos_for_field_listener_events' option where a list of proto files can be provided (seperated by ':') for which field listener events will be injected.
For example :-
protos_for_field_listener_events=foo/bar/foo.proto:foo/bar.proto
The field listener event will only be sent for 'foo/bar/foo.proto' and 'foo/bar.proto'.
PiperOrigin-RevId: 512905094
On some linkers, the ABI definitions in src/libprotoc.map and friends do not match all symbols that need to be exported. This causes a linker error when trying to use the resulting shared object library: `undefined reference to 'scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto'`
Quite a few people seem to be affected by this, see #5144 for discussion. It seems that yocto now applies this patch itself, but that doesn't help people building in other places (I encountered this on some HPC machines), so it would probably be good to apply it upstream as well.
Closes#11032
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/11032 from LourensVeen:issue-5144-linker-maps 3039f932aa
PiperOrigin-RevId: 512810858