Before this fix, the overload resolution rules would accidentally attempt to call the accessor named clear() instead of the fn that would actually clear the message (Rust automatically prefers an inherent impl fn over a trait impl fn if both exist with the same name).
PiperOrigin-RevId: 713309633
There is a subtle behavior difference here when AllowUnknownDependencies is set on the pool, since unknown feature values are theoretically possible there.
PiperOrigin-RevId: 713301571
Using the newer Emit() API improves readability.
For now, GenerateFastFieldEntries and GenerateFieldEntries still use the old
format API. They will be worked on in later PRs.
PiperOrigin-RevId: 713125696
Also changed `space_allocated` to a `uintptr_t` since it's a sum of `size_t`s, and unfortunately due to a lack of `_Generic` availability in default msvc it needs a conversion when being added.
PiperOrigin-RevId: 712994963
When adding UPB as a backend to to reflection_test, I found that the test had
lots of if-conditions that skip certain sections of the test based on an
assumption that anything where api_implementation.Type() != 'python' is C++.
With UPB in the mix, that's no longer true. So it seemed like a good
opportunity to go in and lock down the nonconformance a bit tighter.
As it turns out, some of the nonconformance has been fixed already over the
past 10 years. :) So we can simply remove some of the if checks and enjoy a
better conformance test coverage across all python backends!
PiperOrigin-RevId: 712945117
The test wrappers were another way to document nonconformant behaviour between
different python backends. We can achieve the same by removing the wrapper
script and adding an if-condition in the test itself based on
api_implementation.Type(). Since we already do that for nonconformance between
pure Python vs. C++ backends, this change makes it easier to look for UPB
nonconformance instead of going through another layer of indirection.
Since this is the last remaining test file in the pb_unit_tests directory, I
have removed the entire directory. Future UPB tests will be in the same
directory as C++ and pure python implementations, namely:
//python/google/protobuf/internal.
Temporarily, we will need to hardcode the migrated test name in test_upb.yml
because not all tests under google.protobuf.internal support UPB yet.
(UPB testing for selected tests are added in 21e9aa6cac).
The reflection_test is a slightly more complicated test. In this commit I've
removed exemption of testParsingNestedClass in reflection_test. A follow-up
commit will ensure further conformance within the reflection_test. There are
quite a few if-conditions that were added to skip certain checks due to
nonconformant behavior -- they seem to no longer apply.
PiperOrigin-RevId: 712943652
1) An Any with no type_url or value should be represented as `{}`
2) A `null` should be handled as the Any being absent.
3) JSON of `{"@type_url": "", "value":""}` should be a parse failure.
PiperOrigin-RevId: 712938072
and enable Wnullability-completeness in proto headers via port_def.inc to help check for backsliding.
A few nonnulls are added for nested pointers.
A follow-on will add the rest of the Nonnull annotations.
We'll also add annotations for the runtime later.
Not yet active in open source (more of a comment).
PiperOrigin-RevId: 712901449
There's already path compression which guarantees amortized fast times (halving the cost of subsequent lookups, alas not the inverse ackermann), but there's still no need to redo work and acquire/release atomics the whole way along the path. This also takes advantage of the fast-path relaxed-only read for querying the root of a root node.
PiperOrigin-RevId: 712770023
* Add acquire/release where necessary for all atomic ops
* Add sentinel member to ensure safe publication when tsan is active; tsan will not catch the previous errors without this member.
* For all operations using relaxed memory order, comment why relaxed order is safe
* Add a test that exercises racy fuses and space allocated checks without mutexes or other memory barriers from the test harness. This test proved the existence of several races not caught by the existing tests, including one with a confident comment about why relaxed memory order was safe.
* Add a test that exercises racing allocation and destruction among fused arenas, which doesn't use locks and substitutes a custom allocator that verifies its memory blocks.
Test coverage and assert/tsan instrumentation is now sufficient to cause test failures if any call site is further relaxed.
PiperOrigin-RevId: 712751905
The test wrappers were another way to document nonconformant behaviour between
different python backends. We can achieve the same by removing the wrapper
script and adding an if-condition in the test itself based on
api_implementation.Type(). Since we already do that for nonconformance between
pure Python vs. C++ backends, this change makes it easier to look for UPB
nonconformance instead of going through another layer of indirection.
Temporarily, we will need to hardcode the migrated test name in test_upb.yml
because not all tests under google.protobuf.internal support UPB yet.
(UPB testing for selected tests are added in 21e9aa6cac).
PiperOrigin-RevId: 712672890
implemented on top of `UntypedMapBase` visitation.
Reduces code duplication in large binaries.
More to come in future changes.
PiperOrigin-RevId: 712658107
The unnecessary [< >] around the ident in that specific macro expansion makes it the name as a literal which would then later be reparsed back into an ident, which makes it lose the r# in the process and break.
PiperOrigin-RevId: 712562736
This was disabled because it couldn't pass with the upb C generated accessors. Now that we only use the upb minitables, this can be safely enabled.
PiperOrigin-RevId: 712560415
This fixes:
* MSVC with `/std:c11 /experimental:c11atomics` on recent versions now emits atomics
* Clang with `-std=c11 -fgnuc-version=0` now emits atomics
* Clang and GCC 14 when built with `-std=c99 -pedantic-errors` will now compile, and not emit atomics
PiperOrigin-RevId: 712538312
The test wrappers were another way to document nonconformant behaviour between
different python backends. We can achieve the same by removing the wrapper
script and adding an if-condition in the test itself based on
api_implementation.Type(). Since we already do that for nonconformance between
pure Python vs. C++ backends, this change makes it easier to look for UPB
nonconformance instead of going through another layer of indirection.
Temporarily, we will need to hardcode the migrated test name in test_upb.yml
because not all tests under google.protobuf.internal support UPB yet.
(UPB testing for selected tests are added in 21e9aa6cac).
PiperOrigin-RevId: 711837521