emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114507: Merge from gnulib.


From: Paul Eggert
Subject: [Emacs-diffs] trunk r114507: Merge from gnulib.
Date: Thu, 03 Oct 2013 07:07:05 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114507
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-10-03 00:06:52 -0700
message:
  Merge from gnulib.
  
  * src/conf_post.h (__has_builtin, assume): Remove; gnulib now does these.
  * src/lisp.h: Include <verify.h>, for 'assume'.
  
  This also incorpoprates:
  2013-10-02 verify: new macro 'assume'
  2013-09-26 dup2, dup3: work around another cygwin crasher
  2013-09-26 getdtablesize: work around cygwin issue
modified:
  ChangeLog                      changelog-20091113204419-o5vbwnq5f7feedwu-1538
  lib/dup2.c                     dup2.c-20110625083406-63degt3yfgh69g2d-1
  lib/getdtablesize.c            
getdtablesize.c-20130707175726-ax31vjqobh17obwz-2
  lib/gnulib.mk                  gnulib.mk-20110108211121-3ig4un4ogtyyca3s-7
  lib/unistd.in.h                unistd.in.h-20110109071402-7rc382anf65r2ire-6
  lib/verify.h                   verify.h-20110421191200-5ih8ukr2dul27ngf-9
  m4/dup2.m4                     dup2.m4-20110625083406-63degt3yfgh69g2d-2
  m4/getdtablesize.m4            
getdtablesize.m4-20130707175726-ax31vjqobh17obwz-5
  m4/gnulib-comp.m4              glcomp.m4-20110127072028-6mkjqxjzdsx0wp15-1
  m4/unistd_h.m4                 unistd_h.m4-20110109071402-7rc382anf65r2ire-7
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/conf_post.h                conf_post.h-20120730211826-q0qbxxwh2emw52hd-1
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'ChangeLog'
--- a/ChangeLog 2013-09-25 03:44:34 +0000
+++ b/ChangeLog 2013-10-03 07:06:52 +0000
@@ -1,3 +1,10 @@
+2013-10-03  Paul Eggert  <address@hidden>
+
+       Merge from gnulib, incorporating:
+       2013-10-02 verify: new macro 'assume'
+       2013-09-26 dup2, dup3: work around another cygwin crasher
+       2013-09-26 getdtablesize: work around cygwin issue
+
 2013-09-25  Paul Eggert  <address@hidden>
 
        Merge from gnulib, incorporating:

=== modified file 'lib/dup2.c'
--- a/lib/dup2.c        2013-01-02 16:37:04 +0000
+++ b/lib/dup2.c        2013-10-03 07:06:52 +0000
@@ -96,7 +96,11 @@
   /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
      On Cygwin 1.5.x, dup2 (1, 1) returns 0.
      On Cygwin 1.7.17, dup2 (1, -1) dumps core.
+     On Cygwin 1.7.25, dup2 (1, 256) can dump core.
      On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC.  */
+#  if HAVE_SETDTABLESIZE
+  setdtablesize (desired_fd + 1);
+#  endif
   if (desired_fd < 0)
     fd = desired_fd;
   if (fd == desired_fd)

=== modified file 'lib/getdtablesize.c'
--- a/lib/getdtablesize.c       2013-07-07 18:00:14 +0000
+++ b/lib/getdtablesize.c       2013-10-03 07:06:52 +0000
@@ -22,11 +22,11 @@
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
-#include <stdio.h>
-
-#include "msvc-inval.h"
-
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include <stdio.h>
+
+# include "msvc-inval.h"
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static int
 _setmaxstdio_nothrow (int newmax)
 {
@@ -44,10 +44,11 @@
 
   return result;
 }
-# define _setmaxstdio _setmaxstdio_nothrow
-#endif
+#  define _setmaxstdio _setmaxstdio_nothrow
+# endif
 
-/* Cache for the previous getdtablesize () result.  */
+/* Cache for the previous getdtablesize () result.  Safe to cache because
+   Windows also lacks setrlimit.  */
 static int dtablesize;
 
 int
@@ -83,4 +84,24 @@
   return dtablesize;
 }
 
+#elif HAVE_GETDTABLESIZE
+
+# include <sys/resource.h>
+# undef getdtablesize
+
+int
+rpl_getdtablesize(void)
+{
+  /* To date, this replacement is only compiled for Cygwin 1.7.25,
+     which auto-increased the RLIMIT_NOFILE soft limit until it
+     hits the compile-time constant hard limit of 3200.  Although
+     that version of cygwin supported a child process inheriting
+     a smaller soft limit, the smaller limit is not enforced, so
+     we might as well just report the hard limit.  */
+  struct rlimit lim;
+  if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY)
+    return lim.rlim_max;
+  return getdtablesize ();
+}
+
 #endif

