Fixes warnings when built by GCC with -Wswitch-default. Original patch by Zhixu Liu (zhixu.liu@gmail.com).
This commit is contained in:
parent
3899557cb8
commit
447ed6474d
@ -54,7 +54,7 @@ elseif (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
# whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
|
# whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
|
||||||
# explicitly.
|
# explicitly.
|
||||||
set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
|
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")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
|
||||||
set(cxx_exception_flags "-features=except")
|
set(cxx_exception_flags "-features=except")
|
||||||
# Sun Pro doesn't provide macros to indicate whether exceptions and
|
# Sun Pro doesn't provide macros to indicate whether exceptions and
|
||||||
|
@ -176,6 +176,8 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
default: \
|
||||||
|
break; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} else \
|
} else \
|
||||||
|
@ -535,7 +535,7 @@
|
|||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
|
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
|
||||||
#else
|
#else
|
||||||
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: // NOLINT
|
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use this annotation at the end of a struct/class definition to
|
// Use this annotation at the end of a struct/class definition to
|
||||||
|
@ -2504,9 +2504,9 @@ static const char * TestPartResultTypeToString(TestPartResult::Type type) {
|
|||||||
#else
|
#else
|
||||||
return "Failure\n";
|
return "Failure\n";
|
||||||
#endif
|
#endif
|
||||||
|
default:
|
||||||
|
return "Unknown result type";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown result type";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints a TestPartResult to a String.
|
// Prints a TestPartResult to a String.
|
||||||
|
Loading…
Reference in New Issue
Block a user