Commit 486c64c
committed
rtld, libthr: Use
With Clang 21 at least, we start to get warnings like:
```
rtld.c:333:58: error: initializer-string for character array is too long, array size is 4 but initializer has size 5 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
333 | static const char rtld_utrace_sig[RTLD_UTRACE_SIG_SZ] = RTLD_UTRACE_SIG;
| ^~~~~~~~~~~~~~~
./rtld_utrace.h:49:27: note: expanded from macro 'RTLD_UTRACE_SIG'
49 | #define RTLD_UTRACE_SIG "RTLD"
|
```
Looking up the `nonstring` attribute [1], it does seem to be the correct
thing --- indicating a char array which should not have a null
terminator byte --- to use in these two cases.
Note: I discovered this when fixing Nixpkgs's FreeBSD cross compilation
support. I understand that FreeBSD may not officially support this
version of Clang yet, but I am hoping the attribute still works with the
version of Clang it does support (even if it not yet needed on that
version to fix `-Werror` errors). I am hoping thus that this patch is
accessible, as just early readiness for when FreeBSD does upgrade to
that version of Clang.
[1]: https://clang.llvm.org/docs/AttributeReference.html#nonstringnonstring attribute to silence compiler warning1 parent b502a45 commit 486c64c
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| |||
0 commit comments