emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110356: Merge from gnulib.


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110356: Merge from gnulib.
Date: Thu, 04 Oct 2012 00:15:42 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110356
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2012-10-04 00:15:42 -0700
message:
  Merge from gnulib.
modified:
  ChangeLog
  lib/gnulib.mk
  lib/pselect.c
  lib/stdlib.in.h
  m4/manywarnings.m4
  m4/pselect.m4
  m4/stdlib_h.m4
  m4/sys_stat_h.m4
  msdos/ChangeLog
  msdos/sedlibmk.inp
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-10-04 00:10:47 +0000
+++ b/ChangeLog 2012-10-04 07:15:42 +0000
@@ -1,5 +1,14 @@
 2012-10-04  Paul Eggert  <address@hidden>
 
+       Merge from gnulib, incorporating:
+       2012-10-02 pselect: reject invalid file descriptors
+       2012-10-02 ptsname: reject invalid file descriptors
+       2012-10-02 manywarnings: cater to more gcc infelicities
+       2012-09-30 sockets, sys_stat: restore AC_C_INLINE
+       * lib/pselect.c, lib/stdlib.in.h, m4/manywarnings.m4, m4/pselect.m4:
+       * m4/stdlib_h.m4, m4/sys_stat_h.m4: Update from gnulib.
+       * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+
        Port timers to OpenBSD, plus check for timer failures.
        OpenBSD problem reported by Han Boetes.
        * profiler.c (setup_cpu_timer): Check for failure of timer_settime

=== modified file 'lib/gnulib.mk'
--- a/lib/gnulib.mk     2012-09-27 01:06:23 +0000
+++ b/lib/gnulib.mk     2012-10-04 07:15:42 +0000
@@ -857,6 +857,7 @@
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
              -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \

=== modified file 'lib/pselect.c'
--- a/lib/pselect.c     2012-06-22 21:26:37 +0000
+++ b/lib/pselect.c     2012-10-04 07:15:42 +0000
@@ -33,6 +33,8 @@
    pointer parameter stands for no descriptors, an infinite timeout,
    or an unaffected signal mask.  */
 
+#if !HAVE_PSELECT
+
 int
 pselect (int nfds, fd_set *restrict rfds,
          fd_set *restrict wfds, fd_set *restrict xfds,
@@ -74,3 +76,35 @@
 
   return select_result;
 }
+
+#else /* HAVE_PSELECT */
+# include <unistd.h>
+# undef pselect
+
+int
+rpl_pselect (int nfds, fd_set *restrict rfds,
+            fd_set *restrict wfds, fd_set *restrict xfds,
+             struct timespec const *restrict timeout,
+            sigset_t const *restrict sigmask)
+{
+  int i;
+
+  /* FreeBSD 8.2 has a bug: it does not always detect invalid fds.  */
+  if (nfds < 0 || nfds > FD_SETSIZE)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  for (i = 0; i < nfds; i++)
+    {
+      if (((rfds && FD_ISSET (i, rfds))
+           || (wfds && FD_ISSET (i, wfds))
+           || (xfds && FD_ISSET (i, xfds)))
+          && dup2 (i, i) != i)
+        return -1;
+    }
+
+  return pselect (nfds, rfds, wfds, xfds, timeout, sigmask);
+}
+
+#endif

=== modified file 'lib/stdlib.in.h'
--- a/lib/stdlib.in.h   2012-06-22 17:20:00 +0000
+++ b/lib/stdlib.in.h   2012-10-04 07:15:42 +0000
@@ -457,10 +457,19 @@
 #if @GNULIB_PTSNAME@
 /* Return the pathname of the pseudo-terminal slave associated with
    the master FD is open on, or NULL on errors.  */
-# if address@hidden@
+# if @REPLACE_PTSNAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPCE)
+#   undef ptsname
+#   define ptsname rpl_ptsname
+#  endif
+_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
+_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
+# else
+#  if address@hidden@
 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
+# endif
 _GL_CXXALIASWARN (ptsname);
 #elif defined GNULIB_POSIXCHECK
 # undef ptsname

=== modified file 'm4/manywarnings.m4'
--- a/m4/manywarnings.m4        2012-09-03 09:26:56 +0000
+++ b/m4/manywarnings.m4        2012-10-04 07:15:42 +0000
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 4
+# manywarnings.m4 serial 5
 dnl Copyright (C) 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,
@@ -35,14 +35,12 @@
 # make sure your gcc understands it.
 AC_DEFUN([gl_MANYWARN_ALL_GCC],
 [
-  dnl First, check if -Wno-missing-field-initializers is needed.
-  dnl -Wmissing-field-initializers is implied by -W, but that issues
-  dnl warnings with GCC version before 4.7, for the common idiom
-  dnl of initializing types on the stack to zero, using { 0, }
+  dnl First, check for some issues that only occur when combining multiple
+  dnl gcc warning categories.
   AC_REQUIRE([AC_PROG_CC])
   if test -n "$GCC"; then
 
-    dnl First, check -W -Werror -Wno-missing-field-initializers is supported
+    dnl Check if -W -Werror -Wno-missing-field-initializers is supported
     dnl with the current $CC $CFLAGS $CPPFLAGS.
     AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
     AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
@@ -77,8 +75,24 @@
       ])
       AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
     fi
