Collin Funk wrote:
> 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].

Thanks for both.

In fact, since POSIX [1] says "The application shall not modify the string
returned.", Haiku's non-standard prototype makes sense. It would be useful
if POSIX at some point changed the return type to 'const char *', and likewise
for the *gettext() functions (cf. [2]).

Bruno

[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/strsignal.html
[2] https://lists.gnu.org/archive/html/bug-gettext/2025-04/msg00006.html




Reply via email to