* getlogin_r tests: Fix compilation error on some OpenSolaris derivatives
@ 2024-04-19 23:15 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-04-19 23:15 UTC (permalink / raw
To: bug-gnulib
Building a testdir on Solaris 11 SmartOS
(with CC="clang -O2 -D_XOPEN_SOURCE=700"), I see a compilation error:
../../gltests/test-getlogin_r.c:24:1: error: incompatible function pointer types initializing 'int (*)(char *, size_t)' (aka 'int (*)(char *, unsigned long)') with an expression of type 'int (char *, int)' [-Wincompatible-function-pointer-types]
SIGNATURE_CHECK (getlogin_r, int, (char *, size_t));
^ ~~~~~~~~~~
../../gltests/signature.h:39:3: note: expanded from macro 'SIGNATURE_CHECK'
SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
^ ~~
../../gltests/signature.h:44:3: note: expanded from macro 'SIGNATURE_CHECK1'
SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */
^ ~~
../../gltests/signature.h:46:27: note: expanded from macro 'SIGNATURE_CHECK2'
_GL_UNUSED static ret (*signature_check ## id) args = fn
^ ~~
<scratch space>:115:1: note: expanded from here
signature_check24
^
1 error generated.
gmake[4]: *** [Makefile:25729: test-getlogin_r.o] Error 1
Unlike the similar errors for the functions accept, gethostname, getpeername,
getsockname, getsockopt, recvfrom, which go away by -D_XOPEN_SOURCE=700, this
one persists. Here's a workaround.
2024-04-19 Bruno Haible <bruno@clisp.org>
getlogin_r tests: Fix compilation error on some OpenSolaris derivatives.
* tests/test-getlogin_r.c (getlogin_r): Don't check the signature on
Solaris.
diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c
index 73526bc1a9..e74aae3306 100644
--- a/tests/test-getlogin_r.c
+++ b/tests/test-getlogin_r.c
@@ -21,7 +21,9 @@
#include <unistd.h>
#include "signature.h"
+#if !defined __sun /* On Solaris, the second parameter is of type 'int'. */
SIGNATURE_CHECK (getlogin_r, int, (char *, size_t));
+#endif
#include "test-getlogin.h"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-19 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-19 23:15 getlogin_r tests: Fix compilation error on some OpenSolaris derivatives Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).