From: Cristian Rodríguez Date: Tue, 8 Apr 2025 13:41:36 +0000 (-0400) Subject: disk-utils: add attribute nonstring to bfs byte arrays X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=995a4e2341f699e9eb7f2e2c529e1c8802a61170;p=thirdparty%2Futil-linux.git disk-utils: add attribute nonstring to bfs byte arrays GCC15 requires to annotate such fields as nonstrings or a warning is now issued that they are missing the ending null. --- diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c index d18589ab2..30c28d9e7 100644 --- a/disk-utils/mkfs.bfs.c +++ b/disk-utils/mkfs.bfs.c @@ -48,8 +48,8 @@ struct bfssb { int32_t s_backup_from, s_backup_to; /* labels - may well contain garbage */ - char s_fsname[6]; - char s_volume[6]; + char s_fsname[6] __ul_nonstring; + char s_volume[6] __ul_nonstring; char s_pad[472]; }; diff --git a/include/c.h b/include/c.h index e0148e019..50e34a120 100644 --- a/include/c.h +++ b/include/c.h @@ -153,6 +153,12 @@ C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough # define __ul_returns_nonnull #endif +#if __has_attribute(__nonstring__) +# define __ul_nonstring __attribute__((__nonstring__)) +#else +# define __ul_nonstring +#endif + /* * Force a compilation error if condition is true, but also produce a * result (of value 0 and type size_t), so the expression can be used