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
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
For the cpp runtime, call the `Message::CopyFrom` method.
For the upb runtime, expose the message `MiniTable` and call `upb_Message_DeepCopy`.
PiperOrigin-RevId: 595166276
To satisfy the layering check, we need to depend on :gtest for the headers, in
addition to :gtest_main which provides the main() function.
There are a bunch of formatting changes as a side effect of this, but they
should be harmless.
PiperOrigin-RevId: 594318263
- Stop emitting a clear thunk for without-presence string/bytes fields (was unused, but would link-error it was used since there's no such operation).
- Remove unused clearer_thunk variable in message.cc
- Remove unsafe{} block surrounding non-unsafe BytesMutVTable::new
- Add #[allow(non_snake_case)] on module names (the new mangling added in cr/593048297 puts double-underscore in names which rustc recognizes as non-snake).
PiperOrigin-RevId: 594287606
This is based on the mangling Mercurial used in its fncache system, and leaves
us room to need to escape other symbols in the future.
PiperOrigin-RevId: 593048297
This was missed in the previous CL. DEL characters would be printed unescaped, which makes them more difficult to read but should still be data-preserving.
PiperOrigin-RevId: 592946127
Generic services have been deprecated for about 14 years. This is technically a
breaking change, but fortunately the `php_generic_services` option appears to
have little or no usage. I could not find any examples of open source code
using it.
PiperOrigin-RevId: 592677762
The `VarintParse()` function is ordinarily called only by the proto parser,
which always provides 16 bytes of "slop" space at the end of the buffer. The
ARM-specific optimized path takes advantage of this by always reading at least
8 bytes. However, this caused some test failures in msan due to unit tests not
providing a sufficient amount of initialized padding. This CL fixes the problem
by making sure the unit tests initialize the full 10-byte buffer and adding a
comment stating that this is a precondition of the function.
PiperOrigin-RevId: 592366291