`std::any` leads to compiler errors in some versions of gcc during
constructibility trait checks.
Now that we can guarantee it, return by reference to avoid extra costs in
copies.
PiperOrigin-RevId: 723478744
Co-authored-by: Protobuf Team Bot <protobuf-github-bot@google.com>
Some APIs (e.g. [BigQuery Storage](ab61c52324/google/cloud/bigquery/storage/v1/protobuf.proto (L39))) use DescriptorProto for schema descriptions. But, in Ruby, there are no methods for that so far.
This PR implements the method for that(`to_proto`) to descriptor classes.
Fixes#12044.
Closes#19971
PiperOrigin-RevId: 723149905
Previously, the import path within the runfiles was only correct for the case `--legacy_external_runfiles=True` (which copied the runfiles into `$RUNFILES/<main repo>/external/<external repo>/<path>` in addition to `$RUNFILES/<external repo>/<path>`. This flag was flipped to False in Bazel 8.0.0.
This is identical to the change made to rules_python in https://github.com/bazelbuild/rules_python/pull/2516.
Work towards https://github.com/bazelbuild/rules_python/pull/2581.
PiperOrigin-RevId: 722690855
The sync callback is replaced with a single global injection point. We don't need it to exist per instance. It still needs to be injected to prevent a direct dependency from the parser into the reflection runtime.
The GetPrototype function is replaced with the prototype itself. We don't need a function to get the prototype when we can much more cheaply just store the prototype.
Also, move the check for GetMap/MutableMap to be inlined to avoid a regression in the table-driven parser.
PiperOrigin-RevId: 722656293
For historical reasons, our internal copy of the codebase uses
`proto2_unittest` while the open source one uses `protobuf_unittest`. This adds
a lot of friction to syncing between the two, and there's no great reason to
keep maintaining this difference, so let's just go with `proto2_unittest`.
PiperOrigin-RevId: 721951543
We use the address of a variable as the seed for upb's hash function, and this
allows us to get some randomness from ASLR.
The randomness is not perfect, especially since it won't necessarily help when
ASLR is not enabled. However, it seems to be enough to prevent unit tests from
relying on a deterministic map ordering.
PiperOrigin-RevId: 721950394
Enables bzlmod for most CI tests, except python (and thus upb) since infra for system python headers for python dist are not bzlmod compatible and require further work.
#test-continuous
PiperOrigin-RevId: 721946253
Debug output is unstable and redacts fields marked directly with debug_redact, and indirectly via options. This is a breaking change for anyone who depends on DebugString output to be stable and/or redacting.
See https://protobuf.dev/news/2024-12-04/
PiperOrigin-RevId: 721918779
unparser.cc, arenaz_sampler_test.cc, and message_module.cc included port_def.inc but forgot to include the undef file. This can cause some issues on which absl macros are defined:
In file included from
/opt/protobuf-29/include/google/protobuf/arena.h:36: In file included from
/opt/protobuf-29/include/google/protobuf/arena_align.h:63: /opt/protobuf-29/include/google/protobuf/port_def.inc:542:5: error: function-like macro 'ABSL_HAVE_FEATURE' is not defined \#if ABSL_HAVE_FEATURE(address_sanitizer)
Closes#20052
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/20052 from wilstoff:port_undef_fix 861d2e654f
PiperOrigin-RevId: 721863566
Found this bug where if `_ConvertFieldValuePair` fails while parsing an
Any from a dictionary value then the `@type` field gets removed from
the original object. Adding a simple `try/finally` to ensure we always
restore the original object.
Closes#20111
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/20111 from atulmerchia:fix-destructive-anyparser 58aea1911f
PiperOrigin-RevId: 721850901
In optimized builds, this test currently calls `__builtin_assume()` on a false
statement, which is undefined behavior that trips up ubsan. This change fixes
that by skipping the test case when `NDEBUG` is defined.
PiperOrigin-RevId: 721617118
I'm not sure why, but it seems that some tests are not running via Bazel. CI uses Bazel. So I think we should add those to test correctly.
Also, I fixed some tests to pass.
* Run memory tests against CRuby native implementation
* These tests are for CRuby native implementation. So this doesn't work with FFI and JRuby.
* Ref: https://github.com/protocolbuffers/protobuf/pull/15840/
* Run service options extension test against CRuby native implementation
* It seems that JRuby doesn't support this so far.
* And, service options are frozen objects. But, in CRuby FFI, can't get a Message instance if the message is frozen. So this doesn't work.
* d406cae013/ruby/lib/google/protobuf/ffi/message.rb (L419)
* So the service options extension test only passes in CRuby native.
Closes#19870
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/19870 from y-yagi:add_some_missing_tests d51158def9
PiperOrigin-RevId: 721603213