All of this information is still available by merging fixed_features and overridable_features. This new split will make validation easier for runtimes that need to do dynamic builds.
PiperOrigin-RevId: 625815212
Instead of rewriting the field type, just leave it alone. This will only be a potential behavior change for people calling DescriptorPool::InternalSetLazilyBuildDependencies directly. Our normal codegen path already sets field types correctly and is unaffected.
PiperOrigin-RevId: 625807209
The new fields fixed_features and overridable_features can be simply merged to recover the old aggregate defaults. By splitting them though, plugins and runtimes get some extra information about lifetimes for enforcement.
PiperOrigin-RevId: 625527117
The only public target here is the edition defaults helper macro, which can be used by external runtimes and plugins. None of this code is C++-specific though, and should be organized higher up. Appropriate aliases are also placed at the top level for public targets
PiperOrigin-RevId: 625392504
The new fields fixed_features and overridable_features can be simply merged to recover the old aggregate defaults. By splitting them though, plugins and runtimes get some extra information about lifetimes for enforcement.
PiperOrigin-RevId: 625084569
- Only call GetUtf8CheckMode once per field.
- Avoid vector reallocations in GenerateFieldNames by sizing it correctly from the start and using pointers to write to it instead of push_back.
- Stop making a temporary array of names. We cache GetUtf8CheckMode so testing for it again is cheaper.
PiperOrigin-RevId: 624986618
The intent of this directory would be for a layer of Rust bindings that directly map to upb semantics; Rust Protobuf runtime would be layer on top of that Rust, instead of directly on the upb C api.
PiperOrigin-RevId: 624282429
Features need to be validated within the pool being built, since the generated pool only contains extensions linked into the binary (e.g. protoc or a runtime building dynamic protos). The generated pool may be missing extensions used in this proto or it may have version skew. Moving to the build pool requires reflective parsing, which in general can't be done from inside the pool's database lock. This required some refactoring to add a post-build validation phase outside of the lock.
For now, the feature support spec is optional and the checks only are only applied when it's present. Follow-up changes will add these specs to our existing features and then require them for all FeatureSet extensions.
PiperOrigin-RevId: 623630219
- For enums that are already defined in a sequential manner, use the existing info from the descriptor.
- For other enums use a bit set to find unique values instead of a vector+sort+unique. Much less work to do so, and we can use stack for it instead of heap most of the time.
PiperOrigin-RevId: 623613446
- Make FreeStringBlocks() happen inside Free() as string blocks are basically an implementation detail of SerialArena.
- Add GetDeallocator to the anonymous namespace.
- Remove a comment about the implementation of AddSpaceAllocated at one of its callsites.
PiperOrigin-RevId: 623563543
Instead of using the message's corresponding field to denote the end of the stream, just abort it on *any* end group tag. If this is an invalid tag, the caller will handle the failure.
PiperOrigin-RevId: 622859234
Trying to build `protobuf/3.21.12` my tests is failing on Android due to the GID_MAX/UID_MAX macros. This is because port_def.inc is missing these entries for Android. This PR adds those missing macros. I am not sure if I should apply the same port for the `TRUE`/`FALSE` macros as well, any opinion here would be appreciated.
See compile errors below:
```
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android29 --gcc-toolchain=C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchai
ns/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot -IC:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9
-armv8-17-debug -isystem C:/Users/edukaj/.conan2/p/b/proto97c417c206dce/p/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat
-Werror=format-security -O0 -fno-limit-debug-info -std=c++17 -fPIE -MD -MT CMakeFiles/test_package.dir/addressbook.pb.cc.o -MF CMakeFiles\test_package.dir\addressbook.pb.cc.o.d -o CMakeFiles/test_package.dir/addressbook.p
b.cc.o -c C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.cc
In file included from C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.cc:4:
C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.h:834:24: error: expected member name or ';' after declaration specifiers
static constexpr GID GID_MAX =
~~~~~~~~~~~~~~~~~~~~ ^
C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\limits.h:118:18: note: expanded from macro 'GID_MAX'
# define GID_MAX UINT_MAX /* max value for a gid_t */
^
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.9\include\limits.h:56:20: note: expanded from macro 'UINT_MAX'
#define UINT_MAX (__INT_MAX__ *2U +1U)
^
<built-in>:92:21: note: expanded from here
#define __INT_MAX__ 2147483647
^
In file included from C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.cc:4:
C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.h:834:24: error: expected ')'
C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\limits.h:118:18: note: expanded from macro 'GID_MAX'
# define GID_MAX UINT_MAX /* max value for a gid_t */
^
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.9\include\limits.h:56:20: note: expanded from macro 'UINT_MAX'
#define UINT_MAX (__INT_MAX__ *2U +1U)
^
<built-in>:92:21: note: expanded from here
#define __INT_MAX__ 2147483647
^
C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.h:834:24: note: to match this '('
C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\limits.h:118:18: note: expanded from macro 'GID_MAX'
# define GID_MAX UINT_MAX /* max value for a gid_t */
^
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.9\include\limits.h:56:19: note: expanded from macro 'UINT_MAX'
#define UINT_MAX (__INT_MAX__ *2U +1U)
^
In file included from C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.cc:4:
C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.h:862:24: error: expected member name or ';' after declaration specifiers
static constexpr UID UID_MAX =
~~~~~~~~~~~~~~~~~~~~ ^
C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\limits.h:117:18: note: expanded from macro 'UID_MAX'
# define UID_MAX UINT_MAX /* max value for a uid_t */
^
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.9\include\limits.h:56:20: note: expanded from macro 'UINT_MAX'
#define UINT_MAX (__INT_MAX__ *2U +1U)
^
<built-in>:92:21: note: expanded from here
#define __INT_MAX__ 2147483647
^
In file included from C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.cc:4:
C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.h:862:24: error: expected ')'
C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\limits.h:117:18: note: expanded from macro 'UID_MAX'
# define UID_MAX UINT_MAX /* max value for a uid_t */
^
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.9\include\limits.h:56:20: note: expanded from macro 'UINT_MAX'
#define UINT_MAX (__INT_MAX__ *2U +1U)
^
<built-in>:92:21: note: expanded from here
#define __INT_MAX__ 2147483647
^
C:/qxr/repo/conan-center-index/recipes/protobuf/all/test_package/build/clang-9-armv8-17-debug/addressbook.pb.h:862:24: note: to match this '('
C:/Users/edukaj/.conan2/p/b/andro6a387be0e6a99/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\limits.h:117:18: note: expanded from macro 'UID_MAX'
# define UID_MAX UINT_MAX /* max value for a uid_t */
^
C:\Users\edukaj\.conan2\p\b\andro6a387be0e6a99\p\bin\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.9\include\limits.h:56:19: note: expanded from macro 'UINT_MAX'
#define UINT_MAX (__INT_MAX__ *2U +1U)
^
4 errors generated.
ninja: build stopped: subcommand failed.
```
Closes#16292
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16292 from elvisdukaj:fix/macros_conflict_with_android_ndk 4c3801cf17
PiperOrigin-RevId: 622422810
These are already supported, but this will lock down that there's no issues like the ones we hit with text-format.
This also fixes an unrelated bug in our BinaryToJsonString algorithm related to unknown group handling. We still can't actually test binary->JSON in conformance tests for extensions due to TypeResolver's lack of support though.
PiperOrigin-RevId: 622360970