summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2013-12-03 23:15:40 +0000
committerkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2013-12-03 23:15:40 +0000
commit2ba84be6837768b0bb204ea9b11b0aee8cb95883 (patch)
treebd8ceb355713073ae2b5d632b1ac5f45de8fc3de
parent022d52c97955a7c499435c3a9e03a3c74b7ebc29 (diff)
downloadgoogletest-2ba84be6837768b0bb204ea9b11b0aee8cb95883.tar.gz
Fix warnings encountered with clang -Wall.
git-svn-id: http://googletest.googlecode.com/svn/trunk@670 861a406c-534a-0410-8894-cb66d6ee9925
-rw-r--r--include/gtest/internal/gtest-port.h7
-rw-r--r--test/gtest-printers_test.cc1
-rw-r--r--test/gtest-unittest-api_test.cc4
3 files changed, 8 insertions, 4 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index a6726b4..b5c6446 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -810,8 +810,8 @@ class Secret;
// expression is true. For example, you could use it to verify the
// size of a static array:
//
-// GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
-// content_type_names_incorrect_size);
+// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
+// names_incorrect_size);
//
// or to make sure a struct is smaller than a certain size:
//
@@ -879,6 +879,9 @@ struct StaticAssertTypeEqHelper;
template <typename T>
struct StaticAssertTypeEqHelper<T, T> {};
+// Evaluates to the number of elements in 'array'.
+#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
+
#if GTEST_HAS_GLOBAL_STRING
typedef ::string string;
#else
diff --git a/test/gtest-printers_test.cc b/test/gtest-printers_test.cc
index 184f9d9..c2ba711 100644
--- a/test/gtest-printers_test.cc
+++ b/test/gtest-printers_test.cc
@@ -125,6 +125,7 @@ namespace foo {
class UnprintableInFoo {
public:
UnprintableInFoo() : z_(0) { memcpy(xy_, "\xEF\x12\x0\x0\x34\xAB\x0\x0", 8); }
+ double z() const { return z_; }
private:
char xy_[8];
double z_;
diff --git a/test/gtest-unittest-api_test.cc b/test/gtest-unittest-api_test.cc
index 07083e5..b1f5168 100644
--- a/test/gtest-unittest-api_test.cc
+++ b/test/gtest-unittest-api_test.cc
@@ -54,7 +54,7 @@ class UnitTestHelper {
public:
// Returns the array of pointers to all test cases sorted by the test case
// name. The caller is responsible for deleting the array.
- static TestCase const** const GetSortedTestCases() {
+ static TestCase const** GetSortedTestCases() {
UnitTest& unit_test = *UnitTest::GetInstance();
TestCase const** const test_cases =
new const TestCase*[unit_test.total_test_case_count()];
@@ -83,7 +83,7 @@ class UnitTestHelper {
// Returns the array of pointers to all tests in a particular test case
// sorted by the test name. The caller is responsible for deleting the
// array.
- static TestInfo const** const GetSortedTests(const TestCase* test_case) {
+ static TestInfo const** GetSortedTests(const TestCase* test_case) {
TestInfo const** const tests =
new const TestInfo*[test_case->total_test_count()];