[PATCH] timer-time: fix linking order with pthreads/rt

2012-08-18 Thread Mike Frysinger
When statically linking pthreads with rt, the current order is:
-lpthread -lrt

But when statically linking, the -lpthread will be discarded as it
isn't used.  It needs to come after the -lrt.

* m4/timer_time.m4 (LIB_TIMER_TIME): Swap order of variables.
---
 m4/timer_time.m4 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
index d6e0efe..48fea11 100644
--- a/m4/timer_time.m4
+++ b/m4/timer_time.m4
@@ -33,7 +33,7 @@ AC_DEFUN([gl_TIMER_TIME],
  #endif
 #endif
   ],
-  [LIB_TIMER_TIME=$LIBMULTITHREAD $LIB_TIMER_TIME])
+  [LIB_TIMER_TIME=$LIB_TIMER_TIME $LIBMULTITHREAD])
 AC_CHECK_FUNCS([timer_settime])
   LIBS=$gl_saved_libs
 ])
-- 
1.7.9.7




avoiding 'static inline'

2012-08-18 Thread Paul Eggert
I recently added a bunch of static inline functions to Emacs,
and just for fun I tried changing them to plain 'static' to
see how much that would hurt performance.  To my surprise, it
made Emacs 14% faster on my standard Lisp benchmark (taking the nth
element of a long list).  It also shrank the size of the text segment
by 1.7%, which was not as much of a surprise.

Clearly I've been using 'static inline' too much.  Come to think of
it, these days there's little need for 'static inline' as opposed to
'static', since GCC and other modern compilers will inline 'static'
functions for you.  And apparently they do a better job if they're not
given bad advice by people who use the 'inline' keyword.

I'd like to install some changes to gnulib, so that its code does
not use 'static inline' in the modules that Emacs uses.  This is part
of a similar, larger change to Emacs proper.  These patches won't
affect extern inline functions, just static ones.

There are more opportunities for changes like this to gnulib, but
I thought I'd do these first and ask for comments.

The patches themselves will be in followup messages.



[PATCH 01/16] warn-on-use: do not depend on 'inline'

2012-08-18 Thread Paul Eggert
* build-aux/snippet/warn-on-use.h: Remove unnecessary 'inline'
from comment.
---
 ChangeLog   |6 ++
 build-aux/snippet/warn-on-use.h |2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 22e77db..f1a7bc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-18  Paul Eggert  egg...@cs.ucla.edu
+
+   warn-on-use: do not depend on 'inline'
+   * build-aux/snippet/warn-on-use.h: Remove unnecessary 'inline'
+   from comment.
+
 2012-08-17  Paul Eggert  egg...@cs.ucla.edu
 
test-parse-datetime: avoid glibc leap-second glitch
diff --git a/build-aux/snippet/warn-on-use.h b/build-aux/snippet/warn-on-use.h
index c7bea5d..abfcace 100644
--- a/build-aux/snippet/warn-on-use.h
+++ b/build-aux/snippet/warn-on-use.h
@@ -55,7 +55,7 @@
rather than issue the nice warning, but the end result of informing
the developer about their portability problem is still achieved):
#if HAVE_RAW_DECL_ENVIRON
-   static inline char ***rpl_environ (void) { return environ; }
+   static char ***rpl_environ (void) { return environ; }
_GL_WARN_ON_USE (rpl_environ, environ is not always properly declared);
# undef environ
# define environ (*rpl_environ ())
-- 
1.7.6.5




[PATCH 02/16] extern-inline: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* m4/extern-inline.m4 (gl_EXTERN_INLINE):
Do not require AC_C_INLINE.
(_GL_INLINE, _GL_EXTERN_INLINE)
[! (__GNUC__ ? __GNUC_STDC_INLINE__ : 199901L = __STDC_VERSION__)]:
Now 'static', not 'static inline'.  The 'inline' is just one more
portability hassle with pre-C99 compilers.  With GCC and Emacs and
the default optimization, 'static' generates significantly faster
code than 'static inline'.
---
 ChangeLog   |   10 ++
 m4/extern-inline.m4 |5 ++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f1a7bc6..157df9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   extern-inline: avoid 'static inline'
+   * m4/extern-inline.m4 (gl_EXTERN_INLINE):
+   Do not require AC_C_INLINE.
+   (_GL_INLINE, _GL_EXTERN_INLINE)
+   [! (__GNUC__ ? __GNUC_STDC_INLINE__ : 199901L = __STDC_VERSION__)]:
+   Now 'static', not 'static inline'.  The 'inline' is just one more
+   portability hassle with pre-C99 compilers.  With GCC and Emacs and
+   the default optimization, 'static' generates significantly faster
+   code than 'static inline'.
+
warn-on-use: do not depend on 'inline'
* build-aux/snippet/warn-on-use.h: Remove unnecessary 'inline'
from comment.
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 187a335..15349e4 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -7,7 +7,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_EXTERN_INLINE],
 [
-  AC_REQUIRE([AC_C_INLINE])
   AH_VERBATIM([extern_inline],
 [/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
_GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
@@ -30,8 +29,8 @@ AC_DEFUN([gl_EXTERN_INLINE],
  _Pragma (GCC diagnostic pop)
 # endif
 #else
-# define _GL_INLINE static inline
-# define _GL_EXTERN_INLINE static inline
+# define _GL_INLINE static
+# define _GL_EXTERN_INLINE static
 #endif
 
 #ifndef _GL_INLINE_HEADER_BEGIN
-- 
1.7.6.5




[PATCH 03/16] lstat: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/lstat.c (orig_lstat): Now static, not static inline.
* m4/lstat.m4 (gl_PREREQ_LSTAT): Do not require AC_C_INLINE.
---
 ChangeLog   |4 
 lib/lstat.c |2 +-
 m4/lstat.m4 |8 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 157df9d..66eb057 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   lstat: avoid 'static inline'
+   * lib/lstat.c (orig_lstat): Now static, not static inline.
+   * m4/lstat.m4 (gl_PREREQ_LSTAT): Do not require AC_C_INLINE.
+
extern-inline: avoid 'static inline'
* m4/extern-inline.m4 (gl_EXTERN_INLINE):
Do not require AC_C_INLINE.
diff --git a/lib/lstat.c b/lib/lstat.c
index db119a1..97fe6bb 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -35,7 +35,7 @@ typedef int dummy;
 # include sys/stat.h
 # undef __need_system_sys_stat_h
 
-static inline int
+static int
 orig_lstat (const char *filename, struct stat *buf)
 {
   return lstat (filename, buf);
diff --git a/m4/lstat.m4 b/m4/lstat.m4
index b7335bd..01b4eb9 100644
--- a/m4/lstat.m4
+++ b/m4/lstat.m4
@@ -1,4 +1,4 @@
-# serial 25
+# serial 26
 
 # Copyright (C) 1997-2001, 2003-2012 Free Software Foundation, Inc.
 #
@@ -27,11 +27,7 @@ AC_DEFUN([gl_FUNC_LSTAT],
 ])
 
 # Prerequisites of lib/lstat.c.
-AC_DEFUN([gl_PREREQ_LSTAT],
-[
-  AC_REQUIRE([AC_C_INLINE])
-  :
-])
+AC_DEFUN([gl_PREREQ_LSTAT], [:])
 
 AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
 [
-- 
1.7.6.5




[PATCH 04/16] crypto/md5: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/md5.c (set_uint32): Now static, not static inline.
* m4/md5.m4 (gl_MD5): Do not require AC_C_INLINE.
---
 ChangeLog |4 
 lib/md5.c |2 +-
 m4/md5.m4 |3 +--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 66eb057..890941d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   crypto/md5: avoid 'static inline'
+   * lib/md5.c (set_uint32): Now static, not static inline.
+   * m4/md5.m4 (gl_MD5): Do not require AC_C_INLINE.
+
lstat: avoid 'static inline'
* lib/lstat.c (orig_lstat): Now static, not static inline.
* m4/lstat.m4 (gl_PREREQ_LSTAT): Do not require AC_C_INLINE.
diff --git a/lib/md5.c b/lib/md5.c
index 66ede23..3f564d1 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -83,7 +83,7 @@ md5_init_ctx (struct md5_ctx *ctx)
 /* Copy the 4 byte value from v into the memory location pointed to by *cp,
If your architecture allows unaligned access this is equivalent to
* (uint32_t *) cp = v  */
-static inline void
+static void
 set_uint32 (char *cp, uint32_t v)
 {
   memcpy (cp, v, sizeof v);
diff --git a/m4/md5.m4 b/m4/md5.m4
index e22f7bd..85ed894 100644
--- a/m4/md5.m4
+++ b/m4/md5.m4
@@ -1,4 +1,4 @@
-# md5.m4 serial 12
+# md5.m4 serial 13
 dnl Copyright (C) 2002-2006, 2008-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,
@@ -8,6 +8,5 @@ AC_DEFUN([gl_MD5],
 [
   dnl Prerequisites of lib/md5.c.
   AC_REQUIRE([gl_BIGENDIAN])
-  AC_REQUIRE([AC_C_INLINE])
   :
 ])
-- 
1.7.6.5




[PATCH 06/16] crypto/sha1: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/sha1.c (set_uint32): Now static, not static inline.
* m4/sha1.m4 (gl_SHA1): Do not require AC_C_INLINE.
---
 ChangeLog  |4 
 lib/sha1.c |2 +-
 m4/sha1.m4 |3 +--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1f3e5bc..441dfe0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   crypto/sha1: avoid 'static inline'
+   * lib/sha1.c (set_uint32): Now static, not static inline.
+   * m4/sha1.m4 (gl_SHA1): Do not require AC_C_INLINE.
+
mktime: avoid 'static inline'
* lib/mktime.c (leapyear, ydhms_diff): Now static, not static inline.
* m4/mktime.m4 (gl_PREREQ_MKTIME): Do not require AC_C_INLINE.
diff --git a/lib/sha1.c b/lib/sha1.c
index db4ab42..1f67184 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -70,7 +70,7 @@ sha1_init_ctx (struct sha1_ctx *ctx)
 /* Copy the 4 byte value from v into the memory location pointed to by *cp,
If your architecture allows unaligned access this is equivalent to
* (uint32_t *) cp = v  */
-static inline void
+static void
 set_uint32 (char *cp, uint32_t v)
 {
   memcpy (cp, v, sizeof v);
diff --git a/m4/sha1.m4 b/m4/sha1.m4
index 7619825..29fa485 100644
--- a/m4/sha1.m4
+++ b/m4/sha1.m4
@@ -1,4 +1,4 @@
-# sha1.m4 serial 10
+# sha1.m4 serial 11
 dnl Copyright (C) 2002-2006, 2008-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,
@@ -8,6 +8,5 @@ AC_DEFUN([gl_SHA1],
 [
   dnl Prerequisites of lib/sha1.c.
   AC_REQUIRE([gl_BIGENDIAN])
-  AC_REQUIRE([AC_C_INLINE])
   :
 ])
-- 
1.7.6.5




[PATCH 07/16] crypto/sha256: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/sha256.c (set_uint32): Now static, not static inline.
* m4/sha256.m4 (gl_SHA256): Do not require AC_C_INLINE.
---
 ChangeLog|4 
 lib/sha256.c |2 +-
 m4/sha256.m4 |3 +--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 441dfe0..6554558 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   crypto/sha256: avoid 'static inline'
+   * lib/sha256.c (set_uint32): Now static, not static inline.
+   * m4/sha256.m4 (gl_SHA256): Do not require AC_C_INLINE.
+
crypto/sha1: avoid 'static inline'
* lib/sha1.c (set_uint32): Now static, not static inline.
* m4/sha1.m4 (gl_SHA1): Do not require AC_C_INLINE.
diff --git a/lib/sha256.c b/lib/sha256.c
index a8d29da..55273c6 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -90,7 +90,7 @@ sha224_init_ctx (struct sha256_ctx *ctx)
 /* Copy the value from v into the memory location pointed to by *cp,
If your architecture allows unaligned access this is equivalent to
* (uint32_t *) cp = v  */
-static inline void
+static void
 set_uint32 (char *cp, uint32_t v)
 {
   memcpy (cp, v, sizeof v);
diff --git a/m4/sha256.m4 b/m4/sha256.m4
index 78cc95e..f75a7fb 100644
--- a/m4/sha256.m4
+++ b/m4/sha256.m4
@@ -1,4 +1,4 @@
-# sha256.m4 serial 5
+# sha256.m4 serial 6
 dnl Copyright (C) 2005, 2008-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,
@@ -8,5 +8,4 @@ AC_DEFUN([gl_SHA256],
 [
   dnl Prerequisites of lib/sha256.c.
   AC_REQUIRE([gl_BIGENDIAN])
-  AC_REQUIRE([AC_C_INLINE])
 ])
-- 
1.7.6.5




[PATCH 08/16] crypto/sha512: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/sha512.c (set_uint64): Now static, not static inline.
* m4/sha512.m4 (gl_SHA512): Do not require AC_C_INLINE.
---
 ChangeLog|4 
 lib/sha512.c |2 +-
 m4/sha512.m4 |3 +--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6554558..be59365 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   crypto/sha512: avoid 'static inline'
+   * lib/sha512.c (set_uint64): Now static, not static inline.
+   * m4/sha512.m4 (gl_SHA512): Do not require AC_C_INLINE.
+
crypto/sha256: avoid 'static inline'
* lib/sha256.c (set_uint32): Now static, not static inline.
* m4/sha256.m4 (gl_SHA256): Do not require AC_C_INLINE.
diff --git a/lib/sha512.c b/lib/sha512.c
index cf62f20..dfb67a3 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -97,7 +97,7 @@ sha384_init_ctx (struct sha512_ctx *ctx)
 /* Copy the value from V into the memory location pointed to by *CP,
If your architecture allows unaligned access, this is equivalent to
* (__typeof__ (v) *) cp = v  */
-static inline void
+static void
 set_uint64 (char *cp, u64 v)
 {
   memcpy (cp, v, sizeof v);
diff --git a/m4/sha512.m4 b/m4/sha512.m4
index 937ea8d..e6e2739 100644
--- a/m4/sha512.m4
+++ b/m4/sha512.m4
@@ -1,4 +1,4 @@
-# sha512.m4 serial 6
+# sha512.m4 serial 7
 dnl Copyright (C) 2005-2006, 2008-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,
@@ -8,5 +8,4 @@ AC_DEFUN([gl_SHA512],
 [
   dnl Prerequisites of lib/sha512.c.
   AC_REQUIRE([gl_BIGENDIAN])
-  AC_REQUIRE([AC_C_INLINE])
 ])
-- 
1.7.6.5




[PATCH 09/16] stat: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/stat.c (orig_stat): Now static, not static inline.
* m4/stat.m4 (gl_PREREQ_STAT): Do not require AC_C_INLINE.
---
 ChangeLog  |4 
 lib/stat.c |2 +-
 m4/stat.m4 |8 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index be59365..9095547 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   stat: avoid 'static inline'
+   * lib/stat.c (orig_stat): Now static, not static inline.
+   * m4/stat.m4 (gl_PREREQ_STAT): Do not require AC_C_INLINE.
+
crypto/sha512: avoid 'static inline'
* lib/sha512.c (set_uint64): Now static, not static inline.
* m4/sha512.m4 (gl_SHA512): Do not require AC_C_INLINE.
diff --git a/lib/stat.c b/lib/stat.c
index 7599540..c0bcb88 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -42,7 +42,7 @@
 # endif
 #endif
 
-static inline int
+static int
 orig_stat (const char *filename, struct stat *buf)
 {
   return stat (filename, buf);
diff --git a/m4/stat.m4 b/m4/stat.m4
index a8b79f5..0fd117e 100644
--- a/m4/stat.m4
+++ b/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 10
+# serial 11
 
 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
 #
@@ -68,8 +68,4 @@ AC_DEFUN([gl_FUNC_STAT],
 ])
 
 # Prerequisites of lib/stat.c.
-AC_DEFUN([gl_PREREQ_STAT],
-[
-  AC_REQUIRE([AC_C_INLINE])
-  :
-])
+AC_DEFUN([gl_PREREQ_STAT], [:])
-- 
1.7.6.5




[PATCH 10/16] stdio: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/stdio.in.h (rpl_fwrite): Now static, not static inline.
* m4/stdio_h.m4 (gl_STDIO_H): Do not require AC_C_INLINE.
---
 ChangeLog  |4 
 lib/stdio.in.h |2 +-
 m4/stdio_h.m4  |3 +--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9095547..139e88a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   stdio: avoid 'static inline'
+   * lib/stdio.in.h (rpl_fwrite): Now static, not static inline.
+   * m4/stdio_h.m4 (gl_STDIO_H): Do not require AC_C_INLINE.
+
stat: avoid 'static inline'
* lib/stat.c (orig_stat): Now static, not static inline.
* m4/stat.m4 (gl_PREREQ_STAT): Do not require AC_C_INLINE.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index fab325d..498bb94 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -581,7 +581,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
This affects only function declaration attributes, so it's not
needed for C++.  */
 #  if !defined __cplusplus  0  __USE_FORTIFY_LEVEL
-static inline size_t _GL_ARG_NONNULL ((1, 4))
+static size_t _GL_ARG_NONNULL ((1, 4))
 rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
 {
   size_t r = fwrite (ptr, s, n, stream);
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 5298dd6..3bd6580 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 42
+# stdio_h.m4 serial 43
 dnl Copyright (C) 2007-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,
@@ -7,7 +7,6 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-  AC_REQUIRE([AC_C_INLINE])
   gl_NEXT_HEADERS([stdio.h])
 
   dnl No need to create extra modules for these functions. Everyone who uses
-- 
1.7.6.5




[PATCH 11/16] sys_select: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/sys_select.in.h (rpl_fd_isset): Now static, not static inline.
---
 ChangeLog   |3 +++
 lib/sys_select.in.h |2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 139e88a..03291cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   sys_select: avoid 'static inline'
+   * lib/sys_select.in.h (rpl_fd_isset): Now static, not static inline.
+
stdio: avoid 'static inline'
* lib/stdio.in.h (rpl_fwrite): Now static, not static inline.
* m4/stdio_h.m4 (gl_STDIO_H): Do not require AC_C_INLINE.
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 72704a8..ce42267 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -130,7 +130,7 @@
 
 /* Re-define FD_ISSET to avoid a WSA call while we are not using
network sockets.  */
-static inline int
+static int
 rpl_fd_isset (SOCKET fd, fd_set * set)
 {
   u_int i;
-- 
1.7.6.5




[PATCH 12/16] sys_stat: avoid 'static inline'

2012-08-18 Thread Paul Eggert
* lib/sys_stat.in.h (rpl_mkdir): Now static, not static inline.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Do not require AC_C_INLINE.
---
 ChangeLog |4 
 lib/sys_stat.in.h |2 +-
 m4/sys_stat_h.m4  |5 +
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 03291cc..32a04a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   sys_stat: avoid 'static inline'
+   * lib/sys_stat.in.h (rpl_mkdir): Now static, not static inline.
+   * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Do not require AC_C_INLINE.
+
sys_select: avoid 'static inline'
* lib/sys_select.in.h (rpl_fd_isset): Now static, not static inline.
 
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index e9e06a2..29ffdf9 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -497,7 +497,7 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t 
mode));
 # if (defined _WIN32 || defined __WIN32__)  ! defined __CYGWIN__
 
 #  if !GNULIB_defined_rpl_mkdir
-static inline int
+static int
 rpl_mkdir (char const *name, mode_t mode)
 {
   return _mkdir (name);
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index f45dee1..8af3353 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 27   -*- Autoconf -*-
+# sys_stat_h.m4 serial 28   -*- Autoconf -*-
 dnl Copyright (C) 2006-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,
@@ -11,9 +11,6 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
 [
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
 
-  dnl For the mkdir substitute.
-  AC_REQUIRE([AC_C_INLINE])
-
   dnl Check for broken stat macros.
   AC_REQUIRE([AC_HEADER_STAT])
 
-- 
1.7.6.5




[PATCH 15/16] stat-time: omit unnecessary AC_C_INLINE

2012-08-18 Thread Paul Eggert
* m4/stat-time.m4 (gl_STAT_TIME, gl_STAT_BIRTHTIME):
Do not require AC_C_INLINE.
---
 ChangeLog   |4 
 m4/stat-time.m4 |2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b47bf94..596593c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   stat-time: omit unnecessary AC_C_INLINE
+   * m4/stat-time.m4 (gl_STAT_TIME, gl_STAT_BIRTHTIME):
+   Do not require AC_C_INLINE.
+
ignore-value: omit unnecessary AC_C_INLINE
* modules/ignore-value (configure.ac): Do not require AC_C_INLINE.
 
diff --git a/m4/stat-time.m4 b/m4/stat-time.m4
index 2dbb1f3..9371d7b 100644
--- a/m4/stat-time.m4
+++ b/m4/stat-time.m4
@@ -19,7 +19,6 @@ dnl From Paul Eggert.
 
 AC_DEFUN([gl_STAT_TIME],
 [
-  AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_CHECK_HEADERS_ONCE([sys/time.h])
 
@@ -70,7 +69,6 @@ AC_DEFUN([gl_STAT_TIME],
 #
 AC_DEFUN([gl_STAT_BIRTHTIME],
 [
-  AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_CHECK_HEADERS_ONCE([sys/time.h])
   AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
-- 
1.7.6.5




[PATCH 16/16] timespec: omit unnecessary AC_C_INLINE

2012-08-18 Thread Paul Eggert
* m4/timespec.m4 (gl_TIMESPEC): Do not require AC_C_INLINE.
---
 ChangeLog  |3 +++
 m4/timespec.m4 |8 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 596593c..6abba93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-08-18  Paul Eggert  egg...@cs.ucla.edu
 
+   timespec: omit unnecessary AC_C_INLINE
+   * m4/timespec.m4 (gl_TIMESPEC): Do not require AC_C_INLINE.
+
stat-time: omit unnecessary AC_C_INLINE
* m4/stat-time.m4 (gl_STAT_TIME, gl_STAT_BIRTHTIME):
Do not require AC_C_INLINE.
diff --git a/m4/timespec.m4 b/m4/timespec.m4
index 597b9c2..63c00e8 100644
--- a/m4/timespec.m4
+++ b/m4/timespec.m4
@@ -1,4 +1,4 @@
-#serial 14
+#serial 15
 
 # Copyright (C) 2000-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
@@ -8,8 +8,4 @@
 
 dnl From Jim Meyering
 
-AC_DEFUN([gl_TIMESPEC],
-[
-  dnl Prerequisites of lib/timespec.h.
-  AC_REQUIRE([AC_C_INLINE])
-])
+AC_DEFUN([gl_TIMESPEC], [:])
-- 
1.7.6.5




Re: avoiding 'static inline'

2012-08-18 Thread Ben Pfaff
Paul Eggert egg...@cs.ucla.edu writes:

 I recently added a bunch of static inline functions to Emacs,
 and just for fun I tried changing them to plain 'static' to
 see how much that would hurt performance.  To my surprise, it
 made Emacs 14% faster on my standard Lisp benchmark (taking the nth
 element of a long list).  It also shrank the size of the text segment
 by 1.7%, which was not as much of a surprise.

 Clearly I've been using 'static inline' too much.  Come to think of
 it, these days there's little need for 'static inline' as opposed to
 'static', since GCC and other modern compilers will inline 'static'
 functions for you.  And apparently they do a better job if they're not
 given bad advice by people who use the 'inline' keyword.

 I'd like to install some changes to gnulib, so that its code does
 not use 'static inline' in the modules that Emacs uses.  This is part
 of a similar, larger change to Emacs proper.  These patches won't
 affect extern inline functions, just static ones.

With GCC, adding inline to static has the side effect of
suppressing unused static function warnings.  For static
inline functions in header files in particular, that's an
important side effect, since most C source files that #include a
header won't have a call to every static inline function in the
header.

I see that some of your patches remove inline from some static
inline functions in header files, but I don't see anything
added, such as __attribute__((unused)), that would suppress an
unused static function warning.  (Perhaps I just missed it.)
Did you consider this issue?

Thanks,

Ben.