From 341bf54557e19fd94aa81bbb1e025d51e1ca612a Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 16 Mar 2011 02:53:39 +0000 Subject: [PATCH] lib/Support/raw_ostream.cpp: On mingw, report_fatal_error() should not be called at dtor context. report_fatal_error() invokes exit(). We know report_fatal_error() might not write messages to stderr when any errors were detected on FD == 2. llvm-svn: 127726 --- lib/Support/raw_ostream.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index b175d203a18..a2ca101c558 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -466,6 +466,14 @@ raw_fd_ostream::~raw_fd_ostream() { } } +#ifdef __MINGW32__ + // On mingw, global dtors should not call exit(). + // report_fatal_error() invokes exit(). We know report_fatal_error() + // might not write messages to stderr when any errors were detected + // on FD == 2. + if (FD == 2) return; +#endif + // If there are any pending errors, report them now. Clients wishing // to avoid report_fatal_error calls should check for errors with // has_error() and clear the error flag with clear_error() before