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
Also, add reference overloads of DynamicCastToGenerated which terminate on failure like dynamic_cast would do on an environment without exceptions.
PiperOrigin-RevId: 571241355
This removes a large chunk of the reflection we need to do during descriptor builds, and will make it possible to migrate descriptor.proto to editions. It also removes some special treatment of the C++ runtime, which happens to have easy access to protoc internals today.
PiperOrigin-RevId: 571177924
This is meant to optimize our editions handling before rolling it out more widely to proto2 and proto3 under the hood. As it's implemented today, every file descriptor would need to allocate its own duplicate FeatureSet for either proto2 or proto3 (plus additional ones per proto2 group).
PiperOrigin-RevId: 571166907
This hooks up legacy proto2/proto3 editions, but prohibits them from being used in proto files. These will be hooked up directly to `syntax` declarations in a later change.
PiperOrigin-RevId: 570746314
These exist so that new features can specify their proto2/proto3 defaults. This will allow for easier migration to editions, and also allow us to migrate more proto2/proto3 code paths to common editions code. The latter will provide give us early coverage over a lot more of editions.
PiperOrigin-RevId: 570576252
This is preparation work to merge the vtable with the `ReflectionPayload`
object to reduce the size of MapField by 8 bytes.
PiperOrigin-RevId: 570387900