Collin Funk <[email protected]> writes:
> * All supported AF_* constants must have distinct values.
Oops. Small mistake in my test for this. I wrote:
switch (0)
{
case AF_UNSPEC:
#if HAVE_IPV4
case AF_INET:
#endif
#if HAVE_IPV6
case AF_INET6:
#endif
#if HAVE_UNIXSOCKET
case AF_UNIX:
#endif
default:
break;
}
I had assumed these macros were defined since sys_socket depends on
m4/sockpfaf.m4. However, the module doesn't invoke gl_SOCKET_FAMILIES.
It seems to be included for inet_ntop, freeaddrinfo, or any future
module that needs it.
This patch invokes gl_SOCKET_FAMILIES in the test module so they are
defined and the test is no longer a no-op. Tested on Fedora 40 and
Mingw.
Collin
>From ae5bf924106de21307a29641aa024234d7b1f117 Mon Sep 17 00:00:00 2001
From: Collin Funk <[email protected]>
Date: Tue, 23 Jul 2024 19:31:22 -0700
Subject: [PATCH] sys_socket tests: Define macros necessary for tests (regr.
2024-07-22).
* modules/sys_socket-tests (configure.ac): Invoke gl_SOCKET_FAMILIES.
---
ChangeLog | 3 +++
modules/sys_socket-tests | 1 +
2 files changed, 4 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index cf51073474..3730873e91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2024-07-23 Collin Funk <[email protected]>
+ sys_socket tests: Define macros necessary for tests (regr. 2024-07-22).
+ * modules/sys_socket-tests (configure.ac): Invoke gl_SOCKET_FAMILIES.
+
sys_socket tests: Improve checks for socklen_t and sa_family_t.
* modules/sys_socket-tests (Depends-on): Add intprops.
* tests/test-sys_socket.c: Check that socklen_t is at least 32 bits
diff --git a/modules/sys_socket-tests b/modules/sys_socket-tests
index 0e0ef6c45e..d55b9ce51b 100644
--- a/modules/sys_socket-tests
+++ b/modules/sys_socket-tests
@@ -8,6 +8,7 @@ sys_socket-c++-tests
configure.ac:
AC_CHECK_FUNCS_ONCE([shutdown])
+gl_SOCKET_FAMILIES
Makefile.am:
TESTS += test-sys_socket
--
2.45.2