From 4d26df729c4172a4786fb4ca509a264dfd9b89dc Mon Sep 17 00:00:00 2001 From: Brian Silverman Date: Tue, 19 Jul 2016 16:44:26 -0700 Subject: Speed up printing of characters which need hex escaping This change speeds up the runtime of a value-parameterized test I have which has lots of values with large strings full of unprintable characters by 2x. I profiled it and traced most of the slowness during googletest startup down to the way String::FormatHexInt was creating and destroyed a stringstream for each character in the string for each value. --- googletest/src/gtest-printers.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc index a2df412..dd67f64 100644 --- a/googletest/src/gtest-printers.cc +++ b/googletest/src/gtest-printers.cc @@ -180,7 +180,10 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { *os << static_cast(c); return kAsIs; } else { - *os << "\\x" + String::FormatHexInt(static_cast(c)); + ostream::fmtflags flags = os->flags(); + *os << "\\x" << std::hex << std::uppercase + << static_cast(static_cast(c)); + os->flags(flags); return kHexEscape; } } -- cgit v0.12 From f46bd00e369ea9948e485ae8f65bef658637dc61 Mon Sep 17 00:00:00 2001 From: Sam Lunt Date: Mon, 27 Nov 2017 17:07:56 -0600 Subject: make includes system --- googlemock/CMakeLists.txt | 4 ++-- googletest/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 724fdd5..a4e98af 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -101,8 +101,8 @@ cxx_library(gmock_main # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gmock INTERFACE "${gmock_SOURCE_DIR}/include") - target_include_directories(gmock_main INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") endif() ######################################################################## diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index b9a920b..f94d939 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -103,8 +103,8 @@ target_link_libraries(gtest_main gtest) # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gtest INTERFACE "${gtest_SOURCE_DIR}/include") - target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include") + target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") + target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") endif() ######################################################################## -- cgit v0.12 From 4aa05bd4ffb8148787bbcaa8780c9c522eb61b13 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Wed, 6 Dec 2017 15:33:27 -0500 Subject: Only switch to g++-4.9 on Linux. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 68acbd3..797c289 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. -- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi +- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi # /usr/bin/clang is 3.4, lets override with modern one. - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi # ccache on OS X needs installation first -- cgit v0.12 From 8d9d6bb0a3751ef3a7159aa0c2f1efd769d56075 Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Thu, 7 Dec 2017 18:17:43 +0100 Subject: Improved description of VS std::tuple support --- googletest/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index b9a920b..31fef2c 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -83,6 +83,8 @@ include_directories( # <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. # VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 # VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 >= 1910 std::tuple if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() -- cgit v0.12 From 3464f76e890a7f130988ffa0196577487d582b76 Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Thu, 7 Dec 2017 18:18:17 +0100 Subject: Improved description of VS std::tuple support --- googlemock/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 724fdd5..c474947 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -74,6 +74,8 @@ include_directories("${gmock_SOURCE_DIR}/include" # <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. # VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 # VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 >= 1910 std::tuple if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() -- cgit v0.12 From 57bb0bbbf80b006f35a249951fe2e051221173ae Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Thu, 7 Dec 2017 18:20:25 +0100 Subject: Remove C4996 warning in VS2017 --- googletest/include/gtest/internal/gtest-port.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 0c36007..0a0cd1d 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -642,6 +642,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) // STLport, provided with the Android NDK, has neither or . # define GTEST_HAS_TR1_TUPLE 0 +# elif defined(_MSC_VER) && (_MSC_VER >= 1910) +// Prevent `warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED.` +# define GTEST_HAS_TR1_TUPLE 0 # else // The user didn't tell us not to do it, so we assume it's OK. # define GTEST_HAS_TR1_TUPLE 1 -- cgit v0.12 From cf3adad594b68caad7a4093dbcd29c6bd7693eb0 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sun, 3 Dec 2017 14:24:13 -0500 Subject: Add licenses() directive for googlemock/tests. Without the directive embedding googletest into third_party breaks any //... target. --- googlemock/test/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel index 6e67f18..9f1a64d 100644 --- a/googlemock/test/BUILD.bazel +++ b/googlemock/test/BUILD.bazel @@ -32,6 +32,8 @@ # # Bazel Build for Google C++ Testing Framework(Google Test)-googlemock +licenses(["notice"]) + """ gmock own tests """ cc_test( -- cgit v0.12