diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-09-19 14:40:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-09-19 14:40:08 -0700 |
commit | 230fe2a5a10f2bc128f354e3fb1b48536b1f143b (patch) | |
tree | b282d5f242b8ada877d188d03d43da78b175d67a /lib | |
parent | c39cc7d149d28060c40bc206eb8a63f7a0636301 (diff) | |
download | emacs-230fe2a5a10f2bc128f354e3fb1b48536b1f143b.tar.gz |
Merge from gnulib.
This incorporates the following changes:
2013-09-19 stdio: OS X port of putc_unlocked + extern inline
2013-09-19 signal: OS X port of sigaddset etc. + extern inline
2013-09-19 extern-inline: do not always suppress extern inline on OS X
2013-09-17 getgroups: statement without effect
2013-08-28 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Diffstat (limited to 'lib')
-rw-r--r-- | lib/acl-internal.h | 3 | ||||
-rw-r--r-- | lib/binary-io.h | 3 | ||||
-rw-r--r-- | lib/dtotimespec.c | 30 | ||||
-rw-r--r-- | lib/execinfo.in.h | 3 | ||||
-rw-r--r-- | lib/getgroups.c | 2 | ||||
-rw-r--r-- | lib/openat.h | 3 | ||||
-rw-r--r-- | lib/signal.in.h | 14 | ||||
-rw-r--r-- | lib/stat-time.h | 3 | ||||
-rw-r--r-- | lib/stdio.in.h | 9 | ||||
-rw-r--r-- | lib/timespec-add.c | 7 | ||||
-rw-r--r-- | lib/timespec-sub.c | 7 | ||||
-rw-r--r-- | lib/timespec.h | 3 | ||||
-rw-r--r-- | lib/u64.h | 3 | ||||
-rw-r--r-- | lib/unistd.in.h | 3 | ||||
-rw-r--r-- | lib/utimens.c | 6 | ||||
-rw-r--r-- | lib/utimens.h | 3 |
16 files changed, 69 insertions, 33 deletions
diff --git a/lib/acl-internal.h b/lib/acl-internal.h index 7e6d77a5fd4..55c224ca883 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -60,6 +60,9 @@ extern int aclsort (int, int, struct acl *); # define fchmod(fd, mode) (-1) #endif +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef ACL_INTERNAL_INLINE # define ACL_INTERNAL_INLINE _GL_INLINE diff --git a/lib/binary-io.h b/lib/binary-io.h index 317fe3d3c20..423c2ae3fff 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -25,6 +25,9 @@ so we include it here first. */ #include <stdio.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef BINARY_IO_INLINE # define BINARY_IO_INLINE _GL_INLINE diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c index ecce2e5bcc5..064f7d3a0a9 100644 --- a/lib/dtotimespec.c +++ b/lib/dtotimespec.c @@ -29,41 +29,31 @@ struct timespec dtotimespec (double sec) { - enum { BILLION = 1000 * 1000 * 1000 }; double min_representable = TYPE_MINIMUM (time_t); double max_representable = - ((TYPE_MAXIMUM (time_t) * (double) BILLION + (BILLION - 1)) - / BILLION); - struct timespec r; + ((TYPE_MAXIMUM (time_t) * (double) TIMESPEC_RESOLUTION + + (TIMESPEC_RESOLUTION - 1)) + / TIMESPEC_RESOLUTION); if (! (min_representable < sec)) - { - r.tv_sec = TYPE_MINIMUM (time_t); - r.tv_nsec = 0; - } + return make_timespec (TYPE_MINIMUM (time_t), 0); else if (! (sec < max_representable)) - { - r.tv_sec = TYPE_MAXIMUM (time_t); - r.tv_nsec = BILLION - 1; - } + return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_RESOLUTION - 1); else { time_t s = sec; - double frac = BILLION * (sec - s); + double frac = TIMESPEC_RESOLUTION * (sec - s); long ns = frac; ns += ns < frac; - s += ns / BILLION; - ns %= BILLION; + s += ns / TIMESPEC_RESOLUTION; + ns %= TIMESPEC_RESOLUTION; if (ns < 0) { s--; - ns += BILLION; + ns += TIMESPEC_RESOLUTION; } - r.tv_sec = s; - r.tv_nsec = ns; + return make_timespec (s, ns); } - - return r; } diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h index 6cfc8d56d2d..344f26add2b 100644 --- a/lib/execinfo.in.h +++ b/lib/execinfo.in.h @@ -20,6 +20,9 @@ #ifndef _GL_EXECINFO_H #define _GL_EXECINFO_H +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_EXECINFO_INLINE # define _GL_EXECINFO_INLINE _GL_INLINE diff --git a/lib/getgroups.c b/lib/getgroups.c index 9856adc1a4d..e71b5439c7e 100644 --- a/lib/getgroups.c +++ b/lib/getgroups.c @@ -86,7 +86,7 @@ rpl_getgroups (int n, gid_t *group) } saved_errno = errno; free (gbuf); - errno == saved_errno; + errno = saved_errno; return result; } diff --git a/lib/openat.h b/lib/openat.h index eb90990da1d..7208f4459fe 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -26,6 +26,9 @@ #include <unistd.h> #include <stdbool.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #if !HAVE_OPENAT diff --git a/lib/signal.in.h b/lib/signal.in.h index 54849504d77..a531487e355 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -195,6 +195,20 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; # endif +/* When also using extern inline, suppress the use of static inline in + standard headers of problematic Apple configurations, as Libc at + least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., + <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + Perhaps Apple will fix this some day. */ +#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ + && (defined __i386__ || defined __x86_64__)) +# undef sigaddset +# undef sigdelset +# undef sigemptyset +# undef sigfillset +# undef sigismember +#endif + /* Test whether a given signal is contained in a signal set. */ # if @HAVE_POSIX_SIGNALBLOCKING@ /* This function is defined as a macro on Mac OS X. */ diff --git a/lib/stat-time.h b/lib/stat-time.h index 2d3b5cd6514..d58eddde334 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -23,6 +23,9 @@ #include <sys/stat.h> #include <time.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_STAT_TIME_INLINE # define _GL_STAT_TIME_INLINE _GL_INLINE diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 06cbad00d3d..76e62fba6ba 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -124,6 +124,15 @@ #define _GL_STDIO_STRINGIZE(token) #token #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) +/* When also using extern inline, suppress the use of static inline in + standard headers of problematic Apple configurations, as Libc at + least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., + <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + Perhaps Apple will fix this some day. */ +#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ + && defined __GNUC__ && defined __STDC__) +# undef putc_unlocked +#endif #if @GNULIB_DPRINTF@ # if @REPLACE_DPRINTF@ diff --git a/lib/timespec-add.c b/lib/timespec-add.c index 6ce2c73064f..51323a63207 100644 --- a/lib/timespec-add.c +++ b/lib/timespec-add.c @@ -28,11 +28,10 @@ struct timespec timespec_add (struct timespec a, struct timespec b) { - struct timespec r; time_t rs = a.tv_sec; time_t bs = b.tv_sec; int ns = a.tv_nsec + b.tv_nsec; - int nsd = ns - 1000000000; + int nsd = ns - TIMESPEC_RESOLUTION; int rns = ns; if (0 <= nsd) @@ -65,7 +64,5 @@ timespec_add (struct timespec a, struct timespec b) else rs += bs; - r.tv_sec = rs; - r.tv_nsec = rns; - return r; + return make_timespec (rs, rns); } diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c index 97c9f9de88c..b164a8380d0 100644 --- a/lib/timespec-sub.c +++ b/lib/timespec-sub.c @@ -29,7 +29,6 @@ struct timespec timespec_sub (struct timespec a, struct timespec b) { - struct timespec r; time_t rs = a.tv_sec; time_t bs = b.tv_sec; int ns = a.tv_nsec - b.tv_nsec; @@ -37,7 +36,7 @@ timespec_sub (struct timespec a, struct timespec b) if (ns < 0) { - rns = ns + 1000000000; + rns = ns + TIMESPEC_RESOLUTION; if (rs == TYPE_MINIMUM (time_t)) { if (bs <= 0) @@ -65,7 +64,5 @@ timespec_sub (struct timespec a, struct timespec b) else rs -= bs; - r.tv_sec = rs; - r.tv_nsec = rns; - return r; + return make_timespec (rs, rns); } diff --git a/lib/timespec.h b/lib/timespec.h index c7450ad8de0..d0c029b5704 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -21,6 +21,9 @@ # include <time.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_TIMESPEC_INLINE # define _GL_TIMESPEC_INLINE _GL_INLINE diff --git a/lib/u64.h b/lib/u64.h index d8009ad3913..af8441f52e5 100644 --- a/lib/u64.h +++ b/lib/u64.h @@ -19,6 +19,9 @@ #include <stdint.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_U64_INLINE # define _GL_U64_INLINE _GL_INLINE diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 2ea9af43652..874c628a63b 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -116,6 +116,9 @@ # include <getopt.h> #endif +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_UNISTD_INLINE # define _GL_UNISTD_INLINE _GL_INLINE diff --git a/lib/utimens.c b/lib/utimens.c index 013843d6da4..44a33c1d791 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -90,10 +90,12 @@ validate_timespec (struct timespec timespec[2]) assert (timespec); if ((timespec[0].tv_nsec != UTIME_NOW && timespec[0].tv_nsec != UTIME_OMIT - && (timespec[0].tv_nsec < 0 || 1000000000 <= timespec[0].tv_nsec)) + && ! (0 <= timespec[0].tv_nsec + && timespec[0].tv_nsec < TIMESPEC_RESOLUTION)) || (timespec[1].tv_nsec != UTIME_NOW && timespec[1].tv_nsec != UTIME_OMIT - && (timespec[1].tv_nsec < 0 || 1000000000 <= timespec[1].tv_nsec))) + && ! (0 <= timespec[1].tv_nsec + && timespec[1].tv_nsec < TIMESPEC_RESOLUTION))) { errno = EINVAL; return -1; diff --git a/lib/utimens.h b/lib/utimens.h index 82a72a7a451..f1633c966aa 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -26,6 +26,9 @@ int lutimens (char const *, struct timespec const [2]); # include <fcntl.h> # include <sys/stat.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_UTIMENS_INLINE # define _GL_UTIMENS_INLINE _GL_INLINE |