aboutsummaryrefslogtreecommitdiffstats
path: root/include/gtest
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2014-01-29 06:34:44 +0000
committerkosak <kosak@google.com>2014-01-29 06:34:44 +0000
commit35956659eaaafd4b356acfbabcb48c183d957ff4 (patch)
tree325157afb1a1a9d2bd48f115c82c6231e6e2af15 /include/gtest
parent7d1051ce2b3be67d27b200d0050a7ec88c18621b (diff)
downloadgoogletest-35956659eaaafd4b356acfbabcb48c183d957ff4.tar.gz
googletest-35956659eaaafd4b356acfbabcb48c183d957ff4.tar.bz2
googletest-35956659eaaafd4b356acfbabcb48c183d957ff4.zip
Add GTEST_MOVE macro, to support mocking methods with move-only return types.
Add GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
Diffstat (limited to 'include/gtest')
-rw-r--r--include/gtest/internal/gtest-port.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 9683cada..4bc1e690 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -198,6 +198,10 @@
// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
//
+// C++11 feature wrappers:
+//
+// GTEST_MOVE_ - portability wrapper for std::move.
+//
// Synchronization:
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
// - synchronization primitives.
@@ -264,6 +268,7 @@
#include <iostream> // NOLINT
#include <sstream> // NOLINT
#include <string> // NOLINT
+#include <utility>
#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
#define GTEST_FLAG_PREFIX_ "gtest_"
@@ -823,6 +828,12 @@ using ::std::tuple_size;
# define GTEST_MUST_USE_RESULT_
#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
+#if GTEST_LANG_CXX11
+# define GTEST_MOVE_(x) ::std::move(x) // NOLINT
+#else
+# define GTEST_MOVE_(x) x
+#endif
+
// Determine whether the compiler supports Microsoft's Structured Exception
// Handling. This is supported by several Windows compilers but generally
// does not exist on any other system.
@@ -875,10 +886,22 @@ using ::std::tuple_size;
__attribute__((no_sanitize_memory))
# else
# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-# endif
+# endif // __has_feature(memory_sanitizer)
#else
# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-#endif
+#endif // __clang__
+
+// A function level attribute to disable AddressSanitizer instrumentation.
+#if defined(__clang__)
+# if __has_feature(address_sanitizer)
+# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
+ __attribute__((no_sanitize_address))
+# else
+# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+# endif // __has_feature(address_sanitizer)
+#else
+# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
+#endif // __clang__
namespace testing {