From bcd35523cd7cc376927173ce5621b544c122bacb Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 6 May 2017 10:22:12 -0400 Subject: [PATCH 1/2] Avoid warning C4619 in MSVC 2017. C4800 has since been removed in MSVC 2017, so trying to silence it throws warning C4619 when enabled. --- googletest/include/gtest/gtest.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index a19625f3..2ad5a0cb 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -259,7 +259,9 @@ class GTEST_API_ AssertionResult { // Used in EXPECT_TRUE/FALSE(assertion_result). AssertionResult(const AssertionResult& other); +#if defined(_MSC_VER) && _MSC_VER < 1910 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */) +#endif // Used in the EXPECT_TRUE/FALSE(bool_expression). // @@ -276,7 +278,9 @@ class GTEST_API_ AssertionResult { /*enabler*/ = NULL) : success_(success) {} +#if defined(_MSC_VER) && _MSC_VER < 1910 GTEST_DISABLE_MSC_WARNINGS_POP_() +#endif // Assignment operator. AssertionResult& operator=(AssertionResult other) { From e7734fb80cac5dd1f7c9845d5530d80b664a9f3e Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 2 Jan 2018 14:42:09 -0500 Subject: [PATCH 2/2] OSS Sync, cl 163329677 --- googletest/samples/prime_tables.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h index 92ce16a0..55a3b44e 100644 --- a/googletest/samples/prime_tables.h +++ b/googletest/samples/prime_tables.h @@ -103,11 +103,15 @@ class PreCalculatedPrimeTable : public PrimeTable { ::std::fill(is_prime_, is_prime_ + is_prime_size_, true); is_prime_[0] = is_prime_[1] = false; - for (int i = 2; i <= max; i++) { + // Checks every candidate for prime number (we know that 2 is the only even + // prime). + for (int i = 2; i*i <= max; i += i%2+1) { if (!is_prime_[i]) continue; // Marks all multiples of i (except i itself) as non-prime. - for (int j = 2*i; j <= max; j += i) { + // We are starting here from i-th multiplier, because all smaller + // complex numbers were already marked. + for (int j = i*i; j <= max; j += i) { is_prime_[j] = false; } }