diff options
| author | Paul Eggert | 2012-10-04 00:15:42 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-10-04 00:15:42 -0700 |
| commit | bb1dfdadd507bb4b77595c87875ef807c101ed7b (patch) | |
| tree | eb92a2335896c34e76a9e19362049396b8d0483f | |
| parent | 88d69b7ddca305bb96d6e671300f6724e4f147dd (diff) | |
| download | emacs-bb1dfdadd507bb4b77595c87875ef807c101ed7b.tar.gz emacs-bb1dfdadd507bb4b77595c87875ef807c101ed7b.zip | |
Merge from gnulib.
| -rw-r--r-- | ChangeLog | 9 | ||||
| -rw-r--r-- | lib/gnulib.mk | 1 | ||||
| -rw-r--r-- | lib/pselect.c | 34 | ||||
| -rw-r--r-- | lib/stdlib.in.h | 13 | ||||
| -rw-r--r-- | m4/manywarnings.m4 | 32 | ||||
| -rw-r--r-- | m4/pselect.m4 | 40 | ||||
| -rw-r--r-- | m4/stdlib_h.m4 | 1 | ||||
| -rw-r--r-- | m4/sys_stat_h.m4 | 5 | ||||
| -rw-r--r-- | msdos/ChangeLog | 5 | ||||
| -rw-r--r-- | msdos/sedlibmk.inp | 1 |
10 files changed, 130 insertions, 11 deletions
| @@ -1,5 +1,14 @@ | |||
| 1 | 2012-10-04 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-10-04 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Merge from gnulib, incorporating: | ||
| 4 | 2012-10-02 pselect: reject invalid file descriptors | ||
| 5 | 2012-10-02 ptsname: reject invalid file descriptors | ||
| 6 | 2012-10-02 manywarnings: cater to more gcc infelicities | ||
| 7 | 2012-09-30 sockets, sys_stat: restore AC_C_INLINE | ||
| 8 | * lib/pselect.c, lib/stdlib.in.h, m4/manywarnings.m4, m4/pselect.m4: | ||
| 9 | * m4/stdlib_h.m4, m4/sys_stat_h.m4: Update from gnulib. | ||
| 10 | * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. | ||
| 11 | |||
| 3 | Port timers to OpenBSD, plus check for timer failures. | 12 | Port timers to OpenBSD, plus check for timer failures. |
| 4 | OpenBSD problem reported by Han Boetes. | 13 | OpenBSD problem reported by Han Boetes. |
| 5 | * profiler.c (setup_cpu_timer): Check for failure of timer_settime | 14 | * profiler.c (setup_cpu_timer): Check for failure of timer_settime |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index e79fe35622c..23749331a83 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -857,6 +857,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ | |||
| 857 | -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ | 857 | -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ |
| 858 | -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ | 858 | -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ |
| 859 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ | 859 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ |
| 860 | -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ | ||
| 860 | -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ | 861 | -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ |
| 861 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ | 862 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ |
| 862 | -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ | 863 | -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ |
diff --git a/lib/pselect.c b/lib/pselect.c index d8ebc70f6c6..1b6d099dccf 100644 --- a/lib/pselect.c +++ b/lib/pselect.c | |||
| @@ -33,6 +33,8 @@ | |||
| 33 | pointer parameter stands for no descriptors, an infinite timeout, | 33 | pointer parameter stands for no descriptors, an infinite timeout, |
| 34 | or an unaffected signal mask. */ | 34 | or an unaffected signal mask. */ |
| 35 | 35 | ||
| 36 | #if !HAVE_PSELECT | ||
| 37 | |||
| 36 | int | 38 | int |
| 37 | pselect (int nfds, fd_set *restrict rfds, | 39 | pselect (int nfds, fd_set *restrict rfds, |
| 38 | fd_set *restrict wfds, fd_set *restrict xfds, | 40 | fd_set *restrict wfds, fd_set *restrict xfds, |
| @@ -74,3 +76,35 @@ pselect (int nfds, fd_set *restrict rfds, | |||
| 74 | 76 | ||
| 75 | return select_result; | 77 | return select_result; |
| 76 | } | 78 | } |
| 79 | |||
| 80 | #else /* HAVE_PSELECT */ | ||
| 81 | # include <unistd.h> | ||
| 82 | # undef pselect | ||
| 83 | |||
| 84 | int | ||
| 85 | rpl_pselect (int nfds, fd_set *restrict rfds, | ||
| 86 | fd_set *restrict wfds, fd_set *restrict xfds, | ||
| 87 | struct timespec const *restrict timeout, | ||
| 88 | sigset_t const *restrict sigmask) | ||
| 89 | { | ||
| 90 | int i; | ||
| 91 | |||
| 92 | /* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */ | ||
| 93 | if (nfds < 0 || nfds > FD_SETSIZE) | ||
| 94 | { | ||
| 95 | errno = EINVAL; | ||
| 96 | return -1; | ||
| 97 | } | ||
| 98 | for (i = 0; i < nfds; i++) | ||
| 99 | { | ||
| 100 | if (((rfds && FD_ISSET (i, rfds)) | ||
| 101 | || (wfds && FD_ISSET (i, wfds)) | ||
| 102 | || (xfds && FD_ISSET (i, xfds))) | ||
| 103 | && dup2 (i, i) != i) | ||
| 104 | return -1; | ||
| 105 | } | ||
| 106 | |||
| 107 | return pselect (nfds, rfds, wfds, xfds, timeout, sigmask); | ||
| 108 | } | ||
| 109 | |||
| 110 | #endif | ||
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 1d67ec64c66..8311a2893c8 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h | |||
| @@ -457,10 +457,19 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " | |||
| 457 | #if @GNULIB_PTSNAME@ | 457 | #if @GNULIB_PTSNAME@ |
| 458 | /* Return the pathname of the pseudo-terminal slave associated with | 458 | /* Return the pathname of the pseudo-terminal slave associated with |
| 459 | the master FD is open on, or NULL on errors. */ | 459 | the master FD is open on, or NULL on errors. */ |
| 460 | # if !@HAVE_PTSNAME@ | 460 | # if @REPLACE_PTSNAME@ |
| 461 | # if !(defined __cplusplus && defined GNULIB_NAMESPCE) | ||
| 462 | # undef ptsname | ||
| 463 | # define ptsname rpl_ptsname | ||
| 464 | # endif | ||
| 465 | _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); | ||
| 466 | _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); | ||
| 467 | # else | ||
| 468 | # if !@HAVE_PTSNAME@ | ||
| 461 | _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); | 469 | _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); |
| 462 | # endif | 470 | # endif |
| 463 | _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); | 471 | _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); |
| 472 | # endif | ||
| 464 | _GL_CXXALIASWARN (ptsname); | 473 | _GL_CXXALIASWARN (ptsname); |
| 465 | #elif defined GNULIB_POSIXCHECK | 474 | #elif defined GNULIB_POSIXCHECK |
| 466 | # undef ptsname | 475 | # undef ptsname |
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 2760efb3f27..f3cb23be1cd 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # manywarnings.m4 serial 4 | 1 | # manywarnings.m4 serial 5 |
| 2 | dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -35,14 +35,12 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT], | |||
| 35 | # make sure your gcc understands it. | 35 | # make sure your gcc understands it. |
| 36 | AC_DEFUN([gl_MANYWARN_ALL_GCC], | 36 | AC_DEFUN([gl_MANYWARN_ALL_GCC], |
| 37 | [ | 37 | [ |
| 38 | dnl First, check if -Wno-missing-field-initializers is needed. | 38 | dnl First, check for some issues that only occur when combining multiple |
| 39 | dnl -Wmissing-field-initializers is implied by -W, but that issues | 39 | dnl gcc warning categories. |
| 40 | dnl warnings with GCC version before 4.7, for the common idiom | ||
| 41 | dnl of initializing types on the stack to zero, using { 0, } | ||
| 42 | AC_REQUIRE([AC_PROG_CC]) | 40 | AC_REQUIRE([AC_PROG_CC]) |
| 43 | if test -n "$GCC"; then | 41 | if test -n "$GCC"; then |
| 44 | 42 | ||
| 45 | dnl First, check -W -Werror -Wno-missing-field-initializers is supported | 43 | dnl Check if -W -Werror -Wno-missing-field-initializers is supported |
| 46 | dnl with the current $CC $CFLAGS $CPPFLAGS. | 44 | dnl with the current $CC $CFLAGS $CPPFLAGS. |
| 47 | AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) | 45 | AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) |
| 48 | AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ | 46 | AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ |
| @@ -77,8 +75,24 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], | |||
| 77 | ]) | 75 | ]) |
| 78 | AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) | 76 | AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) |
| 79 | fi | 77 | fi |
| 78 | |||
| 79 | dnl Next, check if -Werror -Wuninitialized is useful with the | ||
| 80 | dnl user's choice of $CFLAGS; some versions of gcc warn that it | ||
| 81 | dnl has no effect if -O is not also used | ||
| 82 | AC_MSG_CHECKING([whether -Wuninitialized is supported]) | ||
| 83 | AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [ | ||
| 84 | gl_save_CFLAGS="$CFLAGS" | ||
| 85 | CFLAGS="$CFLAGS -Werror -Wuninitialized" | ||
| 86 | AC_COMPILE_IFELSE( | ||
| 87 | [AC_LANG_PROGRAM([[]], [[]])], | ||
| 88 | [gl_cv_cc_uninitialized_supported=yes], | ||
| 89 | [gl_cv_cc_uninitialized_supported=no]) | ||
| 90 | CFLAGS="$gl_save_CFLAGS"]) | ||
| 91 | AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported]) | ||
| 92 | |||
| 80 | fi | 93 | fi |
| 81 | 94 | ||
| 95 | # List all gcc warning categories. | ||
| 82 | gl_manywarn_set= | 96 | gl_manywarn_set= |
| 83 | for gl_manywarn_item in \ | 97 | for gl_manywarn_item in \ |
| 84 | -W \ | 98 | -W \ |
| @@ -197,10 +211,14 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], | |||
| 197 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | 211 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" |
| 198 | done | 212 | done |
| 199 | 213 | ||
| 200 | # Disable the missing-field-initializers warning if needed | 214 | # Disable specific options as needed. |
| 201 | if test "$gl_cv_cc_nomfi_needed" = yes; then | 215 | if test "$gl_cv_cc_nomfi_needed" = yes; then |
| 202 | gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" | 216 | gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" |
| 203 | fi | 217 | fi |
| 204 | 218 | ||
| 219 | if test "$gl_cv_cc_uninitialized_supported" = no; then | ||
| 220 | gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized" | ||
| 221 | fi | ||
| 222 | |||
| 205 | $1=$gl_manywarn_set | 223 | $1=$gl_manywarn_set |
| 206 | ]) | 224 | ]) |
diff --git a/m4/pselect.m4 b/m4/pselect.m4 index 97bf12cd2d6..5edacd28f85 100644 --- a/m4/pselect.m4 +++ b/m4/pselect.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # pselect.m4 | 1 | # pselect.m4 serial 2 |
| 2 | dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -23,6 +23,44 @@ AC_DEFUN([gl_FUNC_PSELECT], | |||
| 23 | return !p;]])], | 23 | return !p;]])], |
| 24 | [gl_cv_sig_pselect=yes], | 24 | [gl_cv_sig_pselect=yes], |
| 25 | [gl_cv_sig_pselect=no])]) | 25 | [gl_cv_sig_pselect=no])]) |
| 26 | |||
| 27 | dnl On FreeBSD 8.2, pselect() doesn't always reject bad fds. | ||
| 28 | AC_CACHE_CHECK([whether pselect detects invalid fds], | ||
| 29 | [gl_cv_func_pselect_detects_ebadf], | ||
| 30 | [ | ||
| 31 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
| 32 | #include <sys/types.h> | ||
| 33 | #include <sys/time.h> | ||
| 34 | #if HAVE_SYS_SELECT_H | ||
| 35 | # include <sys/select.h> | ||
| 36 | #endif | ||
| 37 | #include <unistd.h> | ||
| 38 | #include <errno.h> | ||
| 39 | ]],[[ | ||
| 40 | fd_set set; | ||
| 41 | dup2(0, 16); | ||
| 42 | FD_ZERO(&set); | ||
| 43 | FD_SET(16, &set); | ||
| 44 | close(16); | ||
| 45 | struct timespec timeout; | ||
| 46 | timeout.tv_sec = 0; | ||
| 47 | timeout.tv_nsec = 5000; | ||
| 48 | return pselect (17, &set, NULL, NULL, &timeout, NULL) != -1 || errno != EBADF; | ||
| 49 | ]])], [gl_cv_func_pselect_detects_ebadf=yes], | ||
| 50 | [gl_cv_func_pselect_detects_ebadf=no], | ||
| 51 | [ | ||
| 52 | case "$host_os" in | ||
| 53 | # Guess yes on glibc systems. | ||
| 54 | *-gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; | ||
| 55 | # If we don't know, assume the worst. | ||
| 56 | *) gl_cv_func_pselect_detects_ebadf="guessing no" ;; | ||
| 57 | esac | ||
| 58 | ]) | ||
| 59 | ]) | ||
| 60 | case $gl_cv_func_pselect_detects_ebadf in | ||
| 61 | *yes) ;; | ||
| 62 | *) REPLACE_PSELECT=1 ;; | ||
| 63 | esac | ||
| 26 | fi | 64 | fi |
| 27 | 65 | ||
| 28 | if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then | 66 | if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then |
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index ab43728ace4..9c69f2e4d15 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 | |||
| @@ -102,6 +102,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 102 | REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) | 102 | REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) |
| 103 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) | 103 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) |
| 104 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) | 104 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) |
| 105 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) | ||
| 105 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) | 106 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) |
| 106 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) | 107 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) |
| 107 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) | 108 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) |
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index 8af3353ea51..f45dee1dc4d 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # sys_stat_h.m4 serial 28 -*- Autoconf -*- | 1 | # sys_stat_h.m4 serial 27 -*- Autoconf -*- |
| 2 | dnl Copyright (C) 2006-2012 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006-2012 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -11,6 +11,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], | |||
| 11 | [ | 11 | [ |
| 12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | 12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) |
| 13 | 13 | ||
| 14 | dnl For the mkdir substitute. | ||
| 15 | AC_REQUIRE([AC_C_INLINE]) | ||
| 16 | |||
| 14 | dnl Check for broken stat macros. | 17 | dnl Check for broken stat macros. |
| 15 | AC_REQUIRE([AC_HEADER_STAT]) | 18 | AC_REQUIRE([AC_HEADER_STAT]) |
| 16 | 19 | ||
diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 525868b2c70..d3d9bc657cc 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-10-04 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Merge from gnulib. | ||
| 4 | * msdos/sedlibmk.inp (REPLACE_PTSNAME): Edit to appropriate value. | ||
| 5 | |||
| 1 | 2012-09-27 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2012-09-27 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | Check more robustly for timer_settime. | 8 | Check more robustly for timer_settime. |
diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index 67719cffbd4..9879947ca45 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp | |||
| @@ -541,6 +541,7 @@ am__cd = cd | |||
| 541 | /^REPLACE_PRINTF *=/s/@REPLACE_PRINTF@/0/ | 541 | /^REPLACE_PRINTF *=/s/@REPLACE_PRINTF@/0/ |
| 542 | /^REPLACE_PTHREAD_SIGMASK *=/s/@REPLACE_PTHREAD_SIGMASK@/0/ | 542 | /^REPLACE_PTHREAD_SIGMASK *=/s/@REPLACE_PTHREAD_SIGMASK@/0/ |
| 543 | /^REPLACE_PSELECT *=/s/@REPLACE_PSELECT@/0/ | 543 | /^REPLACE_PSELECT *=/s/@REPLACE_PSELECT@/0/ |
| 544 | /^REPLACE_PTSNAME *=/s/@REPLACE_PTSNAME@/0/ | ||
| 544 | /^REPLACE_PTSNAME_R *=/s/@REPLACE_PTSNAME_R@/0/ | 545 | /^REPLACE_PTSNAME_R *=/s/@REPLACE_PTSNAME_R@/0/ |
| 545 | /^REPLACE_PUTENV *=/s/@REPLACE_PUTENV@/0/ | 546 | /^REPLACE_PUTENV *=/s/@REPLACE_PUTENV@/0/ |
| 546 | /^REPLACE_PWRITE *=/s/@REPLACE_PWRITE@/0/ | 547 | /^REPLACE_PWRITE *=/s/@REPLACE_PWRITE@/0/ |