On Haiku I see the following warning: test-strsignal.c:24:18: warning: initialization of 'char * (*)(int)' from incompatible pointer type 'const char * (*)(int)' [-Wincompatible-pointer-types] 24 | SIGNATURE_CHECK (strsignal, char *, (int)); | ^~~~~~~~~ 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-strsignal.c:24:1: note: in expansion of macro 'SIGNATURE_CHECK' 24 | SIGNATURE_CHECK (strsignal, char *, (int)); | ^~~~~~~~~~~~~~~
I don't think the missing const is worth a workaround, so I have disabled the signature check and documented the bug. Reported to Haiku in case they want to comply with POSIX [1]. Collin [1] https://dev.haiku-os.org/ticket/19537
>From b05d9ebbc823972f568107c4ed9b79c6dfae496c Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Mon, 21 Apr 2025 20:35:08 -0700 Subject: [PATCH] strsignal tests: Disable signature check on Haiku. * tests/test-strsignal.c [__HAIKU__]: Skip signature check. * doc/posix-functions/strsignal.texi: Document that strsignal returns 'const char *' instead of 'char *' on Haiku. --- ChangeLog | 5 +++++ doc/posix-functions/strsignal.texi | 3 ++- tests/test-strsignal.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 69b6fd7a8d..89250b7739 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2025-04-21 Collin Funk <collin.fu...@gmail.com> + strsignal tests: Disable signature check on Haiku. + * tests/test-strsignal.c [__HAIKU__]: Skip signature check. + * doc/posix-functions/strsignal.texi: Document that strsignal returns + 'const char *' instead of 'char *' on Haiku. + getloadavg: Fix typo in previous commit. * lib/getloadavg.c (getloadavg): Remove '__' prefix from 'defined'. diff --git a/doc/posix-functions/strsignal.texi b/doc/posix-functions/strsignal.texi index 23881cf1b3..10bfdc519e 100644 --- a/doc/posix-functions/strsignal.texi +++ b/doc/posix-functions/strsignal.texi @@ -28,5 +28,6 @@ @node strsignal @itemize @item This function returns @code{const char *} instead of @code{char *} on some platforms: -cygwin 1.5.25. +@c https://dev.haiku-os.org/ticket/19537 +cygwin 1.5.25, Haiku. @end itemize diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c index 4ed4cc3e23..21f0e956fa 100644 --- a/tests/test-strsignal.c +++ b/tests/test-strsignal.c @@ -21,7 +21,9 @@ #include <string.h> #include "signature.h" +#if !defined __HAIKU__ SIGNATURE_CHECK (strsignal, char *, (int)); +#endif #include <signal.h> -- 2.49.0