Zachary Turner | 85bc48c | 2015-03-17 22:51:21 +0000 | [diff] [blame^] | 1 | //===-- gtest_common.h ------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #if defined(LLDB_GTEST_COMMON_H) |
| 11 | #error "gtest_common.h should not be included manually." |
| 12 | #else |
| 13 | #define LLDB_GTEST_COMMON_H |
| 14 | #endif |
| 15 | |
| 16 | // This header file is force included by all of LLDB's unittest compilation |
| 17 | // units. Be very leary about putting anything in this file. |
| 18 | |
| 19 | #if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0) |
| 20 | // MSVC's STL implementation tries to work well with /EHs-c- and |
| 21 | // _HAS_EXCEPTIONS=0. But <thread> in particular doesn't work with it, because |
| 22 | // it relies on <concrt.h> which tries to throw an exception without checking |
| 23 | // for _HAS_EXCEPTIONS=0. This causes the linker to require a definition of |
| 24 | // __uncaught_exception(), but the STL doesn't define this function when |
| 25 | // _HAS_EXCEPTIONS=0. The workaround here is to just provide a stub |
| 26 | // implementation to get it to link. |
| 27 | inline bool |
| 28 | __uncaught_exception() |
| 29 | { |
| 30 | return true; |
| 31 | } |
| 32 | #endif |