Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions auto/cc/test
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ case $NXT_CC_NAME in

NXT_CFLAGS="$NXT_CFLAGS -Wmissing-prototypes"

# Disable Wunterminated-string-initialization temporarily.
# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178#c21>
NXT_CFLAGS="$NXT_CFLAGS -Wno-unterminated-string-initialization"

# Stop on warning.
NXT_CFLAGS="$NXT_CFLAGS -Werror"

Expand Down
14 changes: 14 additions & 0 deletions auto/clang
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,17 @@ nxt_feature_test="static void f(void) __attribute__ ((__unused__));
return 0;
}"
. auto/feature


nxt_feature="GCC __attribute__ nonstring"
nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_NONSTRING
nxt_feature_run=
nxt_feature_incs=
nxt_feature_libs=
nxt_feature_test="int main(void) {
static const char str[3] __attribute__ ((__nonstring__)) =
\"ABC\";

return !!str[0];
}"
. auto/feature
11 changes: 11 additions & 0 deletions src/nxt_clang.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@
#endif


#if (NXT_HAVE_GCC_ATTRIBUTE_NONSTRING)

#define NXT_NONSTRING __attribute__((__nonstring__))

#else

#define NXT_NONSTRING

#endif


#if (NXT_HAVE_BUILTIN_POPCOUNT)

#define nxt_popcount __builtin_popcount
Expand Down
2 changes: 1 addition & 1 deletion src/nxt_http_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ nxt_http_parse_field_name(nxt_http_request_parse_t *rp, u_char **pos,
size_t len;
uint32_t hash;

static const u_char normal[256] nxt_aligned(64) =
static const u_char normal[256] NXT_NONSTRING nxt_aligned(64) =
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
/* \s ! " # $ % & ' ( ) * + , . / : ; < = > ? */
"\0\1\0\1\1\1\1\1\0\0\1\1\0" "-" "\1\0" "0123456789" "\0\0\0\0\0\0"
Expand Down
2 changes: 1 addition & 1 deletion src/nxt_http_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/nxt_sprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
nxt_sprintf_t spf;
nxt_file_name_t *fn;

static const u_char hexadecimal[16] = "0123456789abcdef";
static const u_char HEXADECIMAL[16] = "0123456789ABCDEF";
static const u_char hexadecimal[16] NXT_NONSTRING = "0123456789abcdef";
static const u_char HEXADECIMAL[16] NXT_NONSTRING = "0123456789ABCDEF";
static const u_char nan[] = "[nan]";
static const u_char null[] = "[null]";
static const u_char infinity[] = "[infinity]";
Expand Down
4 changes: 2 additions & 2 deletions src/nxt_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ nxt_encode_uri(u_char *dst, u_char *src, size_t length)
u_char *end;
nxt_uint_t n;

static const u_char hex[16] = "0123456789ABCDEF";
static const u_char hex[16] NXT_NONSTRING = "0123456789ABCDEF";

end = src + length;

Expand Down Expand Up @@ -644,7 +644,7 @@ nxt_encode_complex_uri(u_char *dst, u_char *src, size_t length)
u_char *reserved, *end, ch;
nxt_uint_t n;

static const u_char hex[16] = "0123456789ABCDEF";
static const u_char hex[16] NXT_NONSTRING = "0123456789ABCDEF";

reserved = (u_char *) "?#\0";

Expand Down
Loading