On HP-UX 11.11, I'm seeing these gcc warnings: test-select-fd.c:47: warning: implicit declaration of function 'memset' test-select-fd.c:47: warning: incompatible implicit declaration of built-in function 'memset' test-select-stdin.c:44: warning: implicit declaration of function 'memset' test-select-stdin.c:44: warning: incompatible implicit declaration of built-in function 'memset' test-sys_select.c:32: warning: implicit declaration of function 'memset' test-sys_select.c:32: warning: incompatible implicit declaration of built-in function 'memset'
The reason is that the system's <sys/time.h> defines FD_ZERO to a macro that uses memset(), but does not include <string.h>. This fixes it: 2010-12-31 Bruno Haible <[email protected]> sys_select: Avoid warning about missing memset declaration on HP-UX 11. * lib/sys_select.in.h: On HP-UX, include also <string.h>. --- lib/sys_select.in.h.orig Fri Dec 31 15:46:54 2010 +++ lib/sys_select.in.h Fri Dec 31 15:46:38 2010 @@ -72,6 +72,11 @@ /* Get the 'struct timeval' and 'fd_set' types and the FD_* macros on most platforms. */ # include <sys/time.h> +/* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation + that relies on memset(), but without including <string.h>. */ +# if defined __hpux +# include <string.h> +# endif /* On native Windows platforms: Get the 'fd_set' type. Also, gnulib's <sys/socket.h> redefines select so as to hide the declaration from <winsock2.h>. */
