Page MenuHomeFreeBSD

bmake: Fix -Wunterminated-string-initialization
Needs ReviewPublic

Authored by arichardson on Sep 15 2025, 10:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 14, 6:31 PM
Unknown Object (File)
Wed, Oct 8, 9:33 PM
Unknown Object (File)
Fri, Oct 3, 3:06 AM
Unknown Object (File)
Wed, Oct 1, 6:30 AM
Unknown Object (File)
Tue, Sep 30, 7:59 AM
Unknown Object (File)
Sat, Sep 20, 3:38 PM
Unknown Object (File)
Fri, Sep 19, 11:31 AM
Unknown Object (File)
Wed, Sep 17, 10:29 PM
Subscribers

Details

Reviewers
sjg
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

Diff Detail

Repository
rG FreeBSD src repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 67062
Build 63945: arc lint + arc unit

Event Timeline

No need for a comment, I committed the following upstream:

Index: var.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/var.c,v
retrieving revision 1.1171
diff -u -p -r1.1171 var.c
--- var.c       29 Jun 2025 11:02:17 -0000      1.1171
+++ var.c       16 Sep 2025 15:13:28 -0000
@@ -1850,7 +1850,7 @@ QuoteShell(const char *str, bool quoteDo
 static char *
 Hash(const char *str)
 {
-       static const char hexdigits[16] = "0123456789abcdef";
+       static const char hexdigits[] = "0123456789abcdef";
        const unsigned char *ustr = (const unsigned char *)str;
 
        uint32_t h = 0x971e137bU;
In D52563#1200450, @sjg wrote:

No need for a comment, I committed the following upstream:

Index: var.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/var.c,v
retrieving revision 1.1171
diff -u -p -r1.1171 var.c
--- var.c       29 Jun 2025 11:02:17 -0000      1.1171
+++ var.c       16 Sep 2025 15:13:28 -0000
@@ -1850,7 +1850,7 @@ QuoteShell(const char *str, bool quoteDo
 static char *
 Hash(const char *str)
 {
-       static const char hexdigits[16] = "0123456789abcdef";
+       static const char hexdigits[] = "0123456789abcdef";
        const unsigned char *ustr = (const unsigned char *)str;
 
        uint32_t h = 0x971e137bU;

Perfect, thank you. Should I wait for this to find it's way to FreeBSD or apply the change locally?

Perfect, thank you. Should I wait for this to find it's way to FreeBSD or apply the change locally?

If you want to commit the same patch as upstream, that should not cause any merge conflict, but I'll likely import a new bmake within a week (ish) so unless this is causing trouble you could punt it to me.