Repository navigation
Conversation
Messages in caller-provided buffers now stay inside the buffer when it runs out of space: - TryCreateMutable returns InvalidArgument for a buffer smaller than its header and ResourceExhausted when the message does not fit. CreateMutable aborts in those cases. - Setters and repeated fields keep their previous contents. mutable_, add_ and array element accessors return a detached handle whose writes go to per-thread scratch storage. - AllocationFailed() reports the failure. Serialize then fails, Deserialize returns ResourceExhausted, and CreateReadonly treats the buffer as empty. - Placeholder string handles ignore assignment instead of dereferencing null. The runtime and generated code build with -fno-exceptions -fno-rtti, where misuse that would throw aborts instead. fixed_buffer_test builds and parses messages in every buffer size up to 4 KB under those flags and checks that nothing is written past the end of the buffer. Requires cpp_toolbelt 2.1.6, pinned with a git_override until it is in the Bazel Central Registry.
…ions, add a CMake build - Emit top-level messages after the same-file messages their fields (and their nested messages' fields) use, so a message can use one defined later in the .proto file. - When a message has fields named both <name> and has_<name>, name <name>'s presence accessor _phaser_has_<name>() so it doesn't collide with the has_<name> field's getter. - Add CMakeLists.txt: the phaser_runtime library, the protoc-gen-phaser plugin (host builds only; cross-compiles take PHASER_PLUGIN_EXECUTABLE), and phaser_add_library() to generate and build a library like phaser_library. - Add generator_edge_cases_test covering both generator fixes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Messages built in caller-provided buffers now stay inside the buffer when it runs out of space, and phaser builds with
-fno-exceptions -fno-rtti. The generator handles two cases thatsubspace.protoneeds, and a CMake build is added so projects outside Bazel can use phaser.Full fixed buffers (e7e15f7)
TryCreateMutablereturnsInvalidArgumentfor a buffer smaller than its header andResourceExhaustedwhen the message doesn't fit.CreateMutableaborts in those cases.mutable_,add_and array element accessors return a detached handle whose writes go to per-thread scratch storage.AllocationFailed()reports the failure.Serializethen fails,DeserializereturnsResourceExhausted, andCreateReadonlytreats the buffer as empty.Generator fixes (3d5eca6)
.protofile.<name>andhas_<name>, the presence accessor for<name>is_phaser_has_<name>(), so it doesn't collide with thehas_<name>getter.CMake build (3d5eca6)
CMakeLists.txtbuildsphaser_runtimeandprotoc-gen-phaser, and definesphaser_add_library(), which generates and builds a library like the Bazelphaser_libraryrule, short header included.FetchContent.PHASER_PLUGIN_EXECUTABLE.Dependencies
Requires cpp_toolbelt 2.1.6 (dallison/cpp_toolbelt
asilbranch), pinned with agit_overrideto commit86b45cduntil it is in the Bazel Central Registry.Testing
bazelisk test //phaser/...: all 25 tests pass, including:fixed_buffer_test: builds and parses messages in every buffer size up to 4 KB with-fno-exceptions -fno-rtti, and checks that nothing is written past the end.generator_edge_cases_test: fails to compile without the generator fixes.