Repository navigation
[C/C++] Generate uint64 max lengths and counts as unsigned literals - #1141
Open
slachiewicz wants to merge 1 commit into
Open
slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
applicableMaxValue() holds the uint64 max as a negative long, so the E109 and E110 range checks compared an unsigned length or count against -2 and failed -Wsign-compare. They now use UINT64_C(0xfffffffffffffffe); the generated code for every other type is unchanged.
slachiewicz
marked this pull request as ready for review
October 23, 2026 20:37
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.
applicableMaxValue().longValue()holds the uint64 maximum as -2, so a schema with a uint64numInGroupor var-datalengthgenerates range checks such asstr.length() > -2andcount > -2LL. Those still work through the implicit conversion but fail-Wsign-compare. The checks now useUINT64_C(0xfffffffffffffffe); generated code for every other type is unchanged.uint64-length-schema.xmland a C and a C++ test cover the case.Verified: generated headers for the new schema with
-Wall -Wextra -Werror→ master 5 sign-compare errors in C++ and 1 in C, none with this change; ctest 23/23 under ASan/UBSan.