Chris Kennelly
11ef0ffb87
Breaking Change: Ensure we allocate overaligned types with aligned operator new.
...
* The alignment may be incorrect.
* Using delete[] otherwise mismatches, since it was not allocated with
overaligned operator new.
Additionally, we add a test to ensure we do not value initialize in this case.
PiperOrigin-RevId: 620241337
9 months ago
Adam Cozzette
b8eeefe663
Internal change
...
PiperOrigin-RevId: 620116943
9 months ago
Protobuf Team Bot
539cf497c6
Update comment referencing removed CreateMaybeMessage API
...
PiperOrigin-RevId: 620089913
9 months ago
Joshua Haberman
1f6580dd0c
Added conformance test for unknown field ordering.
...
Implementations should not rearrange unknown fields for the same field number, because some field types accept multiple wire types (eg. packed and unpacked).
All languages currently pass this test except Java "full" and Obj-C.
PiperOrigin-RevId: 619953711
9 months ago
Alex Eagle
71e4061ace
feat: test bzlmod usage on CI ( #16319 )
...
Closes #16319
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16319 from protocolbuffers:bcr d66845cfcb
PiperOrigin-RevId: 619939078
9 months ago
Protobuf Team Bot
62620979c2
Add a test for repeated field orderings demonstrating that MessageDifferencer::Equals and MessageDifferencer::Equivalent treat these cases in the same way.
...
PiperOrigin-RevId: 619712729
9 months ago
Chris Kennelly
9b2b61cfb4
Statically assert pointer alignment.
...
We use the lower bits for tagging.
PiperOrigin-RevId: 619606723
9 months ago
Protobuf Team Bot
2693af92b3
Add a field to TestOneof2.NestedMessage.
...
PiperOrigin-RevId: 619532085
9 months ago
Protobuf Team Bot
83ec410d30
Internal change
...
PiperOrigin-RevId: 619377672
9 months ago
Protobuf Team Bot
704d0454dd
Auto-generate files after cl/619359463
9 months ago
Mike Kruskal
7662fdd8ed
Fix toproto behavior for groups and required under editions
...
PiperOrigin-RevId: 619359463
9 months ago
Sandy Zhang
6c45efd297
Fix validateFeatures to be called after resolved features are actually set to this.features
...
PiperOrigin-RevId: 619296935
9 months ago
Anton Grbin
86abf35ef5
Python JSON parser: Ignore invalid enum string values if ignore_unknown_fields is set ( #15887 )
...
# Motivation
This PR fixes failing conformance tests for python with name `IgnoreUnknownEnumStringValue`.
The JSON parsing spec was discussed in https://github.com/protocolbuffers/protobuf/issues/7392 .
Recent equivalent changes for other languages:
* Swift: https://github.com/apple/swift-protobuf/pull/1345
* C#: https://github.com/protocolbuffers/protobuf/pull/15758
# Changes
- 1st commit is a noop refactoring to make relevant _ConvertScalarFieldValue invocations localized
- 2nd commit introduces the child exception of `ParseError` named `EnumStringValueParseError` which is suppressed if `ignore_unknown_fields` is set
- 3rd commit updates the conformance test failure lists
Closes #15887
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15887 from noom:anton/7392/fix-python-test fbcc93a232
PiperOrigin-RevId: 619288323
9 months ago
Jie Luo
7e033c0be1
internal chnge
...
PiperOrigin-RevId: 619287040
9 months ago
Protobuf Team Bot
1f1e64f804
Auto-generate files after cl/619266468
9 months ago
Mike Kruskal
19c4a7d647
Close conformance test gaps for delimited encoding.
...
This documents existing behavior before we attempt to fix the issues in editions.
PiperOrigin-RevId: 619266468
9 months ago
Protobuf Team Bot
f5c53ac460
Fix build for older compilers.
...
If it doesn't properly do constant initialization on globals we should
not try to call virtual functions on these objects during dynamic
initialization.
Turn off the optimization in these cases.
PiperOrigin-RevId: 619251810
9 months ago
Protobuf Team Bot
b5e69ae141
Auto-generate files after cl/619244115
9 months ago
Mike Kruskal
11e767a899
Fix latent bug in upb editions implementation caught by python conformance tests.
...
PiperOrigin-RevId: 619244115
9 months ago
Protobuf Team Bot
e2d0a9e2a4
Auto-generate files after cl/619196103
9 months ago
Eric Salo
2d9c00ccec
upb: clean up open vs closed enums in the Dart gencode
...
PiperOrigin-RevId: 619196103
9 months ago
Protobuf Team Bot
d4525cb9ed
Automated Code Change
...
PiperOrigin-RevId: 619115088
9 months ago
Jie Luo
a2cc9f7b62
internal change
...
PiperOrigin-RevId: 619038132
9 months ago
Protobuf Team Bot
0f2ad6db5a
Auto-generate files after cl/619015714
9 months ago
Sandy Zhang
274bc7f26f
Move java_features.proto to java/core/srce/main/resources
...
This also fixes maven to package this correctly as google/protobuf/java_features.proto (same dir as WKT/descriptor.proto) instead of com/google/protobuf/java_features.proto.
Fixes https://github.com/protocolbuffers/protobuf/issues/16155
PiperOrigin-RevId: 619015714
9 months ago
Protobuf Team Bot
e879f6bb5f
Auto-generate files after cl/619004014
9 months ago
Joshua Haberman
8612d5e771
Print non-extension fields by field number order instead of .proto file order.
...
This will affect both JSON and TextFormat. The serialization order for these two formats is not specified, so switching from `.proto` file order to field number order should not be breaking.
This does not affect the order of extensions, which are always printed last (even if their field numbers interleave with regular fields.
This change appears to speed up JSON encoding by about 15%:
```
name old speed new speed delta
BM_LoadAdsDescriptor_Upb<NoLayout> 132MB/s ± 2% 129MB/s ±11% ~ (p=0.841 n=5+5)
BM_LoadAdsDescriptor_Upb<WithLayout> 118MB/s ± 1% 118MB/s ± 2% ~ (p=0.841 n=5+5)
BM_LoadAdsDescriptor_Proto2<NoLayout> 62.3MB/s ± 2% 62.4MB/s ± 2% ~ (p=0.841 n=5+5)
BM_LoadAdsDescriptor_Proto2<WithLayout> 61.0MB/s ± 2% 60.1MB/s ± 8% ~ (p=0.421 n=5+5)
BM_Parse_Upb_FileDesc<UseArena, Copy> 566MB/s ± 1% 572MB/s ± 2% ~ (p=0.222 n=5+5)
BM_Parse_Upb_FileDesc<UseArena, Alias> 626MB/s ± 1% 620MB/s ± 3% ~ (p=0.421 n=5+5)
BM_Parse_Upb_FileDesc<InitBlock, Copy> 572MB/s ± 1% 578MB/s ± 2% ~ (p=0.421 n=5+5)
BM_Parse_Upb_FileDesc<InitBlock, Alias> 636MB/s ± 1% 635MB/s ± 2% ~ (p=0.841 n=5+5)
BM_Parse_Proto2<FileDesc, NoArena, Copy> 360MB/s ±12% 345MB/s ±14% ~ (p=0.841 n=5+5)
BM_Parse_Proto2<FileDesc, UseArena, Copy> 692MB/s ± 2% 691MB/s ± 4% ~ (p=0.548 n=5+5)
BM_Parse_Proto2<FileDesc, InitBlock, Copy> 709MB/s ± 1% 705MB/s ± 2% ~ (p=0.841 n=5+5)
BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 642MB/s ± 1% 646MB/s ± 1% ~ (p=0.690 n=5+5)
BM_SerializeDescriptor_Proto2 1.19GB/s ± 8% 1.22GB/s ± 8% ~ (p=0.095 n=5+5)
BM_SerializeDescriptor_Upb 725MB/s ± 1% 732MB/s ± 1% ~ (p=0.056 n=5+5)
BM_JsonParse_Upb 187MB/s ± 1% 188MB/s ± 2% ~ (p=1.000 n=5+4)
BM_JsonParse_Proto2 18.7MB/s ± 1% 18.6MB/s ± 2% ~ (p=0.841 n=5+5)
BM_JsonSerialize_Upb 106MB/s ± 1% 122MB/s ± 1% +14.65% (p=0.008 n=5+5)
BM_JsonSerialize_Proto2 54.0MB/s ± 2% 53.9MB/s ± 3% ~ (p=1.000 n=5+5)
```
PiperOrigin-RevId: 619004014
9 months ago
Protobuf Team Bot
121143551c
Rename PerConstSerialArenaInChunk() to VisitSerialArena() and include first_arena_.
...
PiperOrigin-RevId: 618962988
9 months ago
Sandy Zhang
6483c4755d
Update protoc release to include editions language features protos for Java and C++
...
Fixes https://github.com/protocolbuffers/protobuf/issues/16211
PiperOrigin-RevId: 618954029
9 months ago
Protobuf Team Bot
8a4ab72968
Auto-generate files after cl/618930720
9 months ago
Protobuf Team Bot
8599ab5a59
Add an RAII namespace printer helper for C++ codegen.
...
This can be used to open and close namespace automatically within generated C++ code.
PiperOrigin-RevId: 618930720
9 months ago
Protobuf Team Bot
6f1ef6f5b4
Apply the two phase extension registration approach to all extensions, not just
...
message extensions. Otherwise we might still miss some descriptor extensions
when parsing descriptors in phase two.
PiperOrigin-RevId: 618924435
9 months ago
Liam Miller-Cushon
b36458fd80
Make `NioByteString` private member class of `ByteString`
...
PiperOrigin-RevId: 618910772
9 months ago
Protobuf Team Bot
6676a10658
Remove dead code leftover from previous change.
...
PiperOrigin-RevId: 618895543
9 months ago
Protobuf Team Bot
9285b9e0f5
Auto-generate files after cl/618883303
9 months ago
Protobuf Team Bot
897fd04266
Correct issue where open enums were incorrectly expected to be linked by upb_MiniTable_GetSubList()
...
PiperOrigin-RevId: 618883303
9 months ago
Sandy Zhang
9ce51d1ed8
Set label to REQUIRED for descriptors with LEGACY_REQUIRED feature.
...
Ensures isOptional() does not return true for LEGACY_REQUIRED fields which would otherwise get the optional label applied by default (non-optional fields still get the optional label).
Adds validation to feature resolution instead of cross link, which is too early to have FieldPresence.LEGACY_REQUIRED resolved.
PiperOrigin-RevId: 618857590
9 months ago
Protobuf Team Bot
7df9d5d970
Use $Msg$::parse() where sensible.
...
PiperOrigin-RevId: 618838455
9 months ago
Protobuf Team Bot
847d31afb2
Add a convenience SomeMsg::parse(bytes) -> Result<SomeMsg, ParseErr>
...
Rename .deserialize(&mut self) method to .clear_and_parse() (by marking the .deserialized deprecated pointing at the new name, will clean up usages separately)
END_PUBLIC
Per discussion in the team chat, parse/serialize is the most typical terminology for protobuf impls, we don't have much local reason to diverge.
I'm proposing giving the 'better' name to the named ctor since I think that is the one that we expect people to reach for by default; it is generally cleaner than "new then deserialize" pattern since after a parse failure there's not any message still hanging around with implementation-defined contents, along with some other smaller ergonomics benefits.
In C++ (when exceptions aren't enabled) all constructors must be infallible, so it can't have it. In Rust there's no language idiom reason why we shouldn't have an associated fn that returns Result<Msg, ParseErr>.
PiperOrigin-RevId: 618823998
9 months ago
Protobuf Team Bot
0c8f970fc9
Implement Default::default() for owned messages.
...
PiperOrigin-RevId: 618758568
9 months ago
Protobuf Team Bot
aa938dd958
Auto-generate files after cl/618485105
9 months ago
Protobuf Team Bot
87b1c592a3
Move the IfnDefGuard from third_party/protobuf/io/cpp_utils to the existing third_party/protobuf/compiler/cpp, which is a more logical location.
...
PiperOrigin-RevId: 618485105
9 months ago
Jie Luo
7cf02389b3
fix upb python: DO NOT create empty optional field after sorting empty repeated field
...
PiperOrigin-RevId: 618350866
9 months ago
Protobuf Team Bot
41aeb3c7ed
Update to ads v16.
...
Google ads api v13 is sunsetted.
PiperOrigin-RevId: 618321878
9 months ago
Mike Kruskal
c56de479a4
Fix another locale issue with ctype.h in PHP generator.
...
PiperOrigin-RevId: 618321344
9 months ago
Protobuf Team Bot
86ff76719e
Minor cleanup: IWYU, clang-tidy, etc.
...
PiperOrigin-RevId: 618297183
9 months ago
Sandy Zhang
369732a581
Add java_features.proto to kotlin_mvn release
...
PiperOrigin-RevId: 618295219
9 months ago
Mike Kruskal
e56ebcec8d
Migrate direct callers of options().packed() to is_packed() helper.
...
PiperOrigin-RevId: 618254593
9 months ago
Sandy Zhang
500c953d10
Enable editions support for Java Lite.
...
java_features.proto and descriptor.proto should now both be included in the Java Lite and Kotlin Lite maven releases.
Fixes https://github.com/protocolbuffers/protobuf/issues/7331
PiperOrigin-RevId: 618251348
9 months ago
Eric Salo
d452a16b8c
upb: fix textformat encoder to print group name instead of field name
...
PiperOrigin-RevId: 618228797
9 months ago