From 9cf16652c7308de7bf872ddde80480503e241ddd Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 17 May 2011 13:15:29 +0000 Subject: [PATCH] Enable Visual Studio basic run-time checks in non-optimized builds [Oliver Stoneberg] Flush stderr, so the data is actually written when output is being redirected [Oliver Stoneberg] --- src/osd/windows/windows.mak | 5 +++++ src/osd/windows/winmain.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index f4628b8416b..d68877fa9d8 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -140,6 +140,11 @@ CCOMFLAGS += /wd4267 #LIBS += -lbufferoverflowu endif +# enable basic run-time checks in non-optimized build +ifeq ($(OPTIMIZE),0) +CCOMFLAGS += /RTC1 +endif + # enable exception handling for C++ CPPONLYFLAGS += /EHsc diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 9d5cd5e48ea..ebee9160e60 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -1174,6 +1174,9 @@ static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info) // walk the stack while (walker.unwind()) fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == NULL) ? "" : symbols->symbol_for_address(walker.ip())); + + // flush stderr, so the data is actually written when output is being redirected + fflush(stderr); // exit return EXCEPTION_CONTINUE_SEARCH;