Fix warnings encountered with clang -Wall.

This commit is contained in:
kosak 2013-12-03 23:15:40 +00:00
parent 37b97d1c93
commit 5d83ee08df
3 changed files with 8 additions and 4 deletions

View File

@ -810,8 +810,8 @@ class Secret;
// expression is true. For example, you could use it to verify the // expression is true. For example, you could use it to verify the
// size of a static array: // size of a static array:
// //
// GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES, // GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
// content_type_names_incorrect_size); // names_incorrect_size);
// //
// or to make sure a struct is smaller than a certain size: // or to make sure a struct is smaller than a certain size:
// //
@ -879,6 +879,9 @@ struct StaticAssertTypeEqHelper;
template <typename T> template <typename T>
struct StaticAssertTypeEqHelper<T, 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 #if GTEST_HAS_GLOBAL_STRING
typedef ::string string; typedef ::string string;
#else #else

View File

@ -125,6 +125,7 @@ namespace foo {
class UnprintableInFoo { class UnprintableInFoo {
public: public:
UnprintableInFoo() : z_(0) { memcpy(xy_, "\xEF\x12\x0\x0\x34\xAB\x0\x0", 8); } UnprintableInFoo() : z_(0) { memcpy(xy_, "\xEF\x12\x0\x0\x34\xAB\x0\x0", 8); }
double z() const { return z_; }
private: private:
char xy_[8]; char xy_[8];
double z_; double z_;

View File

@ -54,7 +54,7 @@ class UnitTestHelper {
public: public:
// Returns the array of pointers to all test cases sorted by the test case // Returns the array of pointers to all test cases sorted by the test case
// name. The caller is responsible for deleting the array. // name. The caller is responsible for deleting the array.
static TestCase const** const GetSortedTestCases() { static TestCase const** GetSortedTestCases() {
UnitTest& unit_test = *UnitTest::GetInstance(); UnitTest& unit_test = *UnitTest::GetInstance();
TestCase const** const test_cases = TestCase const** const test_cases =
new const TestCase*[unit_test.total_test_case_count()]; 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 // 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 // sorted by the test name. The caller is responsible for deleting the
// array. // array.
static TestInfo const** const GetSortedTests(const TestCase* test_case) { static TestInfo const** GetSortedTests(const TestCase* test_case) {
TestInfo const** const tests = TestInfo const** const tests =
new const TestInfo*[test_case->total_test_count()]; new const TestInfo*[test_case->total_test_count()];