Follow up to #14594, which added support for custom options, this PR implements extensions support, which should fully resolve#1198.
Closes#14703
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14703 from protocolbuffers:add-support-for-extensions-in-ruby 601aca4121
PiperOrigin-RevId: 582460674
Co-authored-by: Jason Lunn <jason.lunn@gmail.com>
We had previously commented out the upb portion of simple_nested_test.
This is because nonmutable getters have submessages being NULL by default.
This means that trying to fetch anything, like a simple scalar from that nested message would segfault.
This CL makes the externC return an Option<RawMessage> since we've discovered that upb can return NULL. This way, we can check for `None` and handle the NULL case appropriately.
We know that the NULL pathway can only come from terra upb, since
cpp automagically constructs submsgs if they don't exist.
We've augmented upb.rs to contain a scratch space that allocates a zeroed-out contiguous chunk of memory @64KB. Since a block of zeroed-out memory is a legit message from upb's point of view, we can provide $pbr$::ScratchSpace::zeroed_block() to upb in order to get the default submessage behavior we want from upb.
This block is lazily allocated upon first request. This means that a consumer of the cpp kernel will not incur an additional cost.
PiperOrigin-RevId: 573840755
Clang's ThinLTO does not know to honor __attribute__((noinline)) on the
definition in a .cc file if the declaration in a .h file did not also have the
attribute. This can lead to unwanted cross-translation-unit inlining
contributing to stack overflow in deeply recursive protobuf parses, but only
in sufficiently vigorously optimized release builds.
PiperOrigin-RevId: 573266335
This change migrates proto2 and proto3 to real editions, without impacting users at all. While we already had feature defaults set, we weren't really using them outside of editions. This change introduces InferLegacyProtoFeatures, which infers features from descriptors. Any language that wants to follow this rollout pattern will need to implement similar transformations.
PiperOrigin-RevId: 572593956
This is needed to unblock Java editions codegen tests, due to codegen diff for proto3 optionals migrated to editions.
This is incompatible with runtimes <24.x, but our cross-version support policy explicitly does not guarantee compatibility for new gencode with old runtimes: https://protobuf.dev/support/cross-version-runtime-guarantee/#minor
PiperOrigin-RevId: 572578693