summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2012-12-18 15:33:43 -0500
committerMorgan Deters <mdeters@cs.nyu.edu>2013-01-24 16:22:42 -0500
commit73760b3c213733fc98d67f9ceeb74d06b01a3777 (patch)
tree8840f595428560499bc6739513ac3a1fbb2746ca /src/main
parent1435948e241d3134d44662b9476935fe635b4166 (diff)
Add win32 support (merge from mdeters/win32, with some cleanup).
Diffstat (limited to 'src/main')
-rw-r--r--src/main/util.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/util.cpp b/src/main/util.cpp
index 5e7436580..9ade23630 100644
--- a/src/main/util.cpp
+++ b/src/main/util.cpp
@@ -19,10 +19,15 @@
#include <cerrno>
#include <exception>
#include <string.h>
+
+#ifndef __WIN32__
+
#include <signal.h>
#include <sys/resource.h>
#include <unistd.h>
+#endif /* __WIN32__ */
+
#include "util/exception.h"
#include "options/options.h"
#include "util/statistics.h"
@@ -44,9 +49,6 @@ namespace CVC4 {
namespace main {
-size_t cvc4StackSize;
-void* cvc4StackBase;
-
/**
* If true, will not spin on segfault even when CVC4_DEBUG is on.
* Useful for nightly regressions, noninteractive performance runs
@@ -54,6 +56,11 @@ void* cvc4StackBase;
*/
bool segvNoSpin = false;
+#ifndef __WIN32__
+
+size_t cvc4StackSize;
+void* cvc4StackBase;
+
/** Handler for SIGXCPU, i.e., timeout. */
void timeout_handler(int sig, siginfo_t* info, void*) {
fprintf(stderr, "CVC4 interrupted by timeout.\n");
@@ -144,10 +151,12 @@ void ill_handler(int sig, siginfo_t* info, void*) {
#endif /* CVC4_DEBUG */
}
+#endif /* __WIN32__ */
+
static terminate_handler default_terminator;
void cvc4unexpected() {
-#ifdef CVC4_DEBUG
+#if defined(CVC4_DEBUG) && !defined(__WIN32__)
fprintf(stderr, "\n"
"CVC4 threw an \"unexpected\" exception (one that wasn't properly "
"specified\nin the throws() specifier for the throwing function)."
@@ -204,6 +213,7 @@ void cvc4terminate() {
/** Initialize the driver. Sets signal handlers for SIGINT and SIGSEGV. */
void cvc4_init() throw(Exception) {
+#ifndef __WIN32__
stack_t ss;
ss.ss_sp = malloc(SIGSTKSZ);
if(ss.ss_sp == NULL) {
@@ -262,6 +272,8 @@ void cvc4_init() throw(Exception) {
throw Exception(string("sigaction(SIGILL) failure: ") + strerror(errno));
}
+#endif /* __WIN32__ */
+
set_unexpected(cvc4unexpected);
default_terminator = set_terminate(cvc4terminate);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback