-Wunterminated-string-initialization warning with GCC 15 in object-file.c
- From
Sam James <sam@gentoo.org>
- Date
- Nov 17, 2024, 02:50 UTC
- Message-ID
- <87wmh2o9og.fsf@gentoo.org>
With upcoming GCC 15, a new warning is added
(-Wunterminated-string-initialization) that fires when building git:
```
CC object-file.o
object-file.c:52:9: warning: initializer-string for array of ‘unsigned char’ is too long [-Wunterminated-string-initialization]
52 | "\x6e\xf1\x9b\x41\x22\x5c\x53\x69\xf1\xc1" \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
object-file.c:79:17: note: in expansion of macro ‘EMPTY_TREE_SHA256_BIN_LITERAL’
79 | .hash = EMPTY_TREE_SHA256_BIN_LITERAL,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
object-file.c:61:9: warning: initializer-string for array of ‘unsigned char’ is too long [-Wunterminated-string-initialization]
61 | "\x47\x3a\x0f\x4c\x3b\xe8\xa9\x36\x81\xa2" \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
object-file.c:83:17: note: in expansion of macro ‘EMPTY_BLOB_SHA256_BIN_LITERAL’
83 | .hash = EMPTY_BLOB_SHA256_BIN_LITERAL,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```Context for the new warning is at https://gcc.gnu.org/PR115185.
thanks, sam