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
The goal is to reduce the surface area and size of port_def.inc, as a somewhat
magic textual header.
(Also #defining __reserved_names is a bit of a maintenance risk)
PiperOrigin-RevId: 572188636
Prior to RepeatedPtrField having an SOO, we did this for all sizes. This
poisoning step can aid debugging for use-after-frees.
PiperOrigin-RevId: 572115487
UTF-8 acceptable codepoints are 0x0000-0x10FFFF, previously we treated this as an inclusive-exclusive bound, but UTF-8 does include it's topmost character.
PiperOrigin-RevId: 572111435
Instead, we will hardcode the feature validation using macros and add a reflective test to make sure it stays in sync. Reflection during descriptor builds is problematic, and in order to migrate proto2/proto3 to editions fully, we'll need to do feature resolution in *all* builds.
PiperOrigin-RevId: 572054031
Previously, some but not all of these classes stored `Context* context_`.
These will be used in a followup change to consider strip_nonfunctional_codegen in field comments.
PiperOrigin-RevId: 571419303