diff options
Diffstat (limited to 'googlemock/include')
6 files changed, 21 insertions, 93 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 8b3c03b..2814125 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -1140,10 +1140,6 @@ SetArgPointee(const T& x) { N, T, internal::IsAProtocolMessage<T>::value>(x)); } -#if !((GTEST_GCC_VER_ && GTEST_GCC_VER_ < 40000) || GTEST_OS_SYMBIAN) -// This overload allows SetArgPointee() to accept a string literal. -// GCC prior to the version 4.0 and Symbian C++ compiler cannot distinguish -// this overload from the templated version and emit a compile error. template <size_t N> PolymorphicAction< internal::SetArgumentPointeeAction<N, const char*, false> > @@ -1159,7 +1155,6 @@ SetArgPointee(const wchar_t* p) { return MakePolymorphicAction(internal::SetArgumentPointeeAction< N, const wchar_t*, false>(p)); } -#endif // The following version is DEPRECATED. template <size_t N, typename T> diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index f9ad348..36ff299 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -244,11 +244,8 @@ inline Matcher<T> MatcherCast(const M& matcher) { // Implements SafeMatcherCast(). // -// We use an intermediate class to do the actual safe casting as Nokia's -// Symbian compiler cannot decide between -// template <T, M> ... (M) and -// template <T, U> ... (const Matcher<U>&) -// for function templates but can for member function templates. +// FIXME: The intermediate SafeMatcherCastImpl class was introduced as a +// workaround for a compiler bug, and can now be removed. template <typename T> class SafeMatcherCastImpl { public: @@ -1714,23 +1711,22 @@ class FieldMatcher { template <typename T> bool MatchAndExplain(const T& value, MatchResultListener* listener) const { + // FIXME: The dispatch on std::is_pointer was introduced as a workaround for + // a compiler bug, and can now be removed. return MatchAndExplainImpl( - typename ::testing::internal:: - is_pointer<GTEST_REMOVE_CONST_(T)>::type(), - value, listener); + typename std::is_pointer<GTEST_REMOVE_CONST_(T)>::type(), value, + listener); } private: - // The first argument of MatchAndExplainImpl() is needed to help - // Symbian's C++ compiler choose which overload to use. Its type is - // true_type iff the Field() matcher is used to match a pointer. - bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj, + bool MatchAndExplainImpl(std::false_type /* is_not_pointer */, + const Class& obj, MatchResultListener* listener) const { *listener << whose_field_ << "is "; return MatchPrintAndExplain(obj.*field_, matcher_, listener); } - bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p, + bool MatchAndExplainImpl(std::true_type /* is_pointer */, const Class* p, MatchResultListener* listener) const { if (p == nullptr) return false; @@ -1738,7 +1734,7 @@ class FieldMatcher { // Since *p has a field, it must be a class/struct/union type and // thus cannot be a pointer. Therefore we pass false_type() as // the first argument. - return MatchAndExplainImpl(false_type(), *p, listener); + return MatchAndExplainImpl(std::false_type(), *p, listener); } const FieldType Class::*field_; @@ -1785,16 +1781,13 @@ class PropertyMatcher { template <typename T> bool MatchAndExplain(const T&value, MatchResultListener* listener) const { return MatchAndExplainImpl( - typename ::testing::internal:: - is_pointer<GTEST_REMOVE_CONST_(T)>::type(), - value, listener); + typename std::is_pointer<GTEST_REMOVE_CONST_(T)>::type(), value, + listener); } private: - // The first argument of MatchAndExplainImpl() is needed to help - // Symbian's C++ compiler choose which overload to use. Its type is - // true_type iff the Property() matcher is used to match a pointer. - bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj, + bool MatchAndExplainImpl(std::false_type /* is_not_pointer */, + const Class& obj, MatchResultListener* listener) const { *listener << whose_property_ << "is "; // Cannot pass the return value (for example, int) to MatchPrintAndExplain, @@ -1803,7 +1796,7 @@ class PropertyMatcher { return MatchPrintAndExplain(result, matcher_, listener); } - bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p, + bool MatchAndExplainImpl(std::true_type /* is_pointer */, const Class* p, MatchResultListener* listener) const { if (p == nullptr) return false; @@ -1811,7 +1804,7 @@ class PropertyMatcher { // Since *p has a property method, it must be a class/struct/union // type and thus cannot be a pointer. Therefore we pass // false_type() as the first argument. - return MatchAndExplainImpl(false_type(), *p, listener); + return MatchAndExplainImpl(std::false_type(), *p, listener); } Property property_; diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index 3fe3173..9a54b3a 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -301,12 +301,7 @@ class OnCallSpec : public UntypedOnCallSpecBase { const ArgumentMatcherTuple& matchers) : UntypedOnCallSpecBase(a_file, a_line), matchers_(matchers), - // By default, extra_matcher_ should match anything. However, - // we cannot initialize it with _ as that triggers a compiler - // bug in Symbian's C++ compiler (cannot decide between two - // overloaded constructors of Matcher<const ArgumentTuple&>). - extra_matcher_(A<const ArgumentTuple&>()) { - } + extra_matcher_(_) {} // Implements the .With() clause. OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) { @@ -896,11 +891,7 @@ class TypedExpectation : public ExpectationBase { : ExpectationBase(a_file, a_line, a_source_text), owner_(owner), matchers_(m), - // By default, extra_matcher_ should match anything. However, - // we cannot initialize it with _ as that triggers a compiler - // bug in Symbian's C++ compiler (cannot decide between two - // overloaded constructors of Matcher<const ArgumentTuple&>). - extra_matcher_(A<const ArgumentTuple&>()), + extra_matcher_(_), repeated_action_(DoDefault()) {} ~TypedExpectation() override { diff --git a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h index efa0462..eb85e26 100644 --- a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h @@ -43,6 +43,7 @@ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #include "gmock/internal/gmock-port.h" +#include "gtest/gtest.h" namespace testing { @@ -51,19 +52,6 @@ class Matcher; namespace internal { -// An IgnoredValue object can be implicitly constructed from ANY value. -// This is used in implementing the IgnoreResult(a) action. -class IgnoredValue { - public: - // This constructor template allows any value to be implicitly - // converted to IgnoredValue. The object has no data member and - // doesn't try to remember anything about the argument. We - // deliberately omit the 'explicit' keyword in order to allow the - // conversion to be implicit. - template <typename T> - IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit) -}; - // MatcherTuple<T>::type is a tuple type where each field is a Matcher // for the corresponding field in tuple type T. template <typename Tuple> diff --git a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump index 9962f6b..6787905 100644 --- a/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +++ b/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump @@ -44,6 +44,7 @@ $var n = 10 $$ The maximum arity we support. #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ #include "gmock/internal/gmock-port.h" +#include "gtest/gtest.h" namespace testing { @@ -52,19 +53,6 @@ class Matcher; namespace internal { -// An IgnoredValue object can be implicitly constructed from ANY value. -// This is used in implementing the IgnoreResult(a) action. -class IgnoredValue { - public: - // This constructor template allows any value to be implicitly - // converted to IgnoredValue. The object has no data member and - // doesn't try to remember anything about the argument. We - // deliberately omit the 'explicit' keyword in order to allow the - // conversion to be implicit. - template <typename T> - IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit) -}; - // MatcherTuple<T>::type is a tuple type where each field is a Matcher // for the corresponding field in tuple type T. template <typename Tuple> diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 133fcce..3de3d54 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -92,16 +92,11 @@ inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) { template <typename Element> inline Element* GetRawPointer(Element* p) { return p; } -// Symbian compilation can be done with wchar_t being either a native -// type or a typedef. Using Google Mock with OpenC without wchar_t -// should require the definition of _STLP_NO_WCHAR_T. -// // MSVC treats wchar_t as a native type usually, but treats it as the // same as unsigned short when the compiler option /Zc:wchar_t- is // specified. It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t // is a native type. -#if (GTEST_OS_SYMBIAN && defined(_STLP_NO_WCHAR_T)) || \ - (defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)) +#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED) // wchar_t is a typedef. #else # define GMOCK_WCHAR_T_IS_NATIVE_ 1 @@ -452,32 +447,10 @@ class StlContainerView<Element[N]> { static const_reference ConstReference(const Element (&array)[N]) { // Ensures that Element is not a const type. testing::StaticAssertTypeEq<Element, RawElement>(); -#if GTEST_OS_SYMBIAN - // The Nokia Symbian compiler confuses itself in template instantiation - // for this call without the cast to Element*: - // function call '[testing::internal::NativeArray<char *>].NativeArray( - // {lval} const char *[4], long, testing::internal::RelationToSource)' - // does not match - // 'testing::internal::NativeArray<char *>::NativeArray( - // char *const *, unsigned int, testing::internal::RelationToSource)' - // (instantiating: 'testing::internal::ContainsMatcherImpl - // <const char * (&)[4]>::Matches(const char * (&)[4]) const') - // (instantiating: 'testing::internal::StlContainerView<char *[4]>:: - // ConstReference(const char * (&)[4])') - // (and though the N parameter type is mismatched in the above explicit - // conversion of it doesn't help - only the conversion of the array). - return type(const_cast<Element*>(&array[0]), N, - RelationToSourceReference()); -#else return type(array, N, RelationToSourceReference()); -#endif // GTEST_OS_SYMBIAN } static type Copy(const Element (&array)[N]) { -#if GTEST_OS_SYMBIAN - return type(const_cast<Element*>(&array[0]), N, RelationToSourceCopy()); -#else return type(array, N, RelationToSourceCopy()); -#endif // GTEST_OS_SYMBIAN } }; |