summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_parse.h
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2025-03-18 05:09:31 +0000
committerAndrew Clayton <a.clayton@nginx.com>2025-03-20 15:28:19 +0000
commitd9c2fd793fe1e8c8fbfd7aec9af3482fa5f0dacc (patch)
tree2b841403cc96ae6f936eda056f90574c4a44adbe /src/nxt_http_parse.h
parent764ad73fc7e3cbbe48b259159340e063f7d7b082 (diff)
downloadunit-d9c2fd793fe1e8c8fbfd7aec9af3482fa5f0dacc.tar.gz
unit-d9c2fd793fe1e8c8fbfd7aec9af3482fa5f0dacc.tar.bz2
Tag various character arrays with NXT_NONSTRING
In Unit we have a number of character arrays which are intentionally not NUL terminated. With GCC 15 this static const char hex[16] = "0123456789ABCDEF"; will trigger a warning like $ gcc -Wextra -c nonstring.c nonstring.c: In function ‘hexit’: nonstring.c:9:37: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (17 chars into 16 available) [-Wunterminated-string-initialization] 9 | static const char hex[16] = "0123456789ABCDEF"; | ^~~~~~~~~~~~~~~~~~ By adding NXT_NONSTRING like static const char hex[16] NXT_NONSTRING = "0123456789ABCDEF"; we no longer get the warning. Cc: Alejandro Colomar <alx@kernel.org> Co-authored-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/nxt_http_parse.h')
-rw-r--r--src/nxt_http_parse.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nxt_http_parse.h b/src/nxt_http_parse.h
index 9e2f6fab..157dc47d 100644
--- a/src/nxt_http_parse.h
+++ b/src/nxt_http_parse.h
@@ -21,7 +21,7 @@ typedef struct nxt_http_fields_hash_s nxt_http_fields_hash_t;
typedef union {
- u_char str[8];
+ u_char str[8] NXT_NONSTRING;
uint64_t ui64;
struct {