Commit graph

154 commits

Author SHA1 Message Date
Samuel Benzaquen
50c6c24a2b Remove table prefetching experiment.
It didn't pan out and was never turned on.

PiperOrigin-RevId: 967969922
2026-08-20 12:09:14 -07:00
Protobuf Team Bot
838d639d29 Internal change.
PiperOrigin-RevId: 964172029
2026-08-13 10:51:28 -07:00
Jason Aragorn Tobias Lunn
14d12e2723 Internal change
PiperOrigin-RevId: 949737599
2026-07-17 13:38:18 -07:00
Eric Salo
a1e10dfd69 protobuf: add support for Go prototiller in codegen tests
PiperOrigin-RevId: 946073156
2026-07-10 23:37:14 -07:00
Protobuf Team Bot
fcd68c563c Make default_symbol_visibility STRICT in edition 2026
PiperOrigin-RevId: 938151844
2026-06-25 13:11:42 -07:00
Samuel Benzaquen
fe51a8722a Improve handling of split fields.
Refactor many operations to move the split section handing into an out-of-line function. This makes the main function leaner. It includes destruction, merging, clearing, and byte size calculation.

Change serialization to skip split fields by checking first on the default
check. It can skip sequential fields in a single check.

Change merging algorithm to only "prepare" the split section if we need to write to it. Previously it was preparing it if the source had a split section. This is suboptimal because the source might have allocated a split section but not using it anymore (for example, after a `Clear()`).

Changed copy constructor to invoke the out-of-line merger logic for split fields.

PiperOrigin-RevId: 933816045
2026-06-17 11:00:05 -07:00
Clayton Knittel
6c33bda21d Migrate remaining old-style $deprecated_attr$ substitutions to $DEPRECATED$ in field generators.
PiperOrigin-RevId: 910744083
2026-05-05 09:45:21 -07:00
Tony Liao
5ddd5244f7 Add an enforce_proto_limits feature which will be implemented in Edition 2026.
PiperOrigin-RevId: 908404027
2026-04-30 15:21:50 -07:00
Rachel Goldfinger
7bb96863a6 Replace EDITION_UNSTABLE with EDITION_2026 in naming style tests.
PiperOrigin-RevId: 903894356
2026-04-22 09:42:08 -07:00
Tony Liao
e3370c2e26 Add a bit more unit test coverage for Edition 2024 defaults.
(We also have some existing test coverage already in
descriptor_unittest.cc but these other edition-specific tests seem to be
missing edition 2024.)

PiperOrigin-RevId: 902261564
2026-04-19 13:11:52 -07:00
Jie Luo
e2a58e2118 Conformance performance tests for Recursion Limit on map and message_set_extension
PiperOrigin-RevId: 897865962
2026-04-10 13:42:56 -07:00
Rachel Goldfinger
e96c5ecd07 Create helper function to scrub EDITION_UNSTABLE from defaults in tests.
PiperOrigin-RevId: 895419088
2026-04-06 11:32:09 -07:00
Protobuf Team Bot
bf3677a938 Refactor code to generate parse-init code to a helper for future use.
PiperOrigin-RevId: 892909838
2026-04-01 07:07:31 -07:00
Protobuf Team Bot
967e8d5d66 Internal change
PiperOrigin-RevId: 888762434
2026-03-24 11:15:14 -07:00
Protobuf Team Bot
17b8d376e6 Internal change
PiperOrigin-RevId: 888676884
2026-03-24 08:22:43 -07:00
Clayton Knittel
523108b5b7 Add repeated_type option to C++ features.
In the future this option will be used by the field generators to decide which interface to generate for each repeated field, either proxy or legacy.

