From 995a4e2341f699e9eb7f2e2c529e1c8802a61170 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cristian=20Rodr=C3=ADguez?= Date: Tue, 8 Apr 2025 09:41:36 -0400 Subject: [PATCH] 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. --- disk-utils/mkfs.bfs.c | 4 ++-- include/c.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) 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 -- 2.47.3