Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Dec 2025 12:24:02 +0000
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c765646beedb - stable/13 - m4: avoid warnings about too-long initializer strings
Message-ID:  <695272e2.31dc6.4a5dc520@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=c765646beedb49441f6fa782cf90a305417758f8

commit c765646beedb49441f6fa782cf90a305417758f8
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-12-26 00:30:25 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-12-29 12:20:37 +0000

    m4: avoid warnings about too-long initializer strings
    
    Mark `digits` as `__non_string`, to avoid warnings from clang 21 similar
    to:
    
        usr.bin/m4/misc.c:123:27: error: initializer-string for character array is too long, array size is 36 but initializer has size 37 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
          123 |         static char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
              |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    MFC after:      3 days
    
    (cherry picked from commit a3394b6a23fb66ccb7e588129d2465ef8ea26d30)
---
 usr.bin/m4/misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c
index 73ced384466c..7d2473f88168 100644
--- a/usr.bin/m4/misc.c
+++ b/usr.bin/m4/misc.c
@@ -121,7 +121,8 @@ pbnum(int n)
 void
 pbnumbase(int n, int base, int d)
 {
-	static char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
+	static char digits[36] __nonstring =
+	    "0123456789abcdefghijklmnopqrstuvwxyz";
 	unsigned int num;
 	int printed = 0;
 


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?695272e2.31dc6.4a5dc520>