diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2025-12-26 01:30:25 +0100 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2025-12-26 01:30:36 +0100 |
| commit | a3394b6a23fb66ccb7e588129d2465ef8ea26d30 (patch) | |
| tree | 555501e4ec4db330565263961d6358a64f4e0106 /usr.bin | |
| parent | ba0a11512237681fc621670023d56195cb8c82ad (diff) | |
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
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/m4/misc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c index 1870323ccb30..3091f2ad1f9e 100644 --- a/usr.bin/m4/misc.c +++ b/usr.bin/m4/misc.c @@ -120,7 +120,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; |
