Note that this change removes the use of ${$ and $}$ in
the body of a template `clear` method. These brackets are
currently unused (there's no Annotate call and the variables are
set to the empty string); it also shouldn't be necessary to
annotate non-definitions.
PiperOrigin-RevId: 596254156
The absolute address of a member is unstable and can be invalidated by changes to other
fields. For example, for split fields.
PiperOrigin-RevId: 596072639
This guarantees that no matter how you get the instance we pin the type on any
use.
Previously, casting a `Message*` to some generated type and calling methods on it could trigger undefined behavior unless the cast is down via the ones provided by the library (eg `DownCastToGenerated`).
PiperOrigin-RevId: 596066250
This bug arises only in the uncommon case where there is more than one DescriptorPool. In such a case, JSON encode/decode should always use the pool of the message being encoded/decoded, not the generated pool.
Closes#15281
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15281 from protocolbuffers:ruby-json-pool-fix 91e2dc55dc
PiperOrigin-RevId: 596027770
Include AddFileDescriptor, AddDescriptor, AddEnumDescriptor,
AddExtensionDescriptor, AddServiceDescriptor.
Those Deprecated APIs may add unlinked descriptors to descriptor_pool which is
is wrong. Should use Add() or AddSerializedFile() instead. Those APIs were
raising deprecated warnings since 2019
PiperOrigin-RevId: 595831718
`bind()` targets are deprecated and unsupported with Bzlmod. Specifying the dependency directly as a mitigation.
Alternative: Define an `alias()` within `/third_party/BUILD`.
Closes#15236
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15236 from mering:alias-python-headers 801ac73313
PiperOrigin-RevId: 595737575
std::to_address uses this function to "Obtain the address without forming a reference", so it might get surprised if it forms a reference in the process.
PiperOrigin-RevId: 595705426
This check enforces that each C++ build target has the correct dependencies for
all headers that it includes. We have many targets that were not correct with
respect to this check, so I fixed them up.
I also cleaned up the C++ targets related to the well-known types. I created a
cc_proto_library() target for each one and removed the :wkt_cc_protos target,
since this was necessary to satisfy the layering check. I deleted the
//src/google/protobuf:protobuf_nowkt target and deprecated :protobuf_nowkt,
because the distinction between the :protobuf and :protobuf_nowkt targets was
not really correct. Neither one exposed the headers for the well-known types in
a way that was valid with respect to the layering check, and the idea of
bundling all the well-known types together is not idiomatic in Bazel anyway.
This is a breaking change, because the //:protobuf target no longer bundles the
well-known types. From now on they should be accessed through the new
//:*_cc_proto aliases in our top-level package.
I renamed the :port_def target to :port, which simplifies things a bit by
matching our internal name.
The original motivation for this change was that to move utf8_range onto our CI
infrastructure, we needed to make its dependency rules_fuzzing compatible with
Bazel 6. The rules_fuzzing project builds with the layering check, and I found
that the process of upgrading it to Bazel 6 made it take a dependency on
protobuf, which caused it to break due to layering violations. I was able to
work around this, but it would still be nice to comply with the layering check
so that we don't have to worry about this kind of thing in the future.
PiperOrigin-RevId: 595516736
This change has no behavior change, other than CHECK-fail `protoc` when a bug is detected instead of generating the buggy code.
PiperOrigin-RevId: 595467581
If the underlying array for a repeated field is a nullptr (which is possible for const array access on a message field that hasn't been set) the begin iterator will currently contain garbage data, which can lead to an illegal access. This CL adds a nullptr check to `begin()`, similar to what already exists for `size()`.
PiperOrigin-RevId: 595217999