summaryrefslogtreecommitdiff
path: root/m4/nocrash.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-09-11 09:52:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-09-11 09:52:58 -0700
commit3f44249e19c27e3cf87a0676dfdc4136f49539b3 (patch)
tree0b842bf77a6121a2d9da02a119726ab025456f6b /m4/nocrash.m4
parenta98e7468321a83381758bd894b94f7c1c40c2991 (diff)
downloademacs-3f44249e19c27e3cf87a0676dfdc4136f49539b3.tar.gz
Merge from gnulib, porting to Tru64.
* lib/lstat.c, lib/stat.c, m4/include_next.m4, m4/nocrash.m4: * m4/signal_h.m4, m4/time_h.m4, m4/unistd_h.m4: Merge from gnulib. This fixes a compilation error on Tru64 UNIX aka OSF/1 5.1 DTK cc. There is also some mingw stuff here that doesn't affect Emacs.
Diffstat (limited to 'm4/nocrash.m4')
-rw-r--r--m4/nocrash.m430
1 files changed, 29 insertions, 1 deletions
diff --git a/m4/nocrash.m4 b/m4/nocrash.m4
index 0cc0d53ebf7..60aad952956 100644
--- a/m4/nocrash.m4
+++ b/m4/nocrash.m4
@@ -1,4 +1,4 @@
-# nocrash.m4 serial 2
+# nocrash.m4 serial 3
dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -79,6 +79,34 @@ nocrash_init (void)
}
}
}
+#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Avoid a crash on native Windows. */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <winerror.h>
+static LONG WINAPI
+exception_filter (EXCEPTION_POINTERS *ExceptionInfo)
+{
+ switch (ExceptionInfo->ExceptionRecord->ExceptionCode)
+ {
+ case EXCEPTION_ACCESS_VIOLATION:
+ case EXCEPTION_IN_PAGE_ERROR:
+ case EXCEPTION_STACK_OVERFLOW:
+ case EXCEPTION_GUARD_PAGE:
+ case EXCEPTION_PRIV_INSTRUCTION:
+ case EXCEPTION_ILLEGAL_INSTRUCTION:
+ case EXCEPTION_DATATYPE_MISALIGNMENT:
+ case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+ case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+ exit (1);
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+static void
+nocrash_init (void)
+{
+ SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter);
+}
#else
/* Avoid a crash on POSIX systems. */
#include <signal.h>