PiperOrigin-RevId: 879936002
2026-03-06 20:06:10 -08:00
Keith Smiley
f08d703292 Add support for bazel 9.x (#26201)
This doesn't flip the default bazel version, but instead makes this repo
compatible with the current version and bazel 9.x. The primary changes
for 9.x support are adding new load statements for things that were
previously built in. This cascaded into a few dep updates to pull in
their missing load statement fixes.

Closes #26201

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/26201 from keith:ks/add-support-for-bazel-9.x e8192d86b3c838f6c88d4a4adfebd07162debc0d
PiperOrigin-RevId: 878654773
2026-03-04 13:59:16 -08:00
Tobias Werth
71eef33ed0 Automated Code Change
PiperOrigin-RevId: 868019237
2026-02-10 01:55:09 -08:00
Mike Kruskal
0ecfc9bcd5 Split up naming style codegen test and fix doc comment issues.
These diffs are non-functional, but generally affected by editions transformations.  The naming style feature is perfect for locking this down since it applies to every type of descriptor.

PiperOrigin-RevId: 861207246
2026-01-26 08:39:54 -08:00
Joshua Haberman
3a3560bb87 Removed the third_party/upb/upb/bazel directory.
We are absorbing its contents into other directories. This will reduce the 3:1 merge to `upb/bazel` in GitHub to 2:1 (soon to be 1:1).

PiperOrigin-RevId: 860299666
2026-01-23 16:35:18 -08:00
Protobuf Team Bot
e8923a8ea7 Add conformance tests for utf8 validation.
PiperOrigin-RevId: 858895922
2026-01-20 21:30:50 -08:00
Protobuf Team Bot
0f3dd063c6 Add conformance test cases about handling of google.protobuf.Empty inside any Any in JSON.
As of today:
- GoProto and C# serialize google.protobuf.Empty-packed-into-Any with the `"value":{}` field set
- Only Go, C# and Swift accept that shape at parse time

In an attempt to make spec match reality, the public ProtoJSON documentation has now been clarified to match the common behavior that nearly all implementations have in practice.

Note that this conformance test added is only mandating that implementations:
1) Accept it without the `"value":{}` set
2) Serialize it without it set (by virtue of the round trip coming back to C++Proto in the test harness which does not accept it).

A test that confirms an implementation affirmatively rejects if the "value":{} is set is not added here; especially in the near term it is sensible for implementations like Go and C# to locally continue to accept that shape for backwards compatibility reasons within the same language, as long as it emits without it by default so that other languages can parse what it emits. For that reason, a test affirming a parse failure when it is present is not added to the conformance test suite failure today.

https://github.com/protocolbuffers/protobuf/issues/24445

PiperOrigin-RevId: 854155587
2026-01-09 05:52:22 -08:00
Chris Kennelly
a70115f33f Breaking change: Add [[nodiscard]] to many APIs.
This covers two types of failures:
* Methods that are logically const and failure to consume the result indicates a bug
  (an unnecessary call, etc.)
* Methods that return significant errors (failure to parse, etc.) that should not be
  unintentionally ignored.

PiperOrigin-RevId: 852313694
2026-01-05 08:41:35 -08:00
Jie Luo
b76faa921f Breaking Change: Remove deprecated FieldDescriptor::label() in OSS. Use is_repeated() or is_required() instead
https://protobuf.dev/news/2025-09-19/#cpp-remove-apis

PiperOrigin-RevId: 845462045
2025-12-16 15:43:37 -08:00
Chris Kennelly
99753deb2e Suppress failure to consume parse/serialize return values.
PiperOrigin-RevId: 840725820
2025-12-05 08:01:34 -08:00
Mike Kruskal
ca938427b0 Introduce public aliases for proto_library targets of our conformance test protos
Fixes #24508

