aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2015-01-14 06:35:05 +0000
committerkosak <kosak@google.com>2015-01-14 06:35:05 +0000
commit83602c834044185eb6ebc67d4c6c474f3593830a (patch)
treececaf49d7de380f0406ccb3670f6c5844590a79d /include
parent7489581db8ea450d22f64e9a7a824e275fa605a0 (diff)
downloadgoogletest-83602c834044185eb6ebc67d4c6c474f3593830a.tar.gz
googletest-83602c834044185eb6ebc67d4c6c474f3593830a.tar.bz2
googletest-83602c834044185eb6ebc67d4c6c474f3593830a.zip
Fix build regression with old (Xcode 5.1) clangs.
Diffstat (limited to 'include')
-rw-r--r--include/gtest/internal/gtest-port.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 208dcfb4..e4de29d1 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -499,10 +499,14 @@ struct _RTL_CRITICAL_SECTION;
# endif // _HAS_EXCEPTIONS
# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
# elif defined(__clang__)
-// __EXCEPTIONS determines if cleanups are enabled. In Obj-C++ files, there can
-// be cleanups for ObjC exceptions, but C++ exceptions might still be disabled.
-// So use a __has_feature check for C++ exceptions instead.
-# define GTEST_HAS_EXCEPTIONS __has_feature(cxx_exceptions)
+// clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
+// but iff cleanups are enabled after that. In Obj-C++ files, there can be
+// cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
+// are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
+// exceptions starting at clang r206352, but which checked for cleanups prior to
+// that. To reliably check for C++ exception availability with clang, check for
+// __EXCEPTIONS && __has_feature(cxx_exceptions).
+# define GTEST_HAS_EXCEPTIONS __EXCEPTIONS && __has_feature(cxx_exceptions)
# elif defined(__GNUC__) && __EXCEPTIONS
// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
# define GTEST_HAS_EXCEPTIONS 1