[llvm-commits] [PATCH] Don't use catch(...) in Win32/Signals.inc.

NAKAMURA Takumi geek4civic at gmail.com
Thu Oct 21 22:33:55 PDT 2010


Mikhail,

It works fine, thank you.

Its indentation is messy.
Re-indent please or I suggest;

  if (1) {
   ...block , it was in try in past...
  }

...Takumi


2010/10/22 Mikhail Glushenkov <foldr at codedgers.com>:
> catch(...) is used in Win32/Signals.inc for catching Win32 structured
> exceptions, but according to [1], this is wrong.
>
> We can't simply change try/catch to __try/__finally, since this syntax is not
> supported by MinGW. Using _set_se_translator is a possibility, but has its own
> issues (again, see [1]).
>
> The use of try/catch(...) in Signals.inc makes it impossible to link
> MinGW-compiled libSystem with llvm-gcc compiled executables. I propose that we
> just remove try/catch(...) from Signals.inc, since the meaning of the code won't
> change.
>
> [1] http://members.cox.net/doug_web/eh.htm
> ---
>  lib/System/Makefile          |    5 -----
>  lib/System/Win32/Signals.inc |    7 +------
>  2 files changed, 1 insertions(+), 11 deletions(-)
>
> diff --git a/lib/System/Makefile b/lib/System/Makefile
> index bb013b9..5d4fda9 100644
> --- a/lib/System/Makefile
> +++ b/lib/System/Makefile
> @@ -11,11 +11,6 @@ LEVEL = ../..
>  LIBRARYNAME = LLVMSystem
>  BUILD_ARCHIVE = 1
>  REQUIRES_RTTI = 1
> -include $(LEVEL)/Makefile.config
> -
> -ifeq ($(HOST_OS),MingW)
> -  REQUIRES_EH := 1
> -endif
>
>  EXTRA_DIST = Unix Win32 README.txt
>
> diff --git a/lib/System/Win32/Signals.inc b/lib/System/Win32/Signals.inc
> index 4bafe41..7bd3480 100644
> --- a/lib/System/Win32/Signals.inc
> +++ b/lib/System/Win32/Signals.inc
> @@ -206,8 +206,7 @@ void llvm::sys::RunInterruptHandlers() {
>  }
>
>  static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
> -  try {
> -    Cleanup();
> +  Cleanup();
>
>  #ifdef _WIN64
>   // TODO: provide a x64 friendly version of the following
> @@ -289,10 +288,6 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
>
>  #endif
>
> -  } catch (...) {
> -      assert(0 && "Crashed in LLVMUnhandledExceptionFilter");
> -  }
> -
>   if (ExitOnUnhandledExceptions)
>     _exit(-3);
>
> --
> 1.7.3.1
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list