On Solaris 11.4, I see this compilation error:
../../gltests/test-sys_socket-h.c: In function 'main':
../../gltests/test-sys_socket-h.c:169:10: error: 'MSG_CMSG_CLOFORK' undeclared
(first use in this function); did you mean 'SOCK_CLOFORK'?
case MSG_CMSG_CLOFORK:
^~~~~~~~~~~~~~~~
SOCK_CLOFORK
../../gltests/test-sys_socket-h.c:169:10: note: each undeclared identifier is
reported only once for each function it appears in
gmake[4]: *** [Makefile:27884: test-sys_socket-h.o] Error 1
This patch fixes it.
2025-01-24 Bruno Haible <[email protected]>
sys_socket-h tests: Avoid compilation error on Solaris 11.4.
* doc/posix-headers/sys_socket.texi: Update.
* tests/test-sys_socket-h.c (main): Don't assume that all platforms that
have SOCK_CLOFORK also have MSG_CMSG_CLOFORK.
diff --git a/doc/posix-headers/sys_socket.texi
b/doc/posix-headers/sys_socket.texi
index 944f752183..f4f68b22f9 100644
--- a/doc/posix-headers/sys_socket.texi
+++ b/doc/posix-headers/sys_socket.texi
@@ -81,7 +81,11 @@
the constant @code{SCM_RIGHTS} on some platforms:
mingw, MSVC 14.
@item
-This header file does not define the constants @code{SOCK_CLOFORK} and
-@code{MSG_CMSG_CLOFORK} on some platforms:
+This header file does not define the constant @code{SOCK_CLOFORK}
+on some platforms:
glibc 2.39, musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Solaris 11.3,
Cygwin, mingw, MSVC, Android.
+@item
+This header file does not define the constant @code{MSG_CMSG_CLOFORK}
+on some platforms:
+glibc 2.39, musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Solaris 11.4,
Cygwin, mingw, MSVC, Android.
@end itemize
diff --git a/tests/test-sys_socket-h.c b/tests/test-sys_socket-h.c
index 5644f141a8..fffd44ecad 100644
--- a/tests/test-sys_socket-h.c
+++ b/tests/test-sys_socket-h.c
@@ -165,7 +165,7 @@ main (void)
#ifdef MSG_CMSG_CLOEXEC
case MSG_CMSG_CLOEXEC:
#endif
-#ifdef SOCK_CLOFORK
+#ifdef MSG_CMSG_CLOFORK
case MSG_CMSG_CLOFORK:
#endif
case MSG_DONTROUTE: