aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2012-11-30 10:25:59 -0800
committerPaul Eggert2012-11-30 10:25:59 -0800
commitf64898abf40b09990c4974c921ddc2ebc698609a (patch)
tree45707f0fd85ef6da1c94832b9af8290b2ad0d5d2 /lib
parentf8aff4c6b87598697d7fc67063037ac69f1c9421 (diff)
downloademacs-f64898abf40b09990c4974c921ddc2ebc698609a.tar.gz
emacs-f64898abf40b09990c4974c921ddc2ebc698609a.zip
Merge from gnulib for 'inline'.
2012-11-29 snippet/warn-on-use: no 'static inline' 2012-11-29 ftruncate, fts, lstat, openat, raise: no 'static inline' 2012-11-29 arctwo, md4, md5, sha1, sha256, sha512: no 'static inline' 2012-11-29 fflush, stat: no 'static inline' 2012-11-29 stdio: better 'inline' 2012-11-29 sys_stat: no 'static inline' 2012-11-29 unistd: better 'inline' 2012-11-29 c-strtod, memcoll, readutmp: no 'static inline' 2012-11-29 extern-inline: no 'static inline' 2012-11-29 sys_socket: better 'inline' * lib/stdio.c, lib/unistd.c: New files, from gnulib. * build-aux/snippet/warn-on-use.h, lib/gnulib.mk, lib/lstat.c: * lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c, lib/stat.c: * lib/stdio.in.h, lib/sys_stat.in.h, lib/unistd.in.h, m4/c-strtod.m4: * m4/extern-inline.m4, m4/gnulib-comp.m4, m4/lstat.m4, m4/md5.m4: * m4/sha1.m4, m4/sha256.m4, m4/sha512.m4, m4/stat.m4, m4/stdio_h.m4: * m4/sys_socket_h.m4, m4/sys_stat_h.m4, m4/unistd_h.m4: Update from gnulib. Fixes: debbugs:13040
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk2
-rw-r--r--lib/lstat.c2
-rw-r--r--lib/md5.c2
-rw-r--r--lib/sha1.c2
-rw-r--r--lib/sha256.c2
-rw-r--r--lib/sha512.c2
-rw-r--r--lib/stat.c2
-rw-r--r--lib/stdio.c3
-rw-r--r--lib/stdio.in.h8
-rw-r--r--lib/sys_stat.in.h2
-rw-r--r--lib/unistd.c3
-rw-r--r--lib/unistd.in.h10
12 files changed, 30 insertions, 10 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 834f63169e2..9d7cb281564 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -756,6 +756,7 @@ EXTRA_DIST += stdint.in.h
756## begin gnulib module stdio 756## begin gnulib module stdio
757 757
758BUILT_SOURCES += stdio.h 758BUILT_SOURCES += stdio.h
759libgnu_a_SOURCES += stdio.c
759 760
760# We need the following in order to create <stdio.h> when the system 761# We need the following in order to create <stdio.h> when the system
761# doesn't have one that works with the given compiler. 762# doesn't have one that works with the given compiler.
@@ -1251,6 +1252,7 @@ EXTRA_DIST += u64.h
1251## begin gnulib module unistd 1252## begin gnulib module unistd
1252 1253
1253BUILT_SOURCES += unistd.h 1254BUILT_SOURCES += unistd.h
1255libgnu_a_SOURCES += unistd.c
1254 1256
1255# We need the following in order to create an empty placeholder for 1257# We need the following in order to create an empty placeholder for
1256# <unistd.h> when the system doesn't have one. 1258# <unistd.h> when the system doesn't have one.
diff --git a/lib/lstat.c b/lib/lstat.c
index db119a10d3f..97fe6bb2d53 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -35,7 +35,7 @@ typedef int dummy;
35# include <sys/stat.h> 35# include <sys/stat.h>
36# undef __need_system_sys_stat_h 36# undef __need_system_sys_stat_h
37 37
38static inline int 38static int
39orig_lstat (const char *filename, struct stat *buf) 39orig_lstat (const char *filename, struct stat *buf)
40{ 40{
41 return lstat (filename, buf); 41 return lstat (filename, buf);
diff --git a/lib/md5.c b/lib/md5.c
index 30b7e50e3ae..6e6d61270dd 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -83,7 +83,7 @@ md5_init_ctx (struct md5_ctx *ctx)
83/* Copy the 4 byte value from v into the memory location pointed to by *cp, 83/* Copy the 4 byte value from v into the memory location pointed to by *cp,
84 If your architecture allows unaligned access this is equivalent to 84 If your architecture allows unaligned access this is equivalent to
85 * (uint32_t *) cp = v */ 85 * (uint32_t *) cp = v */
86static inline void 86static void
87set_uint32 (char *cp, uint32_t v) 87set_uint32 (char *cp, uint32_t v)
88{ 88{
89 memcpy (cp, &v, sizeof v); 89 memcpy (cp, &v, sizeof v);
diff --git a/lib/sha1.c b/lib/sha1.c
index 0d82af14bc9..b9505dd9467 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -70,7 +70,7 @@ sha1_init_ctx (struct sha1_ctx *ctx)
70/* Copy the 4 byte value from v into the memory location pointed to by *cp, 70/* Copy the 4 byte value from v into the memory location pointed to by *cp,
71 If your architecture allows unaligned access this is equivalent to 71 If your architecture allows unaligned access this is equivalent to
72 * (uint32_t *) cp = v */ 72 * (uint32_t *) cp = v */
73static inline void 73static void
74set_uint32 (char *cp, uint32_t v) 74set_uint32 (char *cp, uint32_t v)
75{ 75{
76 memcpy (cp, &v, sizeof v); 76 memcpy (cp, &v, sizeof v);
diff --git a/lib/sha256.c b/lib/sha256.c
index a8d29da18dd..55273c6a3bc 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -90,7 +90,7 @@ sha224_init_ctx (struct sha256_ctx *ctx)
90/* Copy the value from v into the memory location pointed to by *cp, 90/* Copy the value from v into the memory location pointed to by *cp,
91 If your architecture allows unaligned access this is equivalent to 91 If your architecture allows unaligned access this is equivalent to
92 * (uint32_t *) cp = v */ 92 * (uint32_t *) cp = v */
93static inline void 93static void
94set_uint32 (char *cp, uint32_t v) 94set_uint32 (char *cp, uint32_t v)
95{ 95{
96 memcpy (cp, &v, sizeof v); 96 memcpy (cp, &v, sizeof v);
diff --git a/lib/sha512.c b/lib/sha512.c
index cf62f2034e5..dfb67a305d8 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -97,7 +97,7 @@ sha384_init_ctx (struct sha512_ctx *ctx)
97/* Copy the value from V into the memory location pointed to by *CP, 97/* Copy the value from V into the memory location pointed to by *CP,
98 If your architecture allows unaligned access, this is equivalent to 98 If your architecture allows unaligned access, this is equivalent to
99 * (__typeof__ (v) *) cp = v */ 99 * (__typeof__ (v) *) cp = v */
100static inline void 100static void
101set_uint64 (char *cp, u64 v) 101set_uint64 (char *cp, u64 v)
102{ 102{
103 memcpy (cp, &v, sizeof v); 103 memcpy (cp, &v, sizeof v);
diff --git a/lib/stat.c b/lib/stat.c
index 75995408906..c0bcb88320f 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -42,7 +42,7 @@
42# endif 42# endif
43#endif 43#endif
44 44
45static inline int 45static int
46orig_stat (const char *filename, struct stat *buf) 46orig_stat (const char *filename, struct stat *buf)
47{ 47{
48 return stat (filename, buf); 48 return stat (filename, buf);
diff --git a/lib/stdio.c b/lib/stdio.c
new file mode 100644
index 00000000000..e6ed82996b7
--- /dev/null
+++ b/lib/stdio.c
@@ -0,0 +1,3 @@
1#include <config.h>
2#define _GL_STDIO_INLINE _GL_EXTERN_INLINE
3#include "stdio.h"
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index b1b543dee72..f3b52d28f6b 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -46,6 +46,11 @@
46#ifndef _@GUARD_PREFIX@_STDIO_H 46#ifndef _@GUARD_PREFIX@_STDIO_H
47#define _@GUARD_PREFIX@_STDIO_H 47#define _@GUARD_PREFIX@_STDIO_H
48 48
49_GL_INLINE_HEADER_BEGIN
50#ifndef _GL_STDIO_INLINE
51# define _GL_STDIO_INLINE _GL_INLINE
52#endif
53
49/* Get va_list. Needed on many systems, including glibc 2.8. */ 54/* Get va_list. Needed on many systems, including glibc 2.8. */
50#include <stdarg.h> 55#include <stdarg.h>
51 56
@@ -581,7 +586,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
581 This affects only function declaration attributes, so it's not 586 This affects only function declaration attributes, so it's not
582 needed for C++. */ 587 needed for C++. */
583# if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL 588# if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL
584static inline size_t _GL_ARG_NONNULL ((1, 4)) 589_GL_STDIO_INLINE size_t _GL_ARG_NONNULL ((1, 4))
585rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream) 590rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
586{ 591{
587 size_t r = fwrite (ptr, s, n, stream); 592 size_t r = fwrite (ptr, s, n, stream);
@@ -1333,6 +1338,7 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1333 "POSIX compliance"); 1338 "POSIX compliance");
1334#endif 1339#endif
1335 1340
1341_GL_INLINE_HEADER_END
1336 1342
1337#endif /* _@GUARD_PREFIX@_STDIO_H */ 1343#endif /* _@GUARD_PREFIX@_STDIO_H */
1338#endif /* _@GUARD_PREFIX@_STDIO_H */ 1344#endif /* _@GUARD_PREFIX@_STDIO_H */
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 2efc1e92e06..ac05ddb5cec 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));
497# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 497# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
498 498
499# if !GNULIB_defined_rpl_mkdir 499# if !GNULIB_defined_rpl_mkdir
500static inline int 500static int
501rpl_mkdir (char const *name, mode_t mode) 501rpl_mkdir (char const *name, mode_t mode)
502{ 502{
503 return _mkdir (name); 503 return _mkdir (name);
diff --git a/lib/unistd.c b/lib/unistd.c
new file mode 100644
index 00000000000..6c6a8e268c0
--- /dev/null
+++ b/lib/unistd.c
@@ -0,0 +1,3 @@
1#include <config.h>
2#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
3#include "unistd.h"
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index e904e512ee8..6171f77ac71 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -127,6 +127,11 @@
127# include <getopt.h> 127# include <getopt.h>
128#endif 128#endif
129 129
130_GL_INLINE_HEADER_BEGIN
131#ifndef _GL_UNISTD_INLINE
132# define _GL_UNISTD_INLINE _GL_INLINE
133#endif
134
130/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 135/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
131 136
132/* The definition of _GL_ARG_NONNULL is copied here. */ 137/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -404,7 +409,7 @@ extern char **environ;
404# endif 409# endif
405#elif defined GNULIB_POSIXCHECK 410#elif defined GNULIB_POSIXCHECK
406# if HAVE_RAW_DECL_ENVIRON 411# if HAVE_RAW_DECL_ENVIRON
407static inline char *** 412_GL_UNISTD_INLINE char ***
408rpl_environ (void) 413rpl_environ (void)
409{ 414{
410 return &environ; 415 return &environ;
@@ -862,7 +867,7 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void));
862# define getpagesize() _gl_getpagesize () 867# define getpagesize() _gl_getpagesize ()
863# else 868# else
864# if !GNULIB_defined_getpagesize_function 869# if !GNULIB_defined_getpagesize_function
865static inline int 870_GL_UNISTD_INLINE int
866getpagesize () 871getpagesize ()
867{ 872{
868 return _gl_getpagesize (); 873 return _gl_getpagesize ();
@@ -1530,6 +1535,7 @@ _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1530_GL_CXXALIASWARN (write); 1535_GL_CXXALIASWARN (write);
1531#endif 1536#endif
1532 1537
1538_GL_INLINE_HEADER_END
1533 1539
1534#endif /* _@GUARD_PREFIX@_UNISTD_H */ 1540#endif /* _@GUARD_PREFIX@_UNISTD_H */
1535#endif /* _@GUARD_PREFIX@_UNISTD_H */ 1541#endif /* _@GUARD_PREFIX@_UNISTD_H */