grisu3: make hexdigits size explicit for GCC 15#373
Merged
Conversation
itsMarco-G
referenced
this pull request
Feb 24, 2026
GCC15 started issuing a warning for non-null terminated string initiaziotions (`unterminated-string-initialization`). Avoiding the error by letting the compiler append the NULL
Contributor
|
Thanks, this really shouldn't be necessary, but no harm done. |
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.
GCC 15 emits
-Wunterminated-string-initializationfor thehexdigitsdeclaration ingrisu3. In toolchains where warnings are treated as errors, this results in a build failure. This is reproducible in Zephyr and Executorch environments using GCC 15.The literal contains 16 characters plus the terminating
\0. Making the array size explicit avoids the diagnostic and makes the storage unambiguous:static char hexdigits[17] = "0123456789ABCDEF";This change:
• Explicitly accounts for the null terminator
• Resolves GCC 15 build failures when -Werror is enabled
• Introduces no functional change
Tested with GCC 15 in Zephyr based and Executorch based builds.