* bug#12446: port better to POSIX hosts lacking _setjmp
@ 2012-09-14 19:44 Paul Eggert
2012-09-14 20:30 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Paul Eggert @ 2012-09-14 19:44 UTC (permalink / raw)
To: 12446; +Cc: Juanma Barranquero
Tags: patch
Here's a patch I plan to install after a bit more testing. It affects
the use of setjmp / _setjmp and so the Windows port probably needs to
be updated (for the symbols HAVE__SETJMP and/or HAVE_SIGSETJMP). I
don't think it breaks anything in Windows but have not looked at the
Windows port closely and I could be mistaken. I'm CC'ing this to Eli
and Juanma as a heads-up.
=== modified file 'ChangeLog'
--- ChangeLog 2012-09-14 18:56:19 +0000
+++ ChangeLog 2012-09-14 19:35:57 +0000
@@ -1,5 +1,9 @@
2012-09-14 Paul Eggert <eggert@cs.ucla.edu>
+ Port better to POSIX hosts lacking _setjmp.
+ * configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols.
+ (_setjmp, _longjmp): Remove.
+
* configure.ac: Port to hosts lacking gtk.
(PKG_CHECK_MODULES): Capture pkg-config diagnostics
better, in particular, problems in invoking pkg-config itself.
=== modified file 'configure.ac'
--- configure.ac 2012-09-14 18:56:19 +0000
+++ configure.ac 2012-09-14 19:35:57 +0000
@@ -3774,13 +3774,24 @@
_longjmp (j, 1);]])],
[emacs_cv_func__setjmp=yes],
[emacs_cv_func__setjmp=no])])
-if test $emacs_cv_func__setjmp = no; then
- AC_DEFINE([_setjmp], [setjmp],
- [Define to setjmp if _setjmp and _longjmp do not work. See _longjmp.])
- AC_DEFINE([_longjmp], [longjmp],
- [Define to longjmp if _setjmp and _longjmp do not work.
- Because longjmp may alter signal masks, callers of _longjmp
- should not assume that it leaves signal masks alone.])
+if test $emacs_cv_func__setjmp = yes; then
+ AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.])
+else
+ AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <setjmp.h>
+ ]],
+ [[sigjmp_buf j;
+ if (! sigsetjmp (j, 1))
+ siglongjmp (j, 1);]])],
+ [emacs_cv_func_sigsetjmp=yes],
+ [emacs_cv_func_sigsetjmp=no])])
+ if test $emacs_cv_func_sigsetjmp = yes; then
+ AC_DEFINE([HAVE_SIGSETJMP], 1,
+ [Define to 1 if sigsetjmp and siglongjmp work.
+ The value of this symbol is irrelevant if HAVE__SETJMP is defined.])
+ fi
fi
case $opsys in
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2012-09-14 14:23:50 +0000
+++ src/ChangeLog 2012-09-14 19:35:57 +0000
@@ -1,3 +1,24 @@
+2012-09-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ Port better to POSIX hosts lacking _setjmp.
+ * lisp.h: Include <setjmp.h> here, since we use its symbols here.
+ All instances of '#include <setjmp.h>' removed, if the
+ only reason for the instance was because "lisp.h" was included.
+ (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols.
+ Unless otherwise specified, replace all uses of jmp_buf, _setjmp,
+ and _longjmp with the new symbols. This ports better to POSIX hosts
+ that have sigsetjmp but not _setjmp, such as some versions of
+ Solaris and Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.)
+ * image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros.
+ (png_load_body) [HAVE_PNG]:
+ (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]:
+ (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]:
+ Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp,
+ since PNG requires jmp_buf. This is the only exception to the
+ general rule that we now use sys_setjmp and sys_longjmp.
+ This exception is OK since this code does not change the signal
+ mask or longjmp out of a signal handler.
+
2012-09-14 Dmitry Antipov <dmantipov@yandex.ru>
Avoid out-of-range marker position (Bug#12426).
=== modified file 'src/alloc.c'
--- src/alloc.c 2012-09-13 05:18:26 +0000
+++ src/alloc.c 2012-09-14 19:35:57 +0000
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <limits.h> /* For CHAR_BIT. */
-#include <setjmp.h>
#ifdef ENABLE_CHECKING
#include <signal.h> /* For SIGABRT. */
@@ -45,7 +44,7 @@
#include "frame.h"
#include "blockinput.h"
#include "termhooks.h" /* For struct terminal. */
-#include <setjmp.h>
+
#include <verify.h>
/* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
@@ -4762,14 +4761,14 @@
{
char buf[10];
register int x;
- jmp_buf jbuf;
+ sys_jmp_buf jbuf;
/* Arrange for X to be put in a register. */
sprintf (buf, "1");
x = strlen (buf);
x = 2 * x - 1;
- _setjmp (jbuf);
+ sys_setjmp (jbuf);
if (longjmps_done == 1)
{
/* Came here after the longjmp at the end of the function.
@@ -4794,7 +4793,7 @@
++longjmps_done;
x = 2;
if (longjmps_done == 1)
- _longjmp (jbuf, 1);
+ sys_longjmp (jbuf, 1);
}
#endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */
@@ -4900,7 +4899,7 @@
/* jmp_buf may not be aligned enough on darwin-ppc64 */
union aligned_jmpbuf {
Lisp_Object o;
- jmp_buf j;
+ sys_jmp_buf j;
} j;
volatile bool stack_grows_down_p = (char *) &j > (char *) stack_base;
#endif
@@ -4936,7 +4935,7 @@
}
#endif /* GC_SETJMP_WORKS */
- _setjmp (j.j);
+ sys_setjmp (j.j);
end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
#endif /* not GC_SAVE_REGISTERS_ON_STACK */
#endif /* not HAVE___BUILTIN_UNWIND_INIT */
=== modified file 'src/atimer.c'
--- src/atimer.c 2012-09-07 01:27:44 +0000
+++ src/atimer.c 2012-09-14 19:35:57 +0000
@@ -18,7 +18,7 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "syssignal.h"
#include "systime.h"
=== modified file 'src/bidi.c'
--- src/bidi.c 2012-09-11 22:59:50 +0000
+++ src/bidi.c 2012-09-14 19:35:57 +0000
@@ -56,7 +56,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/buffer.c'
--- src/buffer.c 2012-09-11 04:22:03 +0000
+++ src/buffer.c 2012-09-14 19:35:57 +0000
@@ -26,7 +26,6 @@
#include <sys/param.h>
#include <errno.h>
#include <stdio.h>
-#include <setjmp.h>
#include <unistd.h>
#include <verify.h>
=== modified file 'src/bytecode.c'
--- src/bytecode.c 2012-09-04 17:34:54 +0000
+++ src/bytecode.c 2012-09-14 19:35:57 +0000
@@ -33,7 +33,7 @@
*/
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/callint.c'
--- src/callint.c 2012-08-25 03:11:12 +0000
+++ src/callint.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,6 @@
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/callproc.c'
--- src/callproc.c 2012-09-07 01:27:44 +0000
+++ src/callproc.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
-#include <setjmp.h>
#include <sys/types.h>
#include <unistd.h>
=== modified file 'src/casefiddle.c'
--- src/casefiddle.c 2012-08-25 06:25:00 +0000
+++ src/casefiddle.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,7 @@
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/casetab.c'
--- src/casetab.c 2012-08-25 06:25:00 +0000
+++ src/casetab.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,7 @@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/category.c'
--- src/category.c 2012-08-25 06:25:00 +0000
+++ src/category.c 2012-09-14 19:35:57 +0000
@@ -32,7 +32,6 @@
#define CATEGORY_INLINE EXTERN_INLINE
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/ccl.c'
--- src/ccl.c 2012-07-05 06:32:41 +0000
+++ src/ccl.c 2012-09-14 19:35:57 +0000
@@ -26,7 +26,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <limits.h>
#include "lisp.h"
=== modified file 'src/character.c'
--- src/character.c 2012-09-04 17:34:54 +0000
+++ src/character.c 2012-09-14 19:35:57 +0000
@@ -36,7 +36,6 @@
#ifdef emacs
#include <sys/types.h>
-#include <setjmp.h>
#include <intprops.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/charset.c'
--- src/charset.c 2012-09-04 17:34:54 +0000
+++ src/charset.c 2012-09-14 19:35:57 +0000
@@ -32,7 +32,6 @@
#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
-#include <setjmp.h>
#include <c-ctype.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/chartab.c'
--- src/chartab.c 2012-08-26 08:41:36 +0000
+++ src/chartab.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,7 @@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "charset.h"
=== modified file 'src/cm.c'
--- src/cm.c 2012-09-04 17:34:54 +0000
+++ src/cm.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "frame.h"
=== modified file 'src/cmds.c'
--- src/cmds.c 2012-08-27 16:19:34 +0000
+++ src/cmds.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,7 @@
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "commands.h"
#include "character.h"
=== modified file 'src/coding.c'
--- src/coding.c 2012-09-04 17:34:54 +0000
+++ src/coding.c 2012-09-14 19:35:57 +0000
@@ -285,7 +285,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/composite.c'
--- src/composite.c 2012-08-27 17:23:48 +0000
+++ src/composite.c 2012-09-14 19:35:57 +0000
@@ -26,7 +26,6 @@
#define COMPOSITE_INLINE EXTERN_INLINE
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/data.c'
--- src/data.c 2012-09-12 19:16:36 +0000
+++ src/data.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <intprops.h>
=== modified file 'src/dbusbind.c'
--- src/dbusbind.c 2012-08-27 17:23:48 +0000
+++ src/dbusbind.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,7 @@
#ifdef HAVE_DBUS
#include <stdio.h>
#include <dbus/dbus.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "frame.h"
#include "termhooks.h"
=== modified file 'src/dired.c'
--- src/dired.c 2012-09-04 17:34:54 +0000
+++ src/dired.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
=== modified file 'src/dispnew.c'
--- src/dispnew.c 2012-09-13 02:21:28 +0000
+++ src/dispnew.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,6 @@
#define DISPEXTERN_INLINE EXTERN_INLINE
#include <stdio.h>
-#include <setjmp.h>
#include <unistd.h>
#include "lisp.h"
=== modified file 'src/doc.c'
--- src/doc.c 2012-09-03 19:36:09 +0000
+++ src/doc.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,6 @@
#include <sys/types.h>
#include <sys/file.h> /* Must be after sys/types.h for USG*/
-#include <setjmp.h>
#include <fcntl.h>
#include <unistd.h>
=== modified file 'src/doprnt.c'
--- src/doprnt.c 2012-09-09 16:06:33 +0000
+++ src/doprnt.c 2012-09-14 19:35:57 +0000
@@ -102,7 +102,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <float.h>
#include <unistd.h>
#include <limits.h>
=== modified file 'src/dosfns.c'
--- src/dosfns.c 2012-08-17 21:52:15 +0000
+++ src/dosfns.c 2012-09-14 19:35:57 +0000
@@ -30,7 +30,7 @@
#include <dos.h>
#undef gettime
#undef settime
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/editfns.c'
--- src/editfns.c 2012-09-11 04:22:03 +0000
+++ src/editfns.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <sys/types.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
=== modified file 'src/emacs.c'
--- src/emacs.c 2012-09-13 02:21:28 +0000
+++ src/emacs.c 2012-09-14 19:35:57 +0000
@@ -25,7 +25,6 @@
#include <sys/types.h>
#include <sys/file.h>
-#include <setjmp.h>
#include <unistd.h>
#include "lisp.h"
=== modified file 'src/emacsgtkfixed.c'
--- src/emacsgtkfixed.c 2012-09-13 04:14:33 +0000
+++ src/emacsgtkfixed.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,7 @@
#include "emacsgtkfixed.h"
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "frame.h"
#include "xterm.h"
=== modified file 'src/eval.c'
--- src/eval.c 2012-09-12 21:34:24 +0000
+++ src/eval.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,6 @@
#include <config.h>
#include <limits.h>
-#include <setjmp.h>
#include <stdio.h>
#include "lisp.h"
#include "blockinput.h"
@@ -1072,7 +1071,7 @@
catchlist = &c;
/* Call FUNC. */
- if (! _setjmp (c.jmp))
+ if (! sys_setjmp (c.jmp))
c.val = (*func) (arg);
/* Throw works by a longjmp that comes right here. */
@@ -1140,7 +1139,7 @@
backtrace_list = catch->backlist;
lisp_eval_depth = catch->lisp_eval_depth;
- _longjmp (catch->jmp, 1);
+ sys_longjmp (catch->jmp, 1);
}
DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0,
@@ -1246,7 +1245,7 @@
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
if (!NILP (h.var))
specbind (h.var, c.val);
@@ -1301,7 +1300,7 @@
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val);
}
@@ -1339,7 +1338,7 @@
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val);
}
@@ -1381,7 +1380,7 @@
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val);
}
@@ -1425,7 +1424,7 @@
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val, nargs, args);
}
=== modified file 'src/fileio.c'
--- src/fileio.c 2012-09-05 07:18:46 +0000
+++ src/fileio.c 2012-09-14 19:35:57 +0000
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <setjmp.h>
#include <unistd.h>
#ifdef HAVE_PWD_H
=== modified file 'src/filelock.c'
--- src/filelock.c 2012-09-05 07:18:46 +0000
+++ src/filelock.c 2012-09-14 19:35:57 +0000
@@ -23,7 +23,6 @@
#include <sys/stat.h>
#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
=== modified file 'src/floatfns.c'
--- src/floatfns.c 2012-09-11 02:28:27 +0000
+++ src/floatfns.c 2012-09-14 19:35:57 +0000
@@ -29,7 +29,7 @@
*/
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "syssignal.h"
=== modified file 'src/fns.c'
--- src/fns.c 2012-09-11 22:59:50 +0000
+++ src/fns.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <time.h>
-#include <setjmp.h>
#include <intprops.h>
=== modified file 'src/font.c'
--- src/font.c 2012-09-06 08:04:49 +0000
+++ src/font.c 2012-09-14 19:35:57 +0000
@@ -23,7 +23,6 @@
#include <config.h>
#include <float.h>
#include <stdio.h>
-#include <setjmp.h>
#include <c-ctype.h>
=== modified file 'src/fontset.c'
--- src/fontset.c 2012-09-06 08:04:49 +0000
+++ src/fontset.c 2012-09-14 19:35:57 +0000
@@ -26,7 +26,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "blockinput.h"
=== modified file 'src/frame.c'
--- src/frame.c 2012-09-13 05:18:26 +0000
+++ src/frame.c 2012-09-14 19:35:57 +0000
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <errno.h>
#include <limits.h>
-#include <setjmp.h>
#include <c-ctype.h>
=== modified file 'src/fringe.c'
--- src/fringe.c 2012-09-09 20:10:36 +0000
+++ src/fringe.c 2012-09-14 19:35:57 +0000
@@ -18,7 +18,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "frame.h"
=== modified file 'src/ftfont.c'
--- src/ftfont.c 2012-09-06 08:04:49 +0000
+++ src/ftfont.c 2012-09-14 19:35:57 +0000
@@ -21,8 +21,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
-
#include <fontconfig/fontconfig.h>
#include <fontconfig/fcfreetype.h>
=== modified file 'src/ftxfont.c'
--- src/ftxfont.c 2012-09-06 08:04:49 +0000
+++ src/ftxfont.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <X11/Xlib.h>
#include "lisp.h"
=== modified file 'src/gnutls.c'
--- src/gnutls.c 2012-08-18 02:49:24 +0000
+++ src/gnutls.c 2012-09-14 19:35:57 +0000
@@ -18,7 +18,6 @@
#include <config.h>
#include <errno.h>
-#include <setjmp.h>
#include "lisp.h"
#include "process.h"
=== modified file 'src/gtkutil.c'
--- src/gtkutil.c 2012-09-07 01:27:44 +0000
+++ src/gtkutil.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,6 @@
#ifdef USE_GTK
#include <float.h>
#include <stdio.h>
-#include <setjmp.h>
#include <c-ctype.h>
=== modified file 'src/image.c'
--- src/image.c 2012-09-13 01:22:08 +0000
+++ src/image.c 2012-09-14 19:35:57 +0000
@@ -5514,6 +5514,13 @@
#endif /* HAVE_NTGUI */
+/* Possibly inefficient/inexact substitutes for _setjmp and _longjmp.
+ Do not use sys_setjmp, as PNG supports only jmp_buf. The _longjmp
+ substitute may munge the signal mask, but that should be OK here. */
+#ifndef HAVE__SETJMP
+# define _setjmp(j) setjmp (j)
+# define _longjmp longjmp
+#endif
#if (PNG_LIBPNG_VER < 10500)
#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1))
@@ -5593,7 +5600,7 @@
struct png_load_context
{
- /* These are members so that _longjmp doesn't munge local variables. */
+ /* These are members so that longjmp doesn't munge local variables. */
png_struct *png_ptr;
png_info *info_ptr;
png_info *end_info;
@@ -6129,9 +6136,9 @@
struct my_jpeg_error_mgr
{
struct jpeg_error_mgr pub;
- jmp_buf setjmp_buffer;
+ sys_jmp_buf setjmp_buffer;
- /* The remaining members are so that _longjmp doesn't munge local
+ /* The remaining members are so that longjmp doesn't munge local
variables. */
struct jpeg_decompress_struct cinfo;
enum
@@ -6151,7 +6158,7 @@
{
struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
mgr->failure_code = MY_JPEG_ERROR_EXIT;
- _longjmp (mgr->setjmp_buffer, 1);
+ sys_longjmp (mgr->setjmp_buffer, 1);
}
@@ -6401,7 +6408,7 @@
error is detected. This function will perform a longjmp. */
mgr->cinfo.err = fn_jpeg_std_error (&mgr->pub);
mgr->pub.error_exit = my_error_exit;
- if (_setjmp (mgr->setjmp_buffer))
+ if (sys_setjmp (mgr->setjmp_buffer))
{
switch (mgr->failure_code)
{
@@ -6460,14 +6467,14 @@
if (!check_image_size (f, width, height))
{
mgr->failure_code = MY_JPEG_INVALID_IMAGE_SIZE;
- _longjmp (mgr->setjmp_buffer, 1);
+ sys_longjmp (mgr->setjmp_buffer, 1);
}
/* Create X image and pixmap. */
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
{
mgr->failure_code = MY_JPEG_CANNOT_CREATE_X;
- _longjmp (mgr->setjmp_buffer, 1);
+ sys_longjmp (mgr->setjmp_buffer, 1);
}
/* Allocate colors. When color quantization is used,
=== modified file 'src/indent.c'
--- src/indent.c 2012-09-04 17:34:54 +0000
+++ src/indent.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/insdel.c'
--- src/insdel.c 2012-09-14 14:23:50 +0000
+++ src/insdel.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,6 @@
#include <config.h>
-#include <setjmp.h>
#include <intprops.h>
=== modified file 'src/intervals.c'
--- src/intervals.c 2012-09-04 17:34:54 +0000
+++ src/intervals.c 2012-09-14 19:35:57 +0000
@@ -41,7 +41,6 @@
#define INTERVALS_INLINE EXTERN_INLINE
-#include <setjmp.h>
#include <intprops.h>
#include "lisp.h"
#include "intervals.h"
=== modified file 'src/keyboard.c'
--- src/keyboard.c 2012-09-13 16:23:06 +0000
+++ src/keyboard.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,7 @@
#define KEYBOARD_INLINE EXTERN_INLINE
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "termchar.h"
#include "termopts.h"
@@ -145,7 +145,7 @@
/* For longjmp to where kbd input is being done. */
-static jmp_buf getcjmp;
+static sys_jmp_buf getcjmp;
/* True while doing kbd input. */
int waiting_for_input;
@@ -434,8 +434,8 @@
Lisp_Object *, ptrdiff_t);
static Lisp_Object make_lispy_switch_frame (Lisp_Object);
static int help_char_p (Lisp_Object);
-static void save_getcjmp (jmp_buf);
-static void restore_getcjmp (jmp_buf);
+static void save_getcjmp (sys_jmp_buf);
+static void restore_getcjmp (sys_jmp_buf);
static Lisp_Object apply_modifiers (int, Lisp_Object);
static void clear_event (struct input_event *);
static Lisp_Object restore_kboard_configuration (Lisp_Object);
@@ -2315,8 +2315,8 @@
{
volatile Lisp_Object c;
ptrdiff_t jmpcount;
- jmp_buf local_getcjmp;
- jmp_buf save_jump;
+ sys_jmp_buf local_getcjmp;
+ sys_jmp_buf save_jump;
volatile int key_already_recorded = 0;
Lisp_Object tem, save;
volatile Lisp_Object previous_echo_area_message;
@@ -2562,7 +2562,7 @@
it *must not* be in effect when we call redisplay. */
jmpcount = SPECPDL_INDEX ();
- if (_setjmp (local_getcjmp))
+ if (sys_setjmp (local_getcjmp))
{
/* Handle quits while reading the keyboard. */
/* We must have saved the outer value of getcjmp here,
@@ -3394,13 +3394,13 @@
See read_process_output. */
static void
-save_getcjmp (jmp_buf temp)
+save_getcjmp (sys_jmp_buf temp)
{
memcpy (temp, getcjmp, sizeof getcjmp);
}
static void
-restore_getcjmp (jmp_buf temp)
+restore_getcjmp (sys_jmp_buf temp)
{
memcpy (getcjmp, temp, sizeof getcjmp);
}
@@ -10979,7 +10979,7 @@
do_switch_frame (make_lispy_switch_frame (internal_last_event_frame),
0, 0, Qnil);
- _longjmp (getcjmp, 1);
+ sys_longjmp (getcjmp, 1);
}
\f
DEFUN ("set-input-interrupt-mode", Fset_input_interrupt_mode,
=== modified file 'src/keymap.c'
--- src/keymap.c 2012-09-04 17:34:54 +0000
+++ src/keymap.c 2012-09-14 19:35:57 +0000
@@ -40,7 +40,7 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "commands.h"
#include "character.h"
=== modified file 'src/lisp.h'
--- src/lisp.h 2012-09-11 23:50:28 +0000
+++ src/lisp.h 2012-09-14 19:35:57 +0000
@@ -20,6 +20,7 @@
#ifndef EMACS_LISP_H
#define EMACS_LISP_H
+#include <setjmp.h>
#include <stdalign.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -1963,7 +1964,24 @@
static struct Lisp_Kboard_Objfwd ko_fwd; \
defvar_kboard (&ko_fwd, lname, offsetof (KBOARD, vname ## _)); \
} while (0)
+\f
+/* Save and restore the instruction and environment pointers,
+ without affecting the signal mask. */
+#ifdef HAVE__SETJMP
+typedef jmp_buf sys_jmp_buf;
+# define sys_setjmp(j) _setjmp (j)
+# define sys_longjmp(j, v) _longjmp (j, v)
+#elif defined HAVE_SIGSETJMP
+typedef sigjmp_buf sys_jmp_buf;
+# define sys_setjmp(j) sigsetjmp (j, 0)
+# define sys_longjmp(j, v) siglongjmp (j, v)
+#else
+/* A non-POSIX platform; assume longjmp does not affect the sigmask. */
+typedef jmp_buf sys_jmp_buf;
+# define sys_setjmp(j) setjmp (j)
+# define sys_longjmp(j, v) longjmp (j, v)
+#endif
\f
/* Structure for recording Lisp call stack for backtrace purposes. */
@@ -2056,7 +2074,7 @@
Lisp_Object volatile val;
struct catchtag *volatile next;
struct gcpro *gcpro;
- jmp_buf jmp;
+ sys_jmp_buf jmp;
struct backtrace *backlist;
struct handler *handlerlist;
EMACS_INT lisp_eval_depth;
=== modified file 'src/lread.c'
--- src/lread.c 2012-09-11 04:22:03 +0000
+++ src/lread.c 2012-09-14 19:35:57 +0000
@@ -25,7 +25,6 @@
#include <sys/file.h>
#include <errno.h>
#include <limits.h> /* For CHAR_BIT. */
-#include <setjmp.h>
#include <stat-time.h>
#include "lisp.h"
#include "intervals.h"
=== modified file 'src/macros.c'
--- src/macros.c 2012-08-17 23:38:43 +0000
+++ src/macros.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,7 @@
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "macros.h"
#include "commands.h"
=== modified file 'src/marker.c'
--- src/marker.c 2012-09-11 04:22:03 +0000
+++ src/marker.c 2012-09-14 19:35:57 +0000
@@ -18,7 +18,7 @@
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/menu.c'
--- src/menu.c 2012-09-04 17:34:54 +0000
+++ src/menu.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <limits.h> /* for INT_MAX */
#include "lisp.h"
=== modified file 'src/minibuf.c'
--- src/minibuf.c 2012-09-11 04:22:03 +0000
+++ src/minibuf.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "commands.h"
=== modified file 'src/nsfns.m'
--- src/nsfns.m 2012-09-07 01:27:44 +0000
+++ src/nsfns.m 2012-09-14 19:35:57 +0000
@@ -31,7 +31,6 @@
#include <config.h>
#include <math.h>
-#include <setjmp.h>
#include <c-strcase.h>
#include "lisp.h"
=== modified file 'src/nsfont.m'
--- src/nsfont.m 2012-09-06 08:04:49 +0000
+++ src/nsfont.m 2012-09-14 19:35:57 +0000
@@ -23,7 +23,6 @@
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h"
=== modified file 'src/nsimage.m'
--- src/nsimage.m 2012-08-16 21:58:44 +0000
+++ src/nsimage.m 2012-09-14 19:35:57 +0000
@@ -28,7 +28,6 @@
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h"
=== modified file 'src/nsmenu.m'
--- src/nsmenu.m 2012-09-04 17:34:54 +0000
+++ src/nsmenu.m 2012-09-14 19:35:57 +0000
@@ -24,7 +24,6 @@
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "window.h"
=== modified file 'src/nsselect.m'
--- src/nsselect.m 2012-08-07 13:37:21 +0000
+++ src/nsselect.m 2012-09-14 19:35:57 +0000
@@ -28,7 +28,6 @@
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "nsterm.h"
=== modified file 'src/nsterm.m'
--- src/nsterm.m 2012-09-11 17:08:02 +0000
+++ src/nsterm.m 2012-09-14 19:35:57 +0000
@@ -35,7 +35,6 @@
#include <time.h>
#include <signal.h>
#include <unistd.h>
-#include <setjmp.h>
#include <c-ctype.h>
#include <c-strcase.h>
=== modified file 'src/print.c'
--- src/print.c 2012-09-11 04:22:03 +0000
+++ src/print.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,7 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/process.c'
--- src/process.c 2012-09-13 02:21:28 +0000
+++ src/process.c 2012-09-14 19:35:57 +0000
@@ -25,12 +25,9 @@
#include <stdio.h>
#include <errno.h>
-#include <setjmp.h>
#include <sys/types.h> /* Some typedefs are used in sys/file.h. */
#include <sys/file.h>
#include <sys/stat.h>
-#include <setjmp.h>
-
#include <unistd.h>
#include <fcntl.h>
@@ -5421,7 +5418,7 @@
\f
/* Sending data to subprocess */
-static jmp_buf send_process_frame;
+static sys_jmp_buf send_process_frame;
static Lisp_Object process_sent_to;
static _Noreturn void
@@ -5431,7 +5428,7 @@
sigemptyset (&unblocked);
sigaddset (&unblocked, SIGPIPE);
pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
- _longjmp (send_process_frame, 1);
+ sys_longjmp (send_process_frame, 1);
}
static void
@@ -5640,7 +5637,7 @@
/* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
CFLAGS="-g -O": The value of the parameter `proc' is clobbered
when returning with longjmp despite being declared volatile. */
- if (!_setjmp (send_process_frame))
+ if (!sys_setjmp (send_process_frame))
{
p = XPROCESS (proc); /* Repair any setjmp clobbering. */
process_sent_to = proc;
=== modified file 'src/ralloc.c'
--- src/ralloc.c 2012-09-04 17:34:54 +0000
+++ src/ralloc.c 2012-09-14 19:35:57 +0000
@@ -25,7 +25,7 @@
#ifdef emacs
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h" /* Needed for VALBITS. */
#include "blockinput.h"
=== modified file 'src/regex.c'
--- src/regex.c 2012-09-03 19:36:09 +0000
+++ src/regex.c 2012-09-14 19:35:57 +0000
@@ -126,7 +126,6 @@
that make sense only in Emacs. */
#ifdef emacs
-# include <setjmp.h>
# include "lisp.h"
# include "character.h"
# include "buffer.h"
=== modified file 'src/region-cache.c'
--- src/region-cache.c 2012-09-04 17:34:54 +0000
+++ src/region-cache.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/scroll.c'
--- src/scroll.c 2012-09-04 17:34:54 +0000
+++ src/scroll.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,7 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "termchar.h"
#include "dispextern.h"
=== modified file 'src/search.c'
--- src/search.c 2012-09-04 17:34:54 +0000
+++ src/search.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,7 @@
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "syntax.h"
#include "category.h"
=== modified file 'src/sheap.c'
--- src/sheap.c 2012-01-19 07:21:25 +0000
+++ src/sheap.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,7 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include <unistd.h>
@@ -93,4 +93,3 @@
bss_sbrk_ptr - bss_sbrk_buffer, STATIC_HEAP_SIZE);
message ("%s", buf);
}
-
=== modified file 'src/sound.c'
--- src/sound.c 2012-09-13 02:21:28 +0000
+++ src/sound.c 2012-09-14 19:35:57 +0000
@@ -44,7 +44,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "dispextern.h"
#include "atimer.h"
=== modified file 'src/syntax.c'
--- src/syntax.c 2012-09-08 14:23:01 +0000
+++ src/syntax.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,7 @@
#include <config.h>
#include <sys/types.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "commands.h"
#include "character.h"
=== modified file 'src/sysdep.c'
--- src/sysdep.c 2012-09-13 02:21:28 +0000
+++ src/sysdep.c 2012-09-14 19:35:57 +0000
@@ -23,7 +23,6 @@
#include <execinfo.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#include <grp.h>
=== modified file 'src/term.c'
--- src/term.c 2012-09-13 02:21:28 +0000
+++ src/term.c 2012-09-14 19:35:57 +0000
@@ -25,7 +25,6 @@
#include <sys/file.h>
#include <sys/time.h>
#include <unistd.h>
-#include <setjmp.h>
#include "lisp.h"
#include "termchar.h"
=== modified file 'src/termcap.c'
--- src/termcap.c 2012-07-05 18:35:48 +0000
+++ src/termcap.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,6 @@
/* Emacs config.h may rename various library functions such as malloc. */
#include <config.h>
-#include <setjmp.h>
#include <sys/file.h>
#include <fcntl.h>
#include <unistd.h>
=== modified file 'src/terminal.c'
--- src/terminal.c 2012-09-04 17:34:54 +0000
+++ src/terminal.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#define TERMHOOKS_INLINE EXTERN_INLINE
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "frame.h"
=== modified file 'src/terminfo.c'
--- src/terminfo.c 2012-09-04 17:34:54 +0000
+++ src/terminfo.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,6 @@
#include <config.h>
#include "tparam.h"
-#include <setjmp.h>
#include "lisp.h"
/* Define these variables that serve as global parameters to termcap,
=== modified file 'src/textprop.c'
--- src/textprop.c 2012-09-07 14:45:28 +0000
+++ src/textprop.c 2012-09-14 19:35:57 +0000
@@ -17,7 +17,7 @@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "intervals.h"
#include "character.h"
=== modified file 'src/tparam.c'
--- src/tparam.c 2012-09-04 17:34:54 +0000
+++ src/tparam.c 2012-09-14 19:35:57 +0000
@@ -19,7 +19,7 @@
/* Emacs config.h may rename various library functions such as malloc. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h" /* for xmalloc */
#include "tparam.h"
\f
=== modified file 'src/undo.c'
--- src/undo.c 2012-08-28 06:20:08 +0000
+++ src/undo.c 2012-09-14 19:35:57 +0000
@@ -18,7 +18,7 @@
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
=== modified file 'src/unexaix.c'
--- src/unexaix.c 2012-08-19 20:02:24 +0000
+++ src/unexaix.c 2012-09-14 19:35:57 +0000
@@ -89,7 +89,6 @@
static int pagemask;
-#include <setjmp.h>
#include "lisp.h"
static void
=== modified file 'src/unexcoff.c'
--- src/unexcoff.c 2012-08-19 20:02:24 +0000
+++ src/unexcoff.c 2012-09-14 19:35:57 +0000
@@ -120,7 +120,6 @@
#define ADDR_CORRECT(x) ((char *)(x) - (char*)0)
-#include <setjmp.h>
#include "lisp.h"
static void
=== modified file 'src/unexcw.c'
--- src/unexcw.c 2012-01-19 07:21:25 +0000
+++ src/unexcw.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include "unexec.h"
-#include <setjmp.h>
#include <lisp.h>
#include <stdio.h>
#include <fcntl.h>
=== modified file 'src/unexsol.c'
--- src/unexsol.c 2012-06-16 12:24:15 +0000
+++ src/unexsol.c 2012-09-14 19:35:57 +0000
@@ -4,7 +4,6 @@
#include "unexec.h"
#include <dlfcn.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/vm-limit.c'
--- src/vm-limit.c 2012-08-19 21:00:09 +0000
+++ src/vm-limit.c 2012-09-14 19:35:57 +0000
@@ -17,7 +17,6 @@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
#include <unistd.h> /* for 'environ', on AIX */
#include "lisp.h"
#include "mem-limits.h"
=== modified file 'src/widget.c'
--- src/widget.c 2012-09-07 01:27:44 +0000
+++ src/widget.c 2012-09-14 19:35:57 +0000
@@ -30,7 +30,7 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "xterm.h"
=== modified file 'src/window.c'
--- src/window.c 2012-09-11 15:42:50 +0000
+++ src/window.c 2012-09-14 19:35:57 +0000
@@ -23,7 +23,6 @@
#define WINDOW_INLINE EXTERN_INLINE
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/xdisp.c'
--- src/xdisp.c 2012-09-14 06:55:38 +0000
+++ src/xdisp.c 2012-09-14 19:35:57 +0000
@@ -273,7 +273,6 @@
#include <config.h>
#include <stdio.h>
#include <limits.h>
-#include <setjmp.h>
#include "lisp.h"
#include "keyboard.h"
=== modified file 'src/xfaces.c'
--- src/xfaces.c 2012-09-11 22:59:50 +0000
+++ src/xfaces.c 2012-09-14 19:35:57 +0000
@@ -204,7 +204,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h> /* This needs to be before termchar.h */
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
=== modified file 'src/xfns.c'
--- src/xfns.c 2012-08-18 06:06:39 +0000
+++ src/xfns.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,6 @@
#include <config.h>
#include <stdio.h>
#include <math.h>
-#include <setjmp.h>
#include <unistd.h>
/* This makes the fields of a Display accessible, in Xlib header files. */
=== modified file 'src/xfont.c'
--- src/xfont.c 2012-09-06 08:04:49 +0000
+++ src/xfont.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <X11/Xlib.h>
#include "lisp.h"
=== modified file 'src/xftfont.c'
--- src/xftfont.c 2012-09-06 08:04:49 +0000
+++ src/xftfont.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
=== modified file 'src/xgselect.c'
--- src/xgselect.c 2012-09-11 22:59:50 +0000
+++ src/xgselect.c 2012-09-14 19:35:57 +0000
@@ -19,14 +19,12 @@
#include <config.h>
-#include <setjmp.h>
#include "xgselect.h"
#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
#include <glib.h>
#include <errno.h>
-#include <setjmp.h>
#include "xterm.h"
int
=== modified file 'src/xmenu.c'
--- src/xmenu.c 2012-09-07 01:27:44 +0000
+++ src/xmenu.c 2012-09-14 19:35:57 +0000
@@ -33,7 +33,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "keyboard.h"
=== modified file 'src/xml.c'
--- src/xml.c 2012-06-16 12:24:15 +0000
+++ src/xml.c 2012-09-14 19:35:57 +0000
@@ -20,7 +20,6 @@
#ifdef HAVE_LIBXML2
-#include <setjmp.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/HTMLparser.h>
=== modified file 'src/xrdb.c'
--- src/xrdb.c 2012-07-05 18:35:48 +0000
+++ src/xrdb.c 2012-09-14 19:35:57 +0000
@@ -26,7 +26,6 @@
#include <epaths.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
=== modified file 'src/xselect.c'
--- src/xselect.c 2012-09-04 17:34:54 +0000
+++ src/xselect.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,6 @@
#include <config.h>
#include <limits.h>
#include <stdio.h> /* termhooks.h needs this */
-#include <setjmp.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
=== modified file 'src/xsettings.c'
--- src/xsettings.c 2012-07-12 03:45:46 +0000
+++ src/xsettings.c 2012-09-14 19:35:57 +0000
@@ -21,7 +21,6 @@
#include <float.h>
#include <limits.h>
-#include <setjmp.h>
#include <fcntl.h>
#include "lisp.h"
#include "xterm.h"
@@ -711,12 +710,12 @@
if (send_event_p)
store_config_changed_event (Qfont_render,
XCAR (dpyinfo->name_list_element));
- Vxft_settings
+ Vxft_settings
= make_formatted_string (buf, format,
oldsettings.aa, oldsettings.hinting,
oldsettings.rgba, oldsettings.lcdfilter,
oldsettings.hintstyle, oldsettings.dpi);
-
+
}
else
FcPatternDestroy (pat);
=== modified file 'src/xsmfns.c'
--- src/xsmfns.c 2012-08-27 17:23:48 +0000
+++ src/xsmfns.c 2012-09-14 19:35:57 +0000
@@ -29,7 +29,6 @@
#include <unistd.h>
#include <sys/param.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "systime.h"
=== modified file 'src/xterm.c'
--- src/xterm.c 2012-09-13 02:21:28 +0000
+++ src/xterm.c 2012-09-14 19:35:57 +0000
@@ -22,7 +22,6 @@
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_X_WINDOWS
@@ -47,7 +46,6 @@
#include <fcntl.h>
#include <errno.h>
-#include <setjmp.h>
#include <sys/stat.h>
/* Caused redefinition of DBL_DIG on Netbsd; seems not to be needed. */
/* #include <sys/param.h> */
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-14 19:44 bug#12446: port better to POSIX hosts lacking _setjmp Paul Eggert
@ 2012-09-14 20:30 ` Eli Zaretskii
2012-09-14 21:28 ` Paul Eggert
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-14 20:30 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Fri, 14 Sep 2012 12:44:37 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: Eli Zaretskii <eliz@gnu.org>, Juanma Barranquero <lekktu@gmail.com>
>
> + Port better to POSIX hosts lacking _setjmp.
> + * lisp.h: Include <setjmp.h> here, since we use its symbols here.
> + All instances of '#include <setjmp.h>' removed, if the
> + only reason for the instance was because "lisp.h" was included.
> + (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols.
> + Unless otherwise specified, replace all uses of jmp_buf, _setjmp,
> + and _longjmp with the new symbols. This ports better to POSIX hosts
> + that have sigsetjmp but not _setjmp, such as some versions of
> + Solaris and Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.)
> + * image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros.
> + (png_load_body) [HAVE_PNG]:
> + (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]:
> + (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]:
> + Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp,
> + since PNG requires jmp_buf. This is the only exception to the
> + general rule that we now use sys_setjmp and sys_longjmp.
> + This exception is OK since this code does not change the signal
> + mask or longjmp out of a signal handler.
I don't understand the rationale. Why not simply switch to using
ANSI- and Posix-standard setjmp/longjmp? You are not using the
signal-mask preserving feature of sigsetjmp, so what's the point of
using it in preference to setjmp?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-14 20:30 ` Eli Zaretskii
@ 2012-09-14 21:28 ` Paul Eggert
2012-09-15 7:10 ` Paul Eggert
2012-09-15 7:12 ` Eli Zaretskii
0 siblings, 2 replies; 16+ messages in thread
From: Paul Eggert @ 2012-09-14 21:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/14/2012 01:30 PM, Eli Zaretskii wrote:
> Why not simply switch to using
> ANSI- and Posix-standard setjmp/longjmp?
Because longjmp might alter the signal mask,
and it might not. POSIX doesn't say either way,
platforms differ in this respect, and the
differences can mess things up and slow things down.
This is why Emacs uses _longjmp now, on GNU and
POSIXish platforms.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-14 21:28 ` Paul Eggert
@ 2012-09-15 7:10 ` Paul Eggert
2012-09-15 8:08 ` Eli Zaretskii
2012-09-15 7:12 ` Eli Zaretskii
1 sibling, 1 reply; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 7:10 UTC (permalink / raw)
To: 12446-done; +Cc: lekktu
I installed this into the trunk as bzr 110035
and am marking the bug as done.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 7:10 ` Paul Eggert
@ 2012-09-15 8:08 ` Eli Zaretskii
2012-09-15 8:46 ` Paul Eggert
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-15 8:08 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Sat, 15 Sep 2012 00:10:04 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: Eli Zaretskii <eliz@gnu.org>, lekktu@gmail.com
>
> I installed this into the trunk as bzr 110035
As you might have expected, it broke the MS-Windows build. Fixed in
revision 110036 on the trunk.
> and am marking the bug as done.
If you know that your commit needs a followup in ports you don't care
about and didn't included in the changes, please in the future don't
mark the bug as done, as it might need more discussions and changes.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 8:08 ` Eli Zaretskii
@ 2012-09-15 8:46 ` Paul Eggert
2012-09-15 9:41 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 8:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/15/2012 01:08 AM, Eli Zaretskii wrote:
> As you might have expected, it broke the MS-Windows build.
Sorry, no, as I wrote in my original bug report, I didn't
think it would break anything in the Microsoft builds.
I am not an expert on MS-Windows.
> Fixed in revision 110036 on the trunk.
Thanks, but unfortunately that fix broke things for POSIXish hosts that
lack _setjmp. I tried to fix the problem in a different way,
by editing nt/config.nt, in trunk bzr 110037. Since I don't
know what the problem was in the MS-Windows build,
it's possible that the Microsoft side still has problems,
but I expect that any problems should be minor and fixable
by further edits to nt/config.nt or similar files.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 8:46 ` Paul Eggert
@ 2012-09-15 9:41 ` Eli Zaretskii
2012-09-15 10:06 ` Paul Eggert
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-15 9:41 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Sat, 15 Sep 2012 01:46:30 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12446@debbugs.gnu.org, lekktu@gmail.com
>
> On 09/15/2012 01:08 AM, Eli Zaretskii wrote:
> > As you might have expected, it broke the MS-Windows build.
>
> Sorry, no, as I wrote in my original bug report, I didn't
> think it would break anything in the Microsoft builds.
> I am not an expert on MS-Windows.
Removing the inclusion of setjmp.h from the w32*.c files, like you did
with all the rest, hardly requires any such expertise.
> Since I don't know what the problem was in the MS-Windows build,
I explained the problem in the comments in image.c, right before the
change I made there.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 9:41 ` Eli Zaretskii
@ 2012-09-15 10:06 ` Paul Eggert
0 siblings, 0 replies; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 10:06 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/15/2012 02:41 AM, Eli Zaretskii wrote:
> Removing the inclusion of setjmp.h from the w32*.c files, like you did
> with all the rest, hardly requires any such expertise.
I don't see why removing those inclusions would have fixed
anything, or broken anything either. Since I assumed they
didn't affect the build I left them alone.
> I explained the problem in the comments in image.c
Yes, thanks, I saw that, but I'm afraid that I still don't
know exactly what the problem was. But if the problem is
fixed now we needn't worry about it further.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-14 21:28 ` Paul Eggert
2012-09-15 7:10 ` Paul Eggert
@ 2012-09-15 7:12 ` Eli Zaretskii
2012-09-15 7:50 ` Paul Eggert
1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-15 7:12 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Fri, 14 Sep 2012 14:28:23 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12446@debbugs.gnu.org, lekktu@gmail.com
>
> On 09/14/2012 01:30 PM, Eli Zaretskii wrote:
> > Why not simply switch to using
> > ANSI- and Posix-standard setjmp/longjmp?
>
> Because longjmp might alter the signal mask,
> and it might not. POSIX doesn't say either way,
> platforms differ in this respect, and the
> differences can mess things up and slow things down.
Can you elaborate? On which platforms does longjmp change the signal
mask and how, and in what ways can this "mess things up and slow
things down"?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 7:12 ` Eli Zaretskii
@ 2012-09-15 7:50 ` Paul Eggert
2012-09-15 8:28 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 7:50 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/15/2012 12:12 AM, Eli Zaretskii wrote:
> On which platforms does longjmp change the signal
> mask and how, and in what ways can this "mess things up and slow
> things down"?
For example, under FreeBSD, setjmp saves the signal mask,
and longjmp restores the signal mask to the value that it had
when setjmp was called. See
<http://www.freebsd.org/cgi/man.cgi?query=setjmp&manpath=FreeBSD+9.0-RELEASE>.
FreeBSD is not alone in this -- it's sort of a BSD tradition --
but I don't have a list handy of exactly which OSes do it and
which do not.
Saving and restoring the signal mask takes time -- often system
calls are involved. Emacs doesn't need the mask saved and restored,
typically, so the effort is wasted. It's not uncommon for
_setjmp+_longjmp to be 30x faster than setjmp+longjmp. This is
partly why Emacs has long preferred _setjmp if available.
Messups are trickier, because they involve rare race conditions.
They can occur if Emacs or a system call has set the signal mask to X,
but a longjump unexpectedly changes it to Y, where Y is not equal to X.
This can happen if a signal handler invokes longjmp, either directly
or indirectly. For example, Emacs signal handlers can invoke xmalloc,
which can do a longjmp if memory is full, leading to a rare bug.
Arguably signal handlers should not invoke malloc -- and I'll
submit a patch shortly along those lines -- but regardless,
it's better if Emacs's nonlocal gotos uniformly leave
the signal mask alone, rather than leaving it alone on some hosts
and messing with it on others.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 7:50 ` Paul Eggert
@ 2012-09-15 8:28 ` Eli Zaretskii
2012-09-15 8:55 ` Paul Eggert
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-15 8:28 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Sat, 15 Sep 2012 00:50:17 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12446@debbugs.gnu.org, lekktu@gmail.com
>
> On 09/15/2012 12:12 AM, Eli Zaretskii wrote:
> > On which platforms does longjmp change the signal
> > mask and how, and in what ways can this "mess things up and slow
> > things down"?
>
> For example, under FreeBSD, setjmp saves the signal mask,
> and longjmp restores the signal mask to the value that it had
> when setjmp was called. See
> <http://www.freebsd.org/cgi/man.cgi?query=setjmp&manpath=FreeBSD+9.0-RELEASE>.
> FreeBSD is not alone in this -- it's sort of a BSD tradition --
> but I don't have a list handy of exactly which OSes do it and
> which do not.
So what was the rationale of turning away from _setjmp, which does the
same as sigsetjmp with its second argument zero?
> Messups are trickier, because they involve rare race conditions.
> They can occur if Emacs or a system call has set the signal mask to X,
> but a longjump unexpectedly changes it to Y, where Y is not equal to X.
Why is that a messup?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 8:28 ` Eli Zaretskii
@ 2012-09-15 8:55 ` Paul Eggert
2012-09-15 9:44 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 8:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/15/2012 01:28 AM, Eli Zaretskii wrote:
> So what was the rationale of turning away from _setjmp
Some POSIXish hosts lack _setjmp, but have sigsetjmp,
and their longjmp implementations munge the signal masks.
>> > Messups are trickier, because they involve rare race conditions.
>> > They can occur if Emacs or a system call has set the signal mask to X,
>> > but a longjump unexpectedly changes it to Y, where Y is not equal to X.
> Why is that a messup?
Because Emacs then continues with the wrong sigmask, which can
cause signals to be blocked when they shouldn't be.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 8:55 ` Paul Eggert
@ 2012-09-15 9:44 ` Eli Zaretskii
2012-09-15 10:00 ` Paul Eggert
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-15 9:44 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Sat, 15 Sep 2012 01:55:14 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12446@debbugs.gnu.org, lekktu@gmail.com
>
> On 09/15/2012 01:28 AM, Eli Zaretskii wrote:
> > So what was the rationale of turning away from _setjmp
>
> Some POSIXish hosts lack _setjmp, but have sigsetjmp,
How did those hosts succeed to compile Emacs before your changes, then?
> >> > Messups are trickier, because they involve rare race conditions.
> >> > They can occur if Emacs or a system call has set the signal mask to X,
> >> > but a longjump unexpectedly changes it to Y, where Y is not equal to X.
> > Why is that a messup?
>
> Because Emacs then continues with the wrong sigmask, which can
> cause signals to be blocked when they shouldn't be.
longjmp restores the environment, including the signal mask, to what
it was when setjmp was called. How can this restored mask be wrong,
unless it was already wrong when setjmp was called?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 9:44 ` Eli Zaretskii
@ 2012-09-15 10:00 ` Paul Eggert
2012-09-15 10:27 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 10:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/15/2012 02:44 AM, Eli Zaretskii wrote:
>> Some POSIXish hosts lack _setjmp, but have sigsetjmp,
>
> How did those hosts succeed to compile Emacs before your changes, then?
They used setjmp, which meant they were slower and
had some (rare) race conditions that caused problems.
> longjmp restores the environment, including the signal mask, to what
> it was when setjmp was called.
No, sometimes it does, sometimes it doesn't.
It depends on the platform. If you want the signal mask
restored portably, you have to do it some other way, by using
siglongjmp or pthread_sigmask or something like that.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 10:00 ` Paul Eggert
@ 2012-09-15 10:27 ` Eli Zaretskii
2012-09-15 20:26 ` Paul Eggert
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-15 10:27 UTC (permalink / raw)
To: Paul Eggert; +Cc: lekktu, 12446
> Date: Sat, 15 Sep 2012 03:00:50 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12446@debbugs.gnu.org, lekktu@gmail.com
>
> > longjmp restores the environment, including the signal mask, to what
> > it was when setjmp was called.
>
> No, sometimes it does, sometimes it doesn't.
> It depends on the platform. If you want the signal mask
> restored portably, you have to do it some other way, by using
> siglongjmp or pthread_sigmask or something like that.
Yes, but from your description of the "messup" it sounds like _not_
restoring the signal mask will cause the trouble. After your changes,
we never restore the signal mask, because sigsetjmp is called with its
second argument zero.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#12446: port better to POSIX hosts lacking _setjmp
2012-09-15 10:27 ` Eli Zaretskii
@ 2012-09-15 20:26 ` Paul Eggert
0 siblings, 0 replies; 16+ messages in thread
From: Paul Eggert @ 2012-09-15 20:26 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: lekktu, 12446
On 09/15/2012 03:27 AM, Eli Zaretskii wrote:
> Yes, but from your description of the "messup" it sounds like _not_
> restoring the signal mask will cause the trouble.
Yes, the point is that the longjmp would get in the way of
Emacs restoring the signal mask, because the longjmp would
set the signal mask in an undesirable way.
> After your changes, we never restore the signal mask
And that's what we want. On platforms that have _setjmp, Emacs
already uses _setjmp so that the corresponding _longjmp does not
restore the signal mask, which is what we want. The changes
merely adjust the behavior to do the same thing on platforms
that have sigsetjmp but not _setjmp.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-09-15 20:26 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-14 19:44 bug#12446: port better to POSIX hosts lacking _setjmp Paul Eggert
2012-09-14 20:30 ` Eli Zaretskii
2012-09-14 21:28 ` Paul Eggert
2012-09-15 7:10 ` Paul Eggert
2012-09-15 8:08 ` Eli Zaretskii
2012-09-15 8:46 ` Paul Eggert
2012-09-15 9:41 ` Eli Zaretskii
2012-09-15 10:06 ` Paul Eggert
2012-09-15 7:12 ` Eli Zaretskii
2012-09-15 7:50 ` Paul Eggert
2012-09-15 8:28 ` Eli Zaretskii
2012-09-15 8:55 ` Paul Eggert
2012-09-15 9:44 ` Eli Zaretskii
2012-09-15 10:00 ` Paul Eggert
2012-09-15 10:27 ` Eli Zaretskii
2012-09-15 20:26 ` Paul Eggert
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).