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
F165186415: D54866.id170549.diff
Thu, Aug 6, 2:52 PM
F165146460: D54866.id170363.diff
Thu, Aug 6, 9:48 AM
Unknown Object (File)
Wed, Aug 5, 9:23 AM
Unknown Object (File)
Sat, Aug 1, 9:12 AM
Unknown Object (File)
Mon, Jul 27, 3:22 PM
Unknown Object (File)
Sun, Jul 26, 1:11 PM
Unknown Object (File)
Sat, Jul 25, 4:15 PM
Unknown Object (File)
Wed, Jul 22, 3:47 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 70121
Build 67004: arc lint + arc unit

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?