changeset 17173:69d9b9c93232

sys_socket: better 'inline' * lib/sys_socket.c: New file. * lib/sys_socket.in.h (_GL_SYS_SOCKET_INLINE): New macro. Replace all uses of 'static inline' with it. Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Do not require AC_C_INLINE. * modules/sys_socket (Files, lib_SOURCES): Add lib/sys_socket.c. (Depends-on): Add extern-inline.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 20 Nov 2012 22:25:06 -0800
parents 1980691d8f7e
children 263910906d80
files ChangeLog lib/sys_socket.c lib/sys_socket.in.h m4/sys_socket_h.m4 modules/sys_socket
diffstat 5 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-11-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+	sys_socket: better 'inline'
+	* lib/sys_socket.c: New file.
+	* lib/sys_socket.in.h (_GL_SYS_SOCKET_INLINE):
+	New macro.  Replace all uses of 'static inline' with it.
+	Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+	* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Do not require AC_C_INLINE.
+	* modules/sys_socket (Files, lib_SOURCES): Add lib/sys_socket.c.
+	(Depends-on): Add extern-inline.
+
 	stdio: better 'inline'
 	* lib/stdio.c: New file.
 	* lib/stdio.in.h (_GL_STDIO_INLINE):
new file mode 100644
--- /dev/null
+++ b/lib/sys_socket.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
+#include "sys/socket.h"
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -63,6 +63,11 @@
 #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
 #define _@GUARD_PREFIX@_SYS_SOCKET_H
 
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_SYS_SOCKET_INLINE
+# define _GL_SYS_SOCKET_INLINE _GL_INLINE
+#endif
+
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
@@ -201,7 +206,7 @@
 
 /* Re-define FD_ISSET to avoid a WSA call while we are not using
    network sockets.  */
-static inline int
+_GL_SYS_SOCKET_INLINE int
 rpl_fd_isset (SOCKET fd, fd_set * set)
 {
   u_int i;
@@ -677,6 +682,8 @@
 # endif
 #endif
 
+_GL_INLINE_HEADER_END
+
 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
 #endif
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 22
+# sys_socket_h.m4 serial 23
 dnl Copyright (C) 2005-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,6 @@
 [
   AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_REQUIRE([AC_C_INLINE])
 
   dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
   dnl old-style declarations (with return type 'int' instead of 'ssize_t')
--- a/modules/sys_socket
+++ b/modules/sys_socket
@@ -2,12 +2,14 @@
 A POSIX-like <sys/socket.h>.
 
 Files:
+lib/sys_socket.c
 lib/sys_socket.in.h
 m4/sys_socket_h.m4
 m4/sockpfaf.m4
 
 Depends-on:
 errno
+extern-inline
 include_next
 snippet/arg-nonnull
 snippet/c++defs
@@ -23,6 +25,7 @@
 
 Makefile.am:
 BUILT_SOURCES += sys/socket.h
+lib_SOURCES += sys_socket.c
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.