This being unused in some cases is causing a warning at head, just suppressing the warning rather than conditionally emitting it only when we need it.
PiperOrigin-RevId: 668937899
The extern "C" block in messages is now:
- Cpp kernel: All of the message/accessor/oneof externs
- Upb kernel: Only the upb_MiniTable extern
PiperOrigin-RevId: 668518308
instantiate objects if permitted by the compiler.
We can use memset for zero initialized objects, and memcpy for ones cloned from
the prototype.
This permits creating objects from the parser without calling virtual
functions.
For the cases where the efficient implementation can't be used, we generate a
"placement new" style function to offload the memory allocation out of the code
generation. This reduces code bloat even when we can't use the more efficient
implementation.
Migrate many callers of `New` and similar to the new functionality. In
particular, the parsing paths will use this.
Finally, make `New` non-virtual now that `MessageLite` can handle it directly.
It reduces binary size.
PiperOrigin-RevId: 668077355
`unsafe trait` means that the _implementation_ has constraints they need to meet for the behavior to be safe (which is the intent here, namely that it should always return the same value and always be a safe to deref value), unsafe on the fn means that the _caller_ of that fn has some constraints they need to meet for it to be safe (of which there are none in this case).
PiperOrigin-RevId: 668028628
Migrate some internals of the library off the older apis.
Also mark some of the old apis as deprecated, but the old generated code
suppressed warnings broadly to support protobuf deprecations.
PiperOrigin-RevId: 668003974
This just behaves the same as the pre-existing upb_Message_SetMessage(), but with the intendended naming style (upb_Message_SetMessage should accept an arena and support extensions).
PiperOrigin-RevId: 667998428
This unifies the duplicated logic that we had for each different non-repeated field to emit these same 3 methods for each of the different field types, and moves the has/clear off of upb-accessors-C-codegen and onto the upb-C-API for all cases (matching the singular scalars case which moved in a previous change).
PiperOrigin-RevId: 667953223
These types are effectively two ways to spell the same type, but MapView/MapMut is more terse, especially where the unnamed lifetime was used which can now be implied (`View<'_, Map<K, V>>` can just be `MapView<K,V>`)
PiperOrigin-RevId: 667636945
`absl::string_view`.
This is a modernization of the API and performance improvement for all callers.
Currently gated behind opt-in macro
`PROTOBUF_TEMPORARY_ENABLE_STRING_VIEW_RETURN_TYPE` for users to test and prevent
issues when the breaking change happens.
PiperOrigin-RevId: 667616632
These are very old unit-tests that appear to have been written to provide some conformance and fuzzing capabilities before we had more comprehensive solutions. Today, they should be already covered by our conformance tests and fuzz tests and create unnecessary noise.
The goal of this change is to remove the checked-in binary golden data that we no longer know how to regenerate. There is a lot of nearby code that could likely also be cleaned up in a follow-up
PiperOrigin-RevId: 667604310
We were really inconsistent on where we put Private or not and this tries to make a sensible consistent state of:
- For types that are exposed to application code, any pub methods which are only pub so they can be used by gencode (which is mostly anything that has any internal/runtime type anywhere on the parameters or return type list), have those methods have both a `Private` arg and doc(hidden)
- For structs that are only inside __runtime / __internal to begin with, put doc(hidden) on the types, and don't put Private on any of their methods since callers can't reach those types regardless.
Note that for exposed functions which also _accept_ another internal/runtime type in a parameter, the additional `Private` arg is superfluous since application code shouldn't ever be able to reach one of those internal types to be able to pass one in, but this keeps the pattern of keeping Private on it in those cases as well (the `Private` would still be the only guard on methods which only _return_ an internal type).
PiperOrigin-RevId: 667547566
This ensures the names of these jobs will properly be prefixed with "[SKIPPED] (Continuous)" and will show as passed instead of skipped.
PiperOrigin-RevId: 666918220
Putting it into BUILD files unintentionally forces it on all our downstream users. Instead, we just want to enable this during testing and let them choose for themselves in their builds.
Note, that this expands the scope of -Werror to our entire repo for CI, so a bunch of fixes and opt-outs had to be applied to get this change passing.
Closed#14714
PiperOrigin-RevId: 666903224