On Cygwin, I see: In file included from test-tsearch.c:22: test-tsearch.c:25:18: warning: initialization of 'void * (*)(const void *, void * const*, int (*)(const void *, const void *))' from incompatible pointer type 'void * (*)(const void *, void **, int (*)(const void *, const void *))' [-Wincompatible-pointer-types] 25 | SIGNATURE_CHECK (tfind, void *, (void const *, void * const *, | ^~~~~ signature.h:46:57: note: in definition of macro 'SIGNATURE_CHECK2' 46 | _GL_UNUSED static ret (*signature_check ## id) args = fn | ^~ signature.h:39:3: note: in expansion of macro 'SIGNATURE_CHECK1' 39 | SIGNATURE_CHECK1 (fn, ret, args, __LINE__) | ^~~~~~~~~~~~~~~~ test-tsearch.c:25:1: note: in expansion of macro 'SIGNATURE_CHECK' 25 | SIGNATURE_CHECK (tfind, void *, (void const *, void * const *, | ^~~~~~~~~~~~~~~
This is because Cygwin's tfind function is missing a 'const' qualifier. I have written to the Cygwin list in hopes they fix this since it will cause annoying -Wdiscarded-qualifiers warnings in applications that expect the POSIX prototype [1]. Pushed the attached patch to disable the signature check and document the differing prototype. Collin [1] https://cygwin.com/pipermail/cygwin/2025-April/258032.html
>From 30c887298af4a59915c98524f7a1909e4d6e874c Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Wed, 23 Apr 2025 20:29:25 -0700 Subject: [PATCH] tsearch tests: Disable tfind signature check on Cygwin. * tests/test-tsearch.c [__CYGWIN__]: Skip the tfind signature check. * doc/posix-functions/tfind.texi: Mention the Cygwin signature. --- ChangeLog | 6 ++++++ doc/posix-functions/tfind.texi | 5 +++++ tests/test-tsearch.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3ee1063908..26d9817c59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-04-23 Collin Funk <collin.fu...@gmail.com> + + tsearch tests: Disable tfind signature check on Cygwin. + * tests/test-tsearch.c [__CYGWIN__]: Skip the tfind signature check. + * doc/posix-functions/tfind.texi: Mention the Cygwin signature. + 2025-04-22 Collin Funk <collin.fu...@gmail.com> random_r tests: Disable signature check on Haiku. diff --git a/doc/posix-functions/tfind.texi b/doc/posix-functions/tfind.texi index 60f76605ea..225b51f02b 100644 --- a/doc/posix-functions/tfind.texi +++ b/doc/posix-functions/tfind.texi @@ -16,4 +16,9 @@ @node tfind Portability problems not fixed by Gnulib: @itemize +@item +This function uses @code{void **} instead of @code{void *const *} for +the second parameter on some platforms: +@c https://cygwin.com/pipermail/cygwin/2025-April/258032.html +Cygwin. @end itemize diff --git a/tests/test-tsearch.c b/tests/test-tsearch.c index 292ff0d3ad..ea41505dd6 100644 --- a/tests/test-tsearch.c +++ b/tests/test-tsearch.c @@ -22,8 +22,10 @@ #include "signature.h" SIGNATURE_CHECK (tdelete, void *, (void const *, void **, int (*) (void const *, void const *))); +#if !defined __CYGWIN__ SIGNATURE_CHECK (tfind, void *, (void const *, void * const *, int (*) (void const *, void const *))); +#endif SIGNATURE_CHECK (tsearch, void *, (void const *, void **, int (*) (void const *, void const *))); SIGNATURE_CHECK (twalk, void, (void const *, -- 2.49.0