+
+    dnl Next, check if -Werror -Wuninitialized is useful with the
+    dnl user's choice of $CFLAGS; some versions of gcc warn that it
+    dnl has no effect if -O is not also used
+    AC_MSG_CHECKING([whether -Wuninitialized is supported])
+    AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Werror -Wuninitialized"
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]], [[]])],
+        [gl_cv_cc_uninitialized_supported=yes],
+        [gl_cv_cc_uninitialized_supported=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
+
   fi
 
+  # List all gcc warning categories.
   gl_manywarn_set=
   for gl_manywarn_item in \
     -W \
@@ -197,10 +211,14 @@
     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
   done
 
-  # Disable the missing-field-initializers warning if needed
+  # Disable specific options as needed.
   if test "$gl_cv_cc_nomfi_needed" = yes; then
     gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
   fi
 
+  if test "$gl_cv_cc_uninitialized_supported" = no; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+  fi
+
   $1=$gl_manywarn_set
 ])

=== modified file 'm4/pselect.m4'
--- a/m4/pselect.m4     2012-06-22 21:26:37 +0000
+++ b/m4/pselect.m4     2012-10-04 07:15:42 +0000
@@ -1,4 +1,4 @@
-# pselect.m4
+# pselect.m4 serial 2
 dnl Copyright (C) 2011-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,
@@ -23,6 +23,44 @@
                 return !p;]])],
          [gl_cv_sig_pselect=yes],
          [gl_cv_sig_pselect=no])])
+
+    dnl On FreeBSD 8.2, pselect() doesn't always reject bad fds.
+    AC_CACHE_CHECK([whether pselect detects invalid fds],
+      [gl_cv_func_pselect_detects_ebadf],
+      [
+        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/time.h>
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+]],[[
+  fd_set set;
+  dup2(0, 16);
+  FD_ZERO(&set);
+  FD_SET(16, &set);
+  close(16);
+  struct timespec timeout;
+  timeout.tv_sec = 0;
+  timeout.tv_nsec = 5000;
+  return pselect (17, &set, NULL, NULL, &timeout, NULL) != -1 || errno != 
EBADF;
+]])], [gl_cv_func_pselect_detects_ebadf=yes],
+      [gl_cv_func_pselect_detects_ebadf=no],
+          [
+           case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_pselect_detects_ebadf="guessing no" ;;
+           esac
+          ])
+      ])
+    case $gl_cv_func_pselect_detects_ebadf in
+      *yes) ;;
+      *) REPLACE_PSELECT=1 ;;
+    esac
   fi
 
   if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then

=== modified file 'm4/stdlib_h.m4'
--- a/m4/stdlib_h.m4    2012-05-26 23:14:36 +0000
+++ b/m4/stdlib_h.m4    2012-10-04 07:15:42 +0000
@@ -102,6 +102,7 @@
   REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
   REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_PTSNAME=0;         AC_SUBST([REPLACE_PTSNAME])
   REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_RANDOM_R=0;        AC_SUBST([REPLACE_RANDOM_R])

=== modified file 'm4/sys_stat_h.m4'
--- a/m4/sys_stat_h.m4  2012-09-22 09:46:20 +0000
+++ b/m4/sys_stat_h.m4  2012-10-04 07:15:42 +0000
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 28   -*- Autoconf -*-
+# sys_stat_h.m4 serial 27   -*- 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,6 +11,9 @@
 [
   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])
 

=== modified file 'msdos/ChangeLog'
--- a/msdos/ChangeLog   2012-09-27 23:02:23 +0000
+++ b/msdos/ChangeLog   2012-10-04 07:15:42 +0000
@@ -1,3 +1,8 @@
+2012-10-04  Paul Eggert  <address@hidden>
+
+       Merge from gnulib.
+       * msdos/sedlibmk.inp (REPLACE_PTSNAME): Edit to appropriate value.
+
 2012-09-27  Paul Eggert  <address@hidden>
 
        Check more robustly for timer_settime.

=== modified file 'msdos/sedlibmk.inp'
--- a/msdos/sedlibmk.inp        2012-08-04 08:58:33 +0000
+++ b/msdos/sedlibmk.inp        2012-10-04 07:15:42 +0000
@@ -541,6 +541,7 @@
 /^REPLACE_PRINTF *=/s/@REPLACE_PRINTF@/0/
 /^REPLACE_PTHREAD_SIGMASK *=/s/@REPLACE_PTHREAD_SIGMASK@/0/
 /^REPLACE_PSELECT *=/s/@REPLACE_PSELECT@/0/
+/^REPLACE_PTSNAME *=/s/@REPLACE_PTSNAME@/0/
 /^REPLACE_PTSNAME_R *=/s/@REPLACE_PTSNAME_R@/0/
 /^REPLACE_PUTENV *=/s/@REPLACE_PUTENV@/0/
 /^REPLACE_PWRITE *=/s/@REPLACE_PWRITE@/0/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]