fix for building with BSD & MinGW.

This commit is contained in:
Campbell Barton 2013-01-18 21:05:37 +00:00
parent 5f9ea0d7eb
commit b7a2402da6

@ -53,10 +53,10 @@
#endif #endif
/* for backtrace */ /* for backtrace */
#ifdef WIN32 #if defined(__linux__) || defined(__APPLE__)
# include <DbgHelp.h>
#else
# include <execinfo.h> # include <execinfo.h>
#elif defined(_MSV_VER)
# include <DbgHelp.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@ -448,10 +448,12 @@ static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(dat
return 0; return 0;
} }
#if defined(__linux__) || defined(__APPLE__)
/* Unix */
static void blender_crash_handler_backtrace(FILE *fp) static void blender_crash_handler_backtrace(FILE *fp)
{ {
#define SIZE 100 #define SIZE 100
#ifndef WIN32
void *buffer[SIZE]; void *buffer[SIZE];
int nptrs; int nptrs;
char **strings; char **strings;
@ -468,10 +470,17 @@ static void blender_crash_handler_backtrace(FILE *fp)
} }
free(strings); free(strings);
#else /* WIN32 */ #undef SIZE
}
#elif defined(_MSV_VER)
static void blender_crash_handler_backtrace(FILE *fp)
{
(void)fp; (void)fp;
#if 0 #if 0
#define MAXSYMBOL 256 #define MAXSYMBOL 256
unsigned short i; unsigned short i;
void *stack[SIZE]; void *stack[SIZE];
unsigned short nframes; unsigned short nframes;
@ -496,10 +505,17 @@ static void blender_crash_handler_backtrace(FILE *fp)
MEM_freeN(symbolinfo); MEM_freeN(symbolinfo);
#endif #endif
#endif
#undef SIZE
} }
#else /* non msvc/osx/linux */
static void blender_crash_handler_backtrace(FILE *fp)
{
(void)fp;
}
#endif
static void blender_crash_handler(int signum) static void blender_crash_handler(int signum)
{ {