[llvm-commits] [Review request] Enable LLVM_DISABLE_CRT_DEBUG also on mingw to suppress dialogs

NAKAMURA Takumi geek4civic at gmail.com
Tue Oct 5 02:27:06 PDT 2010


Good evening!

Also on mingw, we can suppress showstopper dialogs during testing.
(the distro I am using, msysgit, does not have dbghelp.h)

I have confirmed only on Windows XP(x86/x64), not on Windows 7 yet.

Please let me know if anyone knows issues around it.


...Takumi
-------------- next part --------------
commit 3278d91c3f04b90905df9c50efabd109fe362ac3
Author: NAKAMURA Takumi <geek4civic at gmail.com>
Date:   Mon Oct 4 20:12:00 2010 +0900

    lib/System/Win32/Signals.inc: Enable LLVM_DISABLE_CRT_DEBUG also on mingw.

diff --git a/lib/System/Win32/Signals.inc b/lib/System/Win32/Signals.inc
index 2498a26..616bb29 100644
--- a/lib/System/Win32/Signals.inc
+++ b/lib/System/Win32/Signals.inc
@@ -43,9 +43,7 @@ static std::vector<llvm::sys::Path> *FilesToRemove = NULL;
 static std::vector<std::pair<void(*)(void*), void*> > *CallBacksToRun = 0;
 static bool RegisteredUnhandledExceptionFilter = false;
 static bool CleanupExecuted = false;
-#ifdef _MSC_VER
 static bool ExitOnUnhandledExceptions = false;
-#endif
 static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL;
 
 // Windows creates a new thread to execute the console handler when an event
@@ -110,12 +108,12 @@ static void RegisterHandler() {
   SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE);
 
   // Environment variable to disable any kind of crash dialog.
-#ifdef _MSC_VER
   if (getenv("LLVM_DISABLE_CRT_DEBUG")) {
+#ifdef _MSC_VER
     _CrtSetReportHook(CRTReportHook);
+#endif
     ExitOnUnhandledExceptions = true;
   }
-#endif
 
   // IMPORTANT NOTE: Caller must call LeaveCriticalSection(&CriticalSection) or
   // else multi-threading problems will ensue.
@@ -295,10 +293,8 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
       assert(0 && "Crashed in LLVMUnhandledExceptionFilter");
   }
 
-#ifdef _MSC_VER
   if (ExitOnUnhandledExceptions)
     _exit(-3);
-#endif
 
   // Allow dialog box to pop up allowing choice to start debugger.
   if (OldFilter)


More information about the llvm-commits mailing list