[parted-devel] [PATCH] build: mark functions with const attribute, per gcc warnings

Rudi Heitbaum rudi at heitbaum.com
Sun Feb 15 09:50:05 GMT 2026


fixes warning since glibc-2.43

For ISO C23, the functions wcschr that return pointers into their
input arrays now have definitions as macros that return a pointer
to a const-qualified type when the input argument is a pointer to a
const-qualified type.

../../parted/strlist.c: In function 'wchar_strchr':
../../parted/strlist.c:61:16: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   61 |         return wcschr (str, ch);
      |                ^~~~~~

Signed-off-by: Rudi Heitbaum <rudi at heitbaum.com>
---
 parted/strlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parted/strlist.c b/parted/strlist.c
index c4cb351..977bc07 100644
--- a/parted/strlist.c
+++ b/parted/strlist.c
@@ -54,7 +54,7 @@ wchar_strlen (const wchar_t* str)
 #endif
 }
 
-static wchar_t * _GL_ATTRIBUTE_PURE
+static const wchar_t * _GL_ATTRIBUTE_PURE
 wchar_strchr (const wchar_t* str, char ch)
 {
 #ifdef ENABLE_NLS
-- 
2.51.0




More information about the parted-devel mailing list