From: Bruno Haible <bruno@clisp.org>
Date: Wed, 24 Jul 2024 23:21:45 +0000 (+0200)
Subject: Avoid false sendto_used_without_requesting_gnulib_module_sendto.
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=01c5908efce5837e3226e1e2dd0a5a35a4e26e5f;p=gnulib.git

Avoid false sendto_used_without_requesting_gnulib_module_sendto.

* modules/sendto (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (sendto): Don't define to
sendto_used_without_requesting_gnulib_module_sendto if the gnulib module
'sendto' is in use under the same configure.ac.
---

diff --git a/ChangeLog b/ChangeLog
index 3027c6eacc..9a53cb3afc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-07-24  Bruno Haible  <bruno@clisp.org>
 
+	Avoid false sendto_used_without_requesting_gnulib_module_sendto.
+	* modules/sendto (configure.ac): Invoke gl_MODULE_INDICATOR.
+	* lib/sys_socket.in.h (sendto): Don't define to
+	sendto_used_without_requesting_gnulib_module_sendto if the gnulib module
+	'sendto' is in use under the same configure.ac.
+
 	Avoid false recvfrom_used_without_requesting_gnulib_module_recvfrom.
 	* modules/recvfrom (configure.ac): Invoke gl_MODULE_INDICATOR.
 	* lib/sys_socket.in.h (recvfrom): Don't define to
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index f8ed41d8ec..518a25e62c 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -663,8 +663,10 @@ _GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
 # endif
 _GL_CXXALIASWARN (sendto);
 #elif @HAVE_WINSOCK2_H@
-# undef sendto
-# define sendto sendto_used_without_requesting_gnulib_module_sendto
+# if !GNULIB_SENDTO
+#  undef sendto
+#  define sendto sendto_used_without_requesting_gnulib_module_sendto
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef sendto
 # if HAVE_RAW_DECL_SENDTO
diff --git a/modules/sendto b/modules/sendto
index a5d4d5702c..56cee15fc4 100644
--- a/modules/sendto
+++ b/modules/sendto
@@ -15,6 +15,7 @@ configure.ac:
 AC_REQUIRE([gl_SYS_SOCKET_H])
 gl_CONDITIONAL([GL_COND_OBJ_SENDTO], [test "$ac_cv_header_winsock2_h" = yes])
 gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
+gl_MODULE_INDICATOR([sendto])
 
 Makefile.am:
 if GL_COND_OBJ_SENDTO