diff options
author | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-07-14 22:36:31 (GMT) |
---|---|---|
committer | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-07-14 22:36:31 (GMT) |
commit | 447ed6474deca82844b211e57503579ab1c560f0 (patch) | |
tree | 1b59366f9b80c25b0ed734dbe5d588ffc0682ec9 | |
parent | 3899557cb8563bb0da8f44d435bb02b2095e07fb (diff) | |
download | googletest-447ed6474deca82844b211e57503579ab1c560f0.zip googletest-447ed6474deca82844b211e57503579ab1c560f0.tar.gz googletest-447ed6474deca82844b211e57503579ab1c560f0.tar.bz2 |
Fixes warnings when built by GCC with -Wswitch-default. Original patch by Zhixu Liu (zhixu.liu@gmail.com).
-rw-r--r-- | cmake/internal_utils.cmake | 2 | ||||
-rw-r--r-- | include/gtest/internal/gtest-death-test-internal.h | 2 | ||||
-rw-r--r-- | include/gtest/internal/gtest-port.h | 2 | ||||
-rw-r--r-- | src/gtest.cc | 4 |
4 files changed, 6 insertions, 4 deletions
diff --git a/cmake/internal_utils.cmake b/cmake/internal_utils.cmake index 68b7978..0954e2d 100644 --- a/cmake/internal_utils.cmake +++ b/cmake/internal_utils.cmake @@ -54,7 +54,7 @@ elseif (CMAKE_COMPILER_IS_GNUCXX) # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI # explicitly. set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0") - set(cxx_strict_flags "-Wextra") + set(cxx_strict_flags "-Wextra -Wswitch-default") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") set(cxx_exception_flags "-features=except") # Sun Pro doesn't provide macros to indicate whether exceptions and diff --git a/include/gtest/internal/gtest-death-test-internal.h b/include/gtest/internal/gtest-death-test-internal.h index e433084..9bd2aa3 100644 --- a/include/gtest/internal/gtest-death-test-internal.h +++ b/include/gtest/internal/gtest-death-test-internal.h @@ -176,6 +176,8 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status); gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \ break; \ } \ + default: \ + break; \ } \ } \ } else \ diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 0ad570a..aa3d0af 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -535,7 +535,7 @@ #ifdef __INTEL_COMPILER #define GTEST_AMBIGUOUS_ELSE_BLOCKER_ #else -#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: // NOLINT +#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT #endif // Use this annotation at the end of a struct/class definition to diff --git a/src/gtest.cc b/src/gtest.cc index 9855f53..a64327b 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -2504,9 +2504,9 @@ static const char * TestPartResultTypeToString(TestPartResult::Type type) { #else return "Failure\n"; #endif + default: + return "Unknown result type"; } - - return "Unknown result type"; } // Prints a TestPartResult to a String. |