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
This commit is contained in:
parent
b52f569dcf
commit
0a858ebfc5
13 changed files with 118 additions and 33 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-10-03 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
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 <eggert@cs.ucla.edu>
|
||||
|
||||
Merge from gnulib, incorporating:
|
||||
|
|
|
@ -96,7 +96,11 @@ rpl_dup2 (int fd, int desired_fd)
|
|||
/* 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)
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
|
||||
#include "msvc-inval.h"
|
||||
# include "msvc-inval.h"
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
static int
|
||||
_setmaxstdio_nothrow (int newmax)
|
||||
{
|
||||
|
@ -44,10 +44,11 @@ _setmaxstdio_nothrow (int newmax)
|
|||
|
||||
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 @@ getdtablesize (void)
|
|||
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
|
||||
|
|
|
@ -1707,6 +1707,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
-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' \
|
||||
|
|
|
@ -654,10 +654,19 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
|
|||
#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 !@HAVE_GETDTABLESIZE@
|
||||
# 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 !@HAVE_GETDTABLESIZE@
|
||||
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
|
||||
# endif
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (getdtablesize, int, (void));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (getdtablesize);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getdtablesize
|
||||
|
|
24
lib/verify.h
24
lib/verify.h
|
@ -250,6 +250,30 @@ template <int w>
|
|||
|
||||
#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
|
||||
|
|
|
@ -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 @@ AC_DEFUN([gl_FUNC_DUP2],
|
|||
/* 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 @@ AC_DEFUN([gl_FUNC_DUP2],
|
|||
*yes) ;;
|
||||
*)
|
||||
REPLACE_DUP2=1
|
||||
AC_CHECK_FUNCS([setdtablesize])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
|
|
@ -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 @@ dnl with or without modifications, as long as this notice is preserved.
|
|||
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
|
||||
])
|
||||
|
|
|
@ -433,7 +433,7 @@ AC_DEFUN([gl_INIT],
|
|||
{
|
||||
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
|
||||
|
|
|
@ -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 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
|
|||
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])
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
2013-10-03 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
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)
|
||||
|
|
|
@ -248,23 +248,6 @@ extern void _DebPrint (const char *fmt, ...);
|
|||
# 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. */
|
||||
|
|
|
@ -31,6 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <limits.h>
|
||||
|
||||
#include <intprops.h>
|
||||
#include <verify.h>
|
||||
|
||||
INLINE_HEADER_BEGIN
|
||||
|
||||
|
@ -1145,9 +1146,9 @@ struct Lisp_Vector
|
|||
/* ...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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue