GCC documentation states: The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug, such as realloc. However, so far as I can see, ignoring the return value of mblen is never a security problem and is sometimes appropriate (the first call to the function is often mblen(NULL, 0), the result value of which is usually of no interest). (This is also reported as Debian #674917, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674917. The Debian report logs include a patch, not by me.)
Same argument also applies for mbtowc and wctomb. Is this ok? index fc83f4e..2153bc6 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -856,14 +856,14 @@ extern int qfcvt_r (long double __value, int __ndigit, __BEGIN_NAMESPACE_STD /* Return the length of the multibyte character in S, which is no longer than N. */ -extern int mblen (const char *__s, size_t __n) __THROW __wur; +extern int mblen (const char *__s, size_t __n) __THROW; /* Return the length of the given multibyte character, putting its `wchar_t' representation in *PWC. */ extern int mbtowc (wchar_t *__restrict __pwc, - const char *__restrict __s, size_t __n) __THROW __wur; + const char *__restrict __s, size_t __n) __THROW; /* Put the multibyte character represented by WCHAR in S, returning its length. */ -extern int wctomb (char *__s, wchar_t __wchar) __THROW __wur; +extern int wctomb (char *__s, wchar_t __wchar) __THROW;
Fixed on master.