Page MenuHomeFreeBSD

netbsd-tests t_regex_att: Use __nonstring for a non-string constant
ClosedPublic

Authored by jhb on Jan 25 2026, 4:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 11, 8:24 PM
Unknown Object (File)
Wed, Mar 11, 9:47 AM
Unknown Object (File)
Wed, Mar 11, 7:59 AM
Unknown Object (File)
Wed, Mar 11, 7:49 AM
Unknown Object (File)
Wed, Mar 11, 3:41 AM
Unknown Object (File)
Mon, Mar 9, 1:24 PM
Unknown Object (File)
Sat, Mar 7, 1:33 PM
Unknown Object (File)
Sat, Feb 28, 3:24 PM
Subscribers

Details

Summary

Fixes the following warning from GCC 15:

contrib/netbsd-tests/lib/libc/regex/t_regex_att.c:54:30: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (4 chars into 3 available) [-Werror=unterminated-string-initialization]

54 | static const char delim[3] = "\\\\\0";
   |                              ^~~~~~~~

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jan 25 2026, 10:35 AM

LGTM. Weird that I didn't see this one with clang 21, which also has the same warnings about __nonstring. But maybe I just didn't run this test?

Definitely could be contributed upstream.

Yeah, I have no idea why clang didn't warn about this one. I wonder if clang doesn't warn if the string ends with an explicit nul?