sys_socket: better 'inline'
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Nov 2012 06:25:06 +0000 (22:25 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 Nov 2012 07:38:51 +0000 (23:38 -0800)
* 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.

ChangeLog
lib/sys_socket.c [new file with mode: 0644]
lib/sys_socket.in.h
m4/sys_socket_h.m4
modules/sys_socket

index 5692442a7c43f8d1b2167d9a2c515f68179377b6..1869b71a765ecf498d03040255df40272ae79ef5 100644 (file)
--- 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):
diff --git a/lib/sys_socket.c b/lib/sys_socket.c
new file mode 100644 (file)
index 0000000..3f017f8
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
+#include "sys/socket.h"
index c9157d3d9a805d28d7d2bd72ba91bfcb0bea7670..2b4c93fab3bae9b9905d55d4eb484d369a1cc870 100644 (file)
 #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 @@ struct msghdr {
 
 /* 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 @@ _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
 # endif
 #endif
 
+_GL_INLINE_HEADER_END
+
 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
 #endif
index 8d4e7e1ebb42b5f29cc934e3e0d959bad7c88749..acfae4132834e09c0a713a42b916715d5af35aae 100644 (file)
@@ -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_DEFUN([gl_HEADER_SYS_SOCKET],
 [
   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')
index 704f2a5111de34ab8cb16b78b155e60ac87f4478..df78751fdc988c8081b8853e4e216246f6ff737a 100644 (file)
@@ -2,12 +2,14 @@ Description:
 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 @@ AC_PROG_MKDIR_P
 
 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.