changeset 10591:9a7657d2031f

Add a link warning when the 'select' module is not used.
author Bruno Haible <bruno@clisp.org>
date Mon, 06 Oct 2008 01:10:08 +0200
parents 666da211ee85
children 535c41e25ab1
files ChangeLog lib/sys_select.in.h modules/sys_select
diffstat 3 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-05  Bruno Haible  <bruno@clisp.org>
+
+	* lib/sys_select.in.h: Include the GL_LINK_WARNING definition.
+	(select): Add a link warning when the 'select' module is not used.
+	* modules/sys_select (Depends-on): Add link-warning.
+	(Makefile.am): Substitute the definition of GL_LINK_WARNING.
+	Suggested by Paolo Bonzini.
+
 2008-10-05  Jim Meyering  <meyering@redhat.com>
 
 	bootstrap: check for LT_INIT more portably
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -43,25 +43,31 @@
 
 # include <sys/socket.h>
 
-# if @HAVE_WINSOCK2_H@
+/* The definition of GL_LINK_WARNING is copied here.  */
 
-#  ifdef __cplusplus
+# ifdef __cplusplus
 extern "C" {
-#  endif
+# endif
 
-#  if @GNULIB_SELECT@
+# if @GNULIB_SELECT@
+#  if @HAVE_WINSOCK2_H@
 #   undef select
 #   define select rpl_select
 extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
-#  else
-#   undef select
-#   define select select_used_without_requesting_gnulib_module_select
 #  endif
+# elif @HAVE_WINSOCK2_H@
+#  undef select
+#  define select select_used_without_requesting_gnulib_module_select
+# elif defined GNULIB_POSIXCHECK
+#  undef select
+#  define select(n,r,w,e,t) \
+     (GL_LINK_WARNING ("select is not always POSIX compliant - " \
+                       "use gnulib module for portability"), \
+      select (n, r, w, e, t))
+# endif
 
-#  ifdef __cplusplus
+# ifdef __cplusplus
 }
-#  endif
-
 # endif
 
 #endif
--- a/modules/sys_select
+++ b/modules/sys_select
@@ -7,6 +7,7 @@
 
 Depends-on:
 include_next
+link-warning
 sys_socket
 sys_time
 
@@ -29,6 +30,7 @@
 	      -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
 	      -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
 	      -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
 	      < $(srcdir)/sys_select.in.h; \
 	} > $@-t
 	mv $@-t $@