The CI, now with gcc 14, reports a compilation error on Solaris 11 OmniOS:

In file included from ../../gltests/test-accept.c:21:
../../gltests/test-accept.c:22:18: error: initialization of 'int (*)(int,  
struct sockaddr *, socklen_t *)' {aka 'int (*)(int,  struct sockaddr *, 
unsigned int *)'} from incompatible pointer type 'int (*)(int,  struct sockaddr 
* restrict,  void *)' [-Wincompatible-pointer-types]
   22 | SIGNATURE_CHECK (accept, int, (int, struct sockaddr *, socklen_t *));
      |                  ^~~~~~

With older gcc versions, I see these warnings:

../../gltests/test-accept.c:22:18: warning: initialization of 'int (*)(int,  
struct sockaddr *, socklen_t *)' {aka 'int (*)(int,  struct sockaddr *, 
unsigned int *)'} from incompatible pointer type 'int (*)(int,  struct sockaddr 
* restrict,  void *)' [-Wincompatible-pointer-types]
../../gltests/test-gethostname.c:24:18: warning: initialization of 'int 
(*)(char *, size_t)' {aka 'int (*)(char *, long unsigned int)'} from 
incompatible pointer type 'int (*)(char *, int)' [-Wincompatible-pointer-types]
../../gltests/test-getpeername.c:22:18: warning: initialization of 'int 
(*)(int,  struct sockaddr *, socklen_t *)' {aka 'int (*)(int,  struct sockaddr 
*, unsigned int *)'} from incompatible pointer type 'int (*)(int,  struct 
sockaddr * restrict,  void *)' [-Wincompatible-pointer-types]
../../gltests/test-getsockname.c:22:18: warning: initialization of 'int 
(*)(int,  struct sockaddr *, socklen_t *)' {aka 'int (*)(int,  struct sockaddr 
*, unsigned int *)'} from incompatible pointer type 'int (*)(int,  struct 
sockaddr * restrict,  void *)' [-Wincompatible-pointer-types]
../../gltests/test-getsockopt.c:22:18: warning: initialization of 'int (*)(int, 
 int,  int,  void *, socklen_t *)' {aka 'int (*)(int,  int,  int,  void *, 
unsigned int *)'} from incompatible pointer type 'int (*)(int,  int,  int,  
void * restrict,  void *)' [-Wincompatible-pointer-types]
../../gltests/test-recvfrom.c:22:18: warning: initialization of 'ssize_t 
(*)(int,  void *, size_t,  int,  struct sockaddr *, socklen_t *)' {aka 'long 
int (*)(int,  void *, long unsigned int,  int,  struct sockaddr *, unsigned int 
*)'} from incompatible pointer type 'ssize_t (*)(int,  void * restrict,  
size_t,  int,  struct sockaddr * restrict,  void *)' {aka 'long int (*)(int,  
void * restrict,  long unsigned int,  int,  struct sockaddr * restrict,  void 
*)'} [-Wincompatible-pointer-types]

It's not worth working around these declarations (that are wrong w.r.t. POSIX),
because hardly anyone uses these functions through function pointers.
So, let me just document the problem and avoid a compilation error:


2025-01-24  Bruno Haible  <br...@clisp.org>

        tests: Fix a few compilation errors on Solaris 11 OmniOS with gcc 14.
        * tests/test-accept.c: Omit the signature check on Solaris.
        * tests/test-gethostname.c: Likewise.
        * tests/test-getpeername.c: Likewise.
        * tests/test-getsockname.c: Likewise.
        * tests/test-getsockopt.c: Likewise.
        * tests/test-recvfrom.c: Likewise.
        * doc/posix-functions/accept.texi: Mention the Solaris 11 OmniOS
        problem.
        * doc/posix-functions/gethostname.texi: Likewise.
        * doc/posix-functions/getpeername.texi: Likewise.
        * doc/posix-functions/getsockname.texi: Likewise.
        * doc/posix-functions/getsockopt.texi: Likewise.
        * doc/posix-functions/recvfrom.texi: Likewise.

diff --git a/doc/posix-functions/accept.texi b/doc/posix-functions/accept.texi
index d89de215d1..61bcc7fd4f 100644
--- a/doc/posix-functions/accept.texi
+++ b/doc/posix-functions/accept.texi
@@ -38,5 +38,5 @@
 @item
 On some platforms, this function's third argument type is @samp{void *},
 not @samp{socklen_t *}:
-Solaris 10.
+Solaris 10, Solaris 11 OmniOS.
 @end itemize
diff --git a/doc/posix-functions/gethostname.texi 
b/doc/posix-functions/gethostname.texi
index 73df5bd0bf..0c105e1c29 100644
--- a/doc/posix-functions/gethostname.texi
+++ b/doc/posix-functions/gethostname.texi
@@ -23,7 +23,7 @@
 @item
 This function's second argument type is @code{int} instead of @code{size_t}
 on some platforms:
-Solaris 10.
+Solaris 10, Solaris 11 OmniOS.
 @item
 If the given buffer is too small for the host name, some implementations
 fail with @code{EINVAL}, instead of returning a truncated host name.
diff --git a/doc/posix-functions/getpeername.texi 
b/doc/posix-functions/getpeername.texi
index a53c059dd9..d9c8daa55f 100644
--- a/doc/posix-functions/getpeername.texi
+++ b/doc/posix-functions/getpeername.texi
@@ -30,4 +30,8 @@
 @item
 Some platforms don't have a @code{socklen_t} type; in this case this function's
 third argument type is @samp{int *}.
