Hi Lasse,

> The attached patch adds such tests to 21 modules. They shouldn't
> produce any warnings with -Wnonnull, which were a concern in the commit
> 15efa15b439e. With glibc 2.43 and GCC 16.1.1 with -O2, 15 tests fail:
> 
>     test-memccpy
>     test-memchr
>     test-memcmp
>     test-memcpy
>     test-memmove
>     test-memset
>     test-memset_explicit
>     test-qsort
>     test-strncat
>     test-strncmp
>     test-strncpy
>     test-strndup
>     test-wcsncat
>     test-wcsncmp
>     test-wcsncpy
> ...
> I have understood that glibc headers will be fixed. Old glibc versions
> might remain in use for years though

Right. We attempt to have no test failures in the Gnulib test suite on
various platforms. This typically means to #ifdef out some tests on some
platforms. As you found out, 15 out of 21 tests would need some corrections.
The consequences for the user would be that they should better NOT pass
null pointers to these functions. In summary, quite some effort for quite
little gain.

> so I looked for workaround ideas.
> I wish I hadn't.
> 
> glibc >= 2.34 && (GCC >= 15 || Clang):
> 
>     One could add
> 
>         #define __nonnull(param)

Please not. This would turn off the null-pointer checking for many other
functions.

> With Clang 22.1.8, one test fails:
> 
>     test-bsearch

Oh, interesting: clang appears to have its own database of function
declarations, instead of relying on the header files.

So, as I see it, only these parts of your patch would be useful:

+       * tests/test-wmemchr.c: Add the test null_wmemchr.
+       * tests/test-wmemcmp.c: Add the test null_wmemcmp.
+       * tests/test-wmemcpy.c: Add the test null_wmemcpy.
+       * tests/test-wmemmove.c: Add the test null_wmemmove.
+       * tests/test-wmemset.c: Add the test null_wmemset.

But for this part alone, we would also need copyright assignment papers from
you with the FSF [1][2].

Bruno

[1] https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html
[2] https://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html




Reply via email to