diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-05-13 13:54:46 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-05-13 13:54:46 (GMT) |
| commit | 1f7ca2ff69e3ff8252937f385787336054c6fc11 (patch) | |
| tree | 08465c00c470a4a6009c1afc2fb544bc2ae0184e | |
| parent | c3b1e9053bf23608ddd00c5e70e366d067cb430e (diff) | |
| download | tcl-1f7ca2ff69e3ff8252937f385787336054c6fc11.zip tcl-1f7ca2ff69e3ff8252937f385787336054c6fc11.tar.gz tcl-1f7ca2ff69e3ff8252937f385787336054c6fc11.tar.bz2 | |
de-duplicate code in win32 panic implementation. Also eliminate gcc compiler warning.
| -rw-r--r-- | generic/tcl.h | 4 | ||||
| -rw-r--r-- | generic/tclPanic.c | 12 | ||||
| -rw-r--r-- | win/tclWinError.c | 8 | ||||
| -rw-r--r-- | win/tclWinFile.c | 14 | ||||
| -rw-r--r-- | win/tclWinPanic.c | 2 |
5 files changed, 11 insertions, 29 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 790fa12..20889e4 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2208,9 +2208,9 @@ const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version, const char * TclTomMathInitializeStubs(Tcl_Interp *interp, const char *version, int epoch, int revision); #if defined(_WIN32) - TCL_NORETURN void Tcl_ConsolePanic(const char *format, ...); + TCL_NORETURN1 void Tcl_ConsolePanic(const char *format, ...); #else -# define Tcl_ConsolePanic ((Tcl_PanicProc *)0) +# define Tcl_ConsolePanic NULL #endif #ifdef USE_TCL_STUBS diff --git a/generic/tclPanic.c b/generic/tclPanic.c index 8cdd8bf..07d8b19 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -15,7 +15,7 @@ #include "tclInt.h" #if defined(_WIN32) || defined(__CYGWIN__) - MODULE_SCOPE TCL_NORETURN void tclWinDebugPanic(const char *format, ...); + MODULE_SCOPE void tclWinDebugPanic(const char *format, ...); #endif /* @@ -96,25 +96,23 @@ Tcl_Panic( if (panicProc != NULL) { panicProc(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } else { -#ifdef _WIN32 - tclWinDebugPanic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +#if defined(_WIN32) || defined(__CYGWIN__) + tclWinDebugPanic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); #else fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); fprintf(stderr, "\n"); fflush(stderr); -#if defined(_WIN32) || defined(__CYGWIN__) +#endif # if defined(__GNUC__) __builtin_trap(); # elif defined(_WIN64) __debugbreak(); # elif defined(_MSC_VER) && defined (_M_IX86) _asm {int 3} -# else +# elif defined(_WIN32) DebugBreak(); # endif -#endif -#endif #if defined(_WIN32) ExitProcess(1); #else diff --git a/win/tclWinError.c b/win/tclWinError.c index 5d4423b..ac98cd4 100644 --- a/win/tclWinError.c +++ b/win/tclWinError.c @@ -381,7 +381,7 @@ TclWinConvertError( *---------------------------------------------------------------------- */ -TCL_NORETURN void +void tclWinDebugPanic( const char *format, ...) { @@ -413,12 +413,6 @@ tclWinDebugPanic( fprintf(stderr, "\n"); fflush(stderr); } -# if defined(__GNUC__) - __builtin_trap(); -# else - DebugBreak(); -# endif - abort(); } #endif /* diff --git a/win/tclWinFile.c b/win/tclWinFile.c index f7ac949..333c526 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -177,7 +177,7 @@ static int WinLink(const TCHAR *LinkSource, const TCHAR *LinkTarget, int linkAction); static int WinSymLinkDirectory(const TCHAR *LinkDirectory, const TCHAR *LinkTarget); -MODULE_SCOPE TCL_NORETURN void tclWinDebugPanic(const char *format, ...); +MODULE_SCOPE void tclWinDebugPanic(const char *format, ...); /* *-------------------------------------------------------------------- @@ -794,7 +794,7 @@ NativeWriteReparse( *---------------------------------------------------------------------- */ -TCL_NORETURN void +void tclWinDebugPanic( const char *format, ...) { @@ -824,16 +824,6 @@ tclWinDebugPanic( MessageBoxW(NULL, msgString, L"Fatal Error", MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); } -#if defined(__GNUC__) - __builtin_trap(); -#elif defined(_WIN64) - __debugbreak(); -#elif defined(_MSC_VER) && defined (_M_IX86) - _asm {int 3} -#else - DebugBreak(); -#endif - ExitProcess(1); } /* diff --git a/win/tclWinPanic.c b/win/tclWinPanic.c index 0de7df2..3b9933c 100644 --- a/win/tclWinPanic.c +++ b/win/tclWinPanic.c @@ -28,7 +28,7 @@ *---------------------------------------------------------------------- */ -void +TCL_NORETURN1 void Tcl_ConsolePanic( const char *format, ...) { |