PiperOrigin-RevId: 839389150
2025-12-02 12:52:14 -08:00
Chris Kennelly
a688b3d40c Disable clang-format on generated code.
PiperOrigin-RevId: 838890483
2025-12-01 12:42:15 -08:00
Rachel Goldfinger
192cd6631a Create editions test_utils to fix existing brittle tests in command_line_interface_unittest and code_generator_unittest.
PiperOrigin-RevId: 836222700
2025-11-24 07:46:06 -08:00
Rachel Goldfinger
9f5dfd3725 Add edition unstable for development work.
PiperOrigin-RevId: 834395706
2025-11-19 12:25:47 -08:00
Protobuf Team Bot
94add7d11d Automated Code Change
PiperOrigin-RevId: 829407619
2025-11-07 06:23:34 -08:00
Chris Kennelly
40fe103a79 Add nodiscard to has_*/*_size accessors.
PiperOrigin-RevId: 828685303
2025-11-05 16:57:25 -08:00
Mike Kruskal
98815a1524 Add 2024 golden files for the 2023->2024 transform
PiperOrigin-RevId: 819380618
2025-10-14 13:49:28 -07:00
Hong Shin
f2adb4d47d internal change
PiperOrigin-RevId: 819316614
2025-10-14 11:30:30 -07:00
Clayton Knittel
1b2ad8f1ca Align generated code with new RepeatedPtrField paradigm.
All changes to generated code are protected by `PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD`.

With this change, code will now compile with `PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD` enabled.

This change is a no-op and does not enable the change. All generated code is annotated with both the current behavior and the new behavior, and defining PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS will turn the feature on (with no change to codegen needed).

PiperOrigin-RevId: 817848228
2025-10-10 17:40:37 -07:00
Mike Kruskal
6de35c6d2f Add Java (mutable) language feature handling to 2024 transform.
This handles all of the global java option changes, as well as the mutable/proto1 features.  These can't be reasonably separated because they're all so interdependent.

PiperOrigin-RevId: 808602378
2025-09-18 08:56:54 -07:00
Mike Kruskal
ecbb6ba874 Add Go language features (API level) to 2024 transform
This only needs to handle the `api_level` feature, which has its default flipped in 2024.  Preserve the edition 2023 default of using the open API when unset.  The `go_api_flag` option is no longer valid in edition 2024, so we migrate to `api_level` unconditionally as well.

PiperOrigin-RevId: 805059796
2025-09-09 14:17:37 -07:00
Mike Kruskal
82f2663b8f Add C++ language feature handling to 2024 transform.
This overrides `enum_name_uses_string_view` and `string_type` to the 2023 default (when applicable), and migrates ctype->string_type.

PiperOrigin-RevId: 805050955
2025-09-09 13:55:09 -07:00
Mike Kruskal
f0b58e6589 Add global feature handling for 2024 transform
These are just unconditionally set to the 2023 defaults to preserve old behavior.  The feature janitor can clean up in the second pass to minimize diffs when they aren't necessary.

PiperOrigin-RevId: 804615704
2025-09-08 15:48:33 -07:00
Mike Kruskal
470522c57c Internal changes
PiperOrigin-RevId: 804581738
2025-09-08 14:19:03 -07:00
Tony Liao
945a10a6ef Refactor GenerateFastFieldEntries in protoc to use io::Printer and Emit.
PiperOrigin-RevId: 804575738
2025-09-08 14:04:48 -07:00
Sandy Zhang
c54a695cab Update our compiled_edition_default's maximum_edition to 2024
PiperOrigin-RevId: 788981870
2025-07-30 11:46:29 -07:00
Joshua Haberman
fbf36d037b Internal Change
PiperOrigin-RevId: 788062989
2025-07-28 10:28:12 -07:00
Thomas Van Lenten
1ac843e25f compile_edition_defaults rule should default to release protoc.
Only the features related tests within protobuf need to use a head
version of protoc so they can test changes to feature resolution.

PiperOrigin-RevId: 788049631
2025-07-28 09:56:12 -07:00
Clayton Knittel
553df9983f Wrap hasbit checks in inline functions.
PiperOrigin-RevId: 786826500
2025-07-24 14:01:29 -07:00
Thomas Van Lenten
b09d551636 Expand embed_edition_defaults encoding to byte types.
While there is support for base64, it requires a runtime cost to decode
back into the bytes, so adding support to write out either hex or decimal
byte values to the encoding. This allows the values to be directly used for
datatypes that are more "byte buffer" than a "string".

Also make the rule's implementation return the output file via the default file
provider.

PiperOrigin-RevId: 786338818
2025-07-23 10:42:15 -07:00
Protobuf Team Bot
8af5fadbea Automated Code Change
PiperOrigin-RevId: 783038271
2025-07-14 14:18:30 -07:00
Protobuf Team Bot
c351b4fa19 Internal change
PiperOrigin-RevId: 772184058
2025-06-16 15:01:23 -07:00
Protobuf Team Bot
f63e9fb1f2 Internal change
PiperOrigin-RevId: 772140483
2025-06-16 13:04:29 -07:00
Rob Sloan
a28fdbc29b Internal.
PiperOrigin-RevId: 770252154
2025-06-11 11:52:24 -07:00
Protobuf Team Bot
2c53499f9b Internal change
PiperOrigin-RevId: 760810208
2025-05-19 16:21:28 -07:00