Merge pull request #1959 from robinlinden:remove-msvc-workarounds
PiperOrigin-RevId: 221356626
This commit is contained in:
		@@ -2485,15 +2485,8 @@ class PropertyMatcher {
 | 
			
		||||
    *listener << whose_property_ << "is ";
 | 
			
		||||
    // Cannot pass the return value (for example, int) to MatchPrintAndExplain,
 | 
			
		||||
    // which takes a non-const reference as argument.
 | 
			
		||||
#if defined(_PREFAST_ ) && _MSC_VER == 1800
 | 
			
		||||
    // Workaround bug in VC++ 2013's /analyze parser.
 | 
			
		||||
    // https://connect.microsoft.com/VisualStudio/feedback/details/1106363/internal-compiler-error-with-analyze-due-to-failure-to-infer-move
 | 
			
		||||
    posix::Abort();  // To make sure it is never run.
 | 
			
		||||
    return false;
 | 
			
		||||
#else
 | 
			
		||||
    RefToConstProperty result = (obj.*property_)();
 | 
			
		||||
    return MatchPrintAndExplain(result, matcher_, listener);
 | 
			
		||||
#endif
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
 | 
			
		||||
 
 | 
			
		||||
@@ -55,10 +55,10 @@
 | 
			
		||||
#include "gtest/internal/gtest-port.h"
 | 
			
		||||
#include "gmock/internal/custom/gmock-port.h"
 | 
			
		||||
 | 
			
		||||
// For MS Visual C++, check the compiler version. At least VS 2003 is
 | 
			
		||||
// For MS Visual C++, check the compiler version. At least VS 2015 is
 | 
			
		||||
// required to compile Google Mock.
 | 
			
		||||
#if defined(_MSC_VER) && _MSC_VER < 1310
 | 
			
		||||
# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
 | 
			
		||||
#if defined(_MSC_VER) && _MSC_VER < 1900
 | 
			
		||||
# error "At least Visual C++ 2015 (14.0) is required to compile Google Mock."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Macro for referencing flags.  This is public as we want the user to
 | 
			
		||||
 
 | 
			
		||||
@@ -50,9 +50,9 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Silence C4800 (C4800: 'int *const ': forcing value
 | 
			
		||||
// to bool 'true' or 'false') for MSVC 14,15
 | 
			
		||||
// to bool 'true' or 'false') for MSVC 15
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#if _MSC_VER <= 1900
 | 
			
		||||
#if _MSC_VER == 1900
 | 
			
		||||
#  pragma warning(push)
 | 
			
		||||
#  pragma warning(disable:4800)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -887,7 +887,7 @@ InSequence::~InSequence() {
 | 
			
		||||
}  // namespace testing
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#if _MSC_VER <= 1900
 | 
			
		||||
#if _MSC_VER == 1900
 | 
			
		||||
#  pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -33,9 +33,9 @@
 | 
			
		||||
// This file tests the built-in actions.
 | 
			
		||||
 | 
			
		||||
// Silence C4800 (C4800: 'int *const ': forcing value
 | 
			
		||||
// to bool 'true' or 'false') for MSVC 14,15
 | 
			
		||||
// to bool 'true' or 'false') for MSVC 15
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#if _MSC_VER <= 1900
 | 
			
		||||
#if _MSC_VER == 1900
 | 
			
		||||
#  pragma warning(push)
 | 
			
		||||
#  pragma warning(disable:4800)
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -46,13 +46,6 @@
 | 
			
		||||
#include "gmock/gmock.h"
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
 | 
			
		||||
// There is a bug in MSVC (fixed in VS 2008) that prevents creating a
 | 
			
		||||
// mock for a function with const arguments, so we don't test such
 | 
			
		||||
// cases for MSVC versions older than 2008.
 | 
			
		||||
#if !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
 | 
			
		||||
# define GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
 | 
			
		||||
#endif  // !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
 | 
			
		||||
 | 
			
		||||
namespace testing {
 | 
			
		||||
namespace gmock_generated_function_mockers_test {
 | 
			
		||||
 | 
			
		||||
@@ -85,9 +78,7 @@ class FooInterface {
 | 
			
		||||
 | 
			
		||||
  virtual bool TakesNonConstReference(int& n) = 0;  // NOLINT
 | 
			
		||||
  virtual std::string TakesConstReference(const int& n) = 0;
 | 
			
		||||
#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
 | 
			
		||||
  virtual bool TakesConst(const int x) = 0;
 | 
			
		||||
#endif  // GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
 | 
			
		||||
 | 
			
		||||
  virtual int OverloadedOnArgumentNumber() = 0;
 | 
			
		||||
  virtual int OverloadedOnArgumentNumber(int n) = 0;
 | 
			
		||||
@@ -136,10 +127,7 @@ class MockFoo : public FooInterface {
 | 
			
		||||
 | 
			
		||||
  MOCK_METHOD1(TakesNonConstReference, bool(int&));  // NOLINT
 | 
			
		||||
  MOCK_METHOD1(TakesConstReference, std::string(const int&));
 | 
			
		||||
 | 
			
		||||
#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
 | 
			
		||||
  MOCK_METHOD1(TakesConst, bool(const int));  // NOLINT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  // Tests that the function return type can contain unprotected comma.
 | 
			
		||||
  MOCK_METHOD0(ReturnTypeWithComma, std::map<int, std::string>());
 | 
			
		||||
@@ -249,7 +237,6 @@ TEST_F(FunctionMockerTest, MocksFunctionWithConstReferenceArgument) {
 | 
			
		||||
  EXPECT_EQ("Hello", foo_->TakesConstReference(a));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
 | 
			
		||||
// Tests mocking a function that takes a const variable.
 | 
			
		||||
TEST_F(FunctionMockerTest, MocksFunctionWithConstArgument) {
 | 
			
		||||
  EXPECT_CALL(mock_foo_, TakesConst(Lt(10)))
 | 
			
		||||
@@ -257,7 +244,6 @@ TEST_F(FunctionMockerTest, MocksFunctionWithConstArgument) {
 | 
			
		||||
 | 
			
		||||
  EXPECT_FALSE(foo_->TakesConst(5));
 | 
			
		||||
}
 | 
			
		||||
#endif  // GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
 | 
			
		||||
 | 
			
		||||
// Tests mocking functions overloaded on the number of arguments.
 | 
			
		||||
TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user