Skip to content

Commit 277772d

Browse files
committed
bmake: Fix -Wunterminated-string-initialization
Summary: This is not used as a string, don't warn about missing NUL terminator. Silence -Wunterminated-string-initialization warning by adding 1 to size. We can't use __nonstring unconditionally in bmake since the bmake bootstrap headers don't define it. MFC after: 1 week Test Plan: compiles with clang HEAD Reviewers: sjg Subscribers: imp Differential Revision: https://reviews.freebsd.org/D52563
1 parent 8b205e8 commit 277772d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

contrib/bmake/var.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,13 @@ QuoteShell(const char *str, bool quoteDollar, LazyBuf *buf)
18661866
static char *
18671867
Hash(const char *str)
18681868
{
1869-
static const char hexdigits[16] = "0123456789abcdef";
1869+
/*
1870+
* Temporary FreeBSD diff: Disable -Wunterminated-string-initialization
1871+
* warning by adding 1 to size. We can't use __nonstring unconditionally
1872+
* in bmake since the bmake bootstrap headers don't define it.
1873+
* TODO: add the __nonstring attribute and change size back to 16.
1874+
*/
1875+
static const char hexdigits[16 + 1] = "0123456789abcdef";
18701876
const unsigned char *ustr = (const unsigned char *)str;
18711877

18721878
uint32_t h = 0x971e137bU;

0 commit comments

Comments
 (0)