+@item
+On some platforms, this function's third argument type is @samp{void *},
+not @samp{socklen_t *}:
+Solaris 11 OmniOS.
 @end itemize
diff --git a/doc/posix-functions/getsockname.texi 
b/doc/posix-functions/getsockname.texi
index 1e6c3981a2..a254da1096 100644
--- a/doc/posix-functions/getsockname.texi
+++ b/doc/posix-functions/getsockname.texi
@@ -30,4 +30,8 @@
 @item
 Some platforms don't have a @code{socklen_t} type; in this case this function's
 third argument type is @samp{int *}.
+@item
+On some platforms, this function's third argument type is @samp{void *},
+not @samp{socklen_t *}:
+Solaris 11 OmniOS.
 @end itemize
diff --git a/doc/posix-functions/getsockopt.texi 
b/doc/posix-functions/getsockopt.texi
index 41af61beee..8835303d1f 100644
--- a/doc/posix-functions/getsockopt.texi
+++ b/doc/posix-functions/getsockopt.texi
@@ -33,5 +33,9 @@
 Some platforms don't have a @code{socklen_t} type; in this case this function's
 fifth argument type is @samp{int *}.
 @item
+On some platforms, this function's fifth argument type is @samp{void *},
+not @samp{socklen_t *}:
+Solaris 11 OmniOS.
+@item
 Many socket options are not available on all platforms.
 @end itemize
diff --git a/doc/posix-functions/recvfrom.texi 
b/doc/posix-functions/recvfrom.texi
index 6edddbebdb..5ca7b525e7 100644
--- a/doc/posix-functions/recvfrom.texi
+++ b/doc/posix-functions/recvfrom.texi
@@ -30,4 +30,8 @@
 @item
 Some platforms don't have a @code{socklen_t} type; in this case this function's
 sixth argument type is @samp{int *}.
+@item
+On some platforms, this function's sixth argument type is @samp{void *},
+not @samp{socklen_t *}:
+Solaris 11 OmniOS.
 @end itemize
diff --git a/tests/test-accept.c b/tests/test-accept.c
index 01cb1984d8..2557d06e20 100644
--- a/tests/test-accept.c
+++ b/tests/test-accept.c
@@ -19,7 +19,9 @@
 #include <sys/socket.h>
 
 #include "signature.h"
+#if !defined __sun
 SIGNATURE_CHECK (accept, int, (int, struct sockaddr *, socklen_t *));
+#endif
 
 #include <errno.h>
 #include <netinet/in.h>
diff --git a/tests/test-gethostname.c b/tests/test-gethostname.c
index f1822deb73..c10bdc5370 100644
--- a/tests/test-gethostname.c
+++ b/tests/test-gethostname.c
@@ -21,7 +21,9 @@
 #include <unistd.h>
 
 #include "signature.h"
+#if !defined __sun
 SIGNATURE_CHECK (gethostname, int, (char *, size_t));
+#endif
 
 /* Get HOST_NAME_MAX definition.  */
 #include <limits.h>
diff --git a/tests/test-getpeername.c b/tests/test-getpeername.c
index 97d4a57785..24db394f1e 100644
--- a/tests/test-getpeername.c
+++ b/tests/test-getpeername.c
@@ -19,7 +19,9 @@
 #include <sys/socket.h>
 
 #include "signature.h"
+#if !defined __sun
 SIGNATURE_CHECK (getpeername, int, (int, struct sockaddr *, socklen_t *));
+#endif
 
 #include <errno.h>
 #include <netinet/in.h>
diff --git a/tests/test-getsockname.c b/tests/test-getsockname.c
index 9c75a43ce2..b5ad73a5d2 100644
--- a/tests/test-getsockname.c
+++ b/tests/test-getsockname.c
@@ -19,7 +19,9 @@
 #include <sys/socket.h>
 
 #include "signature.h"
+#if !defined __sun
 SIGNATURE_CHECK (getsockname, int, (int, struct sockaddr *, socklen_t *));
+#endif
 
 #include <stdio.h>
 #include <string.h>
diff --git a/tests/test-getsockopt.c b/tests/test-getsockopt.c
index 34698fd9db..0a8254ca06 100644
--- a/tests/test-getsockopt.c
+++ b/tests/test-getsockopt.c
@@ -19,7 +19,9 @@
 #include <sys/socket.h>
 
 #include "signature.h"
+#if !defined __sun
 SIGNATURE_CHECK (getsockopt, int, (int, int, int, void *, socklen_t *));
+#endif
 
 #include <errno.h>
 #include <unistd.h>
diff --git a/tests/test-recvfrom.c b/tests/test-recvfrom.c
index ccf606cba4..8bb839d87b 100644
--- a/tests/test-recvfrom.c
+++ b/tests/test-recvfrom.c
@@ -19,9 +19,10 @@
 #include <sys/socket.h>
 
 #include "signature.h"
+#if !defined __sun
 SIGNATURE_CHECK (recvfrom, ssize_t,
-                 (int, void *, size_t, int,
-                  struct sockaddr *, socklen_t *));
+                 (int, void *, size_t, int, struct sockaddr *, socklen_t *));
+#endif
 
 #include <errno.h>
 #include <netinet/in.h>




Reply via email to