=== modified file 'lib/gnulib.mk'
--- a/lib/gnulib.mk     2013-08-04 16:56:56 +0000
+++ b/lib/gnulib.mk     2013-10-03 07:06:52 +0000
@@ -1707,6 +1707,7 @@
              -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
+             -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
              -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
              -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \

=== modified file 'lib/unistd.in.h'
--- a/lib/unistd.in.h   2013-09-19 21:40:08 +0000
+++ b/lib/unistd.in.h   2013-10-03 07:06:52 +0000
@@ -654,10 +654,19 @@
 #if @GNULIB_GETDTABLESIZE@
 /* Return the maximum number of file descriptors in the current process.
    In POSIX, this is same as sysconf (_SC_OPEN_MAX).  */
-# if address@hidden@
+# if @REPLACE_GETDTABLESIZE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getdtablesize
+#   define getdtablesize rpl_getdtablesize
+#  endif
+_GL_FUNCDECL_RPL (getdtablesize, int, (void));
+_GL_CXXALIAS_RPL (getdtablesize, int, (void));
+# else
+#  if address@hidden@
 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
+# endif
 _GL_CXXALIASWARN (getdtablesize);
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize

=== modified file 'lib/verify.h'
--- a/lib/verify.h      2013-07-08 06:15:38 +0000
+++ b/lib/verify.h      2013-10-03 07:06:52 +0000
@@ -250,6 +250,30 @@
 
 #define verify(R) _GL_VERIFY (R, "verify (" #R ")")
 
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
+/* Assume that R always holds.  This lets the compiler optimize
+   accordingly.  R should not have side-effects; it may or may not be
+   evaluated.  Behavior is undefined if R is false.  */
+
+#if (__has_builtin (__builtin_unreachable) \
+     || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))
+# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
+#elif 1200 <= _MSC_VER
+# define assume(R) __assume (R)
+#elif (defined lint \
+       && (__has_builtin (__builtin_trap) \
+           || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= 
__GNUC_PATCHLEVEL__))))
+  /* Doing it this way helps various packages when configured with
+     --enable-gcc-warnings, which compiles with -Dlint.  It's nicer
+     when 'assume' silences warnings even with older GCCs.  */
+# define assume(R) ((R) ? (void) 0 : __builtin_trap ())
+#else
+# define assume(R) ((void) (0 && (R)))
+#endif
+
 /* @assert.h omit end@  */
 
 #endif

=== modified file 'm4/dup2.m4'
--- a/m4/dup2.m4        2013-01-02 16:37:04 +0000
+++ b/m4/dup2.m4        2013-10-03 07:06:52 +0000
@@ -1,4 +1,4 @@
-#serial 19
+#serial 20
 dnl Copyright (C) 2002, 2005, 2007, 2009-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,9 +39,11 @@
             /* Many gnulib modules require POSIX conformance of EBADF.  */
             if (dup2 (2, 1000000) == -1 && errno != EBADF)
               result |= 16;
-            /* Flush out a cygwin core dump.  */
+            /* Flush out some cygwin core dumps.  */
             if (dup2 (2, -1) != -1 || errno != EBADF)
               result |= 32;
+            dup2 (2, 255);
+            dup2 (2, 256);
             return result;
            ])
         ],
@@ -65,6 +67,7 @@
       *yes) ;;
       *)
         REPLACE_DUP2=1
+        AC_CHECK_FUNCS([setdtablesize])
         ;;
     esac
   fi

=== modified file 'm4/getdtablesize.m4'
--- a/m4/getdtablesize.m4       2013-07-07 18:00:14 +0000
+++ b/m4/getdtablesize.m4       2013-10-03 07:06:52 +0000
@@ -1,4 +1,4 @@
-# getdtablesize.m4 serial 4
+# getdtablesize.m4 serial 5
 dnl Copyright (C) 2008-2013 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,8 +7,35 @@
 AC_DEFUN([gl_FUNC_GETDTABLESIZE],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CHECK_FUNCS_ONCE([getdtablesize])
-  if test $ac_cv_func_getdtablesize != yes; then
+  if test $ac_cv_func_getdtablesize = yes; then
+    # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
+    # up to an unchangeable hard limit; all other platforms correctly
+    # require setrlimit before getdtablesize() can report a larger value.
+    AC_CACHE_CHECK([whether getdtablesize works],
+      [gl_cv_func_getdtablesize_works],
+      [AC_RUN_IFELSE([
+        AC_LANG_PROGRAM([[#include <unistd.h>]],
+          [int size = getdtablesize();
+           if (dup2 (0, getdtablesize()) != -1)
+             return 1;
+           if (size != getdtablesize())
+             return 2;
+          ])],
+        [gl_cv_func_getdtablesize_works=yes],
+        [gl_cv_func_getdtablesize_works=no],
+        [case "$host_os" in
+          cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
+            gl_cv_func_getdtablesize_works="guessing no" ;;
+          *) gl_cv_func_getdtablesize_works="guessing yes" ;;
+         esac])
+      ])
+    case "$gl_cv_func_getdtablesize_works" in
+      *yes) ;;
+      *) REPLACE_GETDTABLESIZE=1 ;;
+    esac
+  else
     HAVE_GETDTABLESIZE=0
   fi
 ])

=== modified file 'm4/gnulib-comp.m4'
--- a/m4/gnulib-comp.m4 2013-08-12 00:52:17 +0000
+++ b/m4/gnulib-comp.m4 2013-10-03 07:06:52 +0000
@@ -433,7 +433,7 @@
   {
     if ! $gl_gnulib_enabled_getdtablesize; then
       gl_FUNC_GETDTABLESIZE
-      if test $HAVE_GETDTABLESIZE = 0; then
+      if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then
         AC_LIBOBJ([getdtablesize])
         gl_PREREQ_GETDTABLESIZE
       fi

=== modified file 'm4/unistd_h.m4'
--- a/m4/unistd_h.m4    2013-01-02 16:37:04 +0000
+++ b/m4/unistd_h.m4    2013-10-03 07:06:52 +0000
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 66
+# unistd_h.m4 serial 67
 dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -160,6 +160,7 @@
   REPLACE_FTRUNCATE=0;    AC_SUBST([REPLACE_FTRUNCATE])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
+  REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
   REPLACE_GETLOGIN_R=0;   AC_SUBST([REPLACE_GETLOGIN_R])
   REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-03 06:31:06 +0000
+++ b/src/ChangeLog     2013-10-03 07:06:52 +0000
@@ -1,5 +1,9 @@
 2013-10-03  Paul Eggert  <address@hidden>
 
+       Adjust to merge from gnulib.
+       * conf_post.h (__has_builtin, assume): Remove; gnulib now does these.
+       * lisp.h: Include <verify.h>, for 'assume'.
+
        * eval.c (clobbered_eassert): New macro.
        (internal_catch, internal_condition_case)
        (internal_condition_case_1, internal_condition_case_2)

=== modified file 'src/conf_post.h'
--- a/src/conf_post.h   2013-09-24 04:28:06 +0000
+++ b/src/conf_post.h   2013-10-03 07:06:52 +0000
@@ -248,23 +248,6 @@
 # define FLEXIBLE_ARRAY_MEMBER 1
 #endif
 
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-/* Tell the compiler (and lint) that COND will always hold, and that
-   it should optimize (or check) accordingly.  */
-#if (__has_builtin (__builtin_unreachable) \
-     || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || __GNUC__ > 4)
-# define assume(cond) ((cond) ? (void) 0 : __builtin_unreachable ())
-#elif defined _MSC_VER
-# define assume(cond) __assume (cond)
-#elif defined lint
-# define assume(cond) ((cond) ? (void) 0 : abort ())
-#else
-# define assume(cond) ((void) (0 && (cond)))
-#endif
-
 /* Use this to suppress gcc's `...may be used before initialized' warnings. */
 #ifdef lint
 /* Use CODE only if lint checking is in effect.  */

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2013-10-03 04:58:56 +0000
+++ b/src/lisp.h        2013-10-03 07:06:52 +0000
@@ -31,6 +31,7 @@
 #include <limits.h>
 
 #include <intprops.h>
+#include <verify.h>
 
 INLINE_HEADER_BEGIN
 
@@ -1145,9 +1146,9 @@
       /* ...but sometimes there is also a pointer internally used in
         vector allocation code.  Usually you don't want to touch this.  */
       struct Lisp_Vector *next;
-      
+
       /* We can't use FLEXIBLE_ARRAY_MEMBER here.  */
-      Lisp_Object contents[1]; 
+      Lisp_Object contents[1];
     } u;
   };
 


reply via email to

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