-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GCC 15 Wunterminated-string-initialization issues
When building with the upcoming GCC 15, we are hit by the new Wunterminated-string-initialization compiler warning (however, due to -Werror, this is a build failure). E.g. src/nxt_string.c: In function ‘nxt_encode_uri’: src/nxt_string.c:601:36: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 601 | static const u_char hex[16] = "0123456789ABCDEF"; | ^~~~~~~~~~~~~~~~~~ We have created a character array containing 16 elements, but is not NUL terminated. While this type of (lookup/translation table) use case is perfectly valid and we could simply disable the warning, it is probably still a useful warning to have enabled. There is a 'nonstring' attribute, but that doesn't influence this warning. Lets just do what nginx does and create them NUL terminated. Except in src/nxt_http_parse.c where they *really* want to be non-NUL terminated and we use *arrays* of chars. Signed-off-by: Andrew Clayton <[email protected]>
- Loading branch information
Showing
3 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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