summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/internal_utils.cmake2
-rw-r--r--include/gtest/internal/gtest-death-test-internal.h2
-rw-r--r--include/gtest/internal/gtest-port.h2
-rw-r--r--src/gtest.cc4
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.