Skip to content
Browse files

Cleanup warnings

  • Loading branch information...
1 parent fe0ea8e commit 6445f6c1172b5159e7acf6c729ead1da74723768 @rescrv committed
Showing with 189 additions and 134 deletions.
  1. +41 −1 e/guard.h
  2. +4 −4 e/nonblocking_bounded_fifo.h
  3. +1 −1 e/varint.h
  4. +3 −3 m4/anal_warnings.m4
  5. +6 −6 test/bitfield.cc
  6. +92 −91 test/buffer.cc
  7. +20 −20 test/convert.cc
  8. +2 −0 test/endian.cc
  9. +8 −0 test/guard.cc
  10. +6 −4 test/intrusive_ptr.cc
  11. +4 −4 test/locking_iterable_fifo.cc
  12. +2 −0 test/runner.cc
View
42 e/guard.h
@@ -60,7 +60,7 @@ class guard_base
other.dismiss();
}
- ~guard_base() {}
+ virtual ~guard_base() {}
protected:
mutable bool m_dismissed;
@@ -86,6 +86,10 @@ class guard_func0 : public guard_base
}
}
+ public:
+ guard_func0(const guard_func0& other);
+ guard_func0& operator = (const guard_func0& rhs);
+
private:
F m_func;
};
@@ -115,6 +119,10 @@ class guard_func1 : public guard_base
}
}
+ public:
+ guard_func1(const guard_func1& other);
+ guard_func1& operator = (const guard_func1& rhs);
+
private:
F m_func;
const P1 m_p1;
@@ -146,6 +154,10 @@ class guard_func2 : public guard_base
}
}
+ public:
+ guard_func2(const guard_func2& other);
+ guard_func2& operator = (const guard_func2& rhs);
+
private:
F m_func;
const P1 m_p1;
@@ -179,6 +191,10 @@ class guard_func3 : public guard_base
}
}
+ public:
+ guard_func3(const guard_func3& other);
+ guard_func3& operator = (const guard_func3& rhs);
+
private:
F m_func;
const P1 m_p1;
@@ -211,6 +227,10 @@ class guard_obj0 : public guard_base
}
}
+ public:
+ guard_obj0(const guard_obj0& other);
+ guard_obj0& operator = (const guard_obj0& rhs);
+
private:
O& m_obj;
F m_func;
@@ -242,6 +262,10 @@ class guard_obj1 : public guard_base
}
}
+ public:
+ guard_obj1(const guard_obj1& other);
+ guard_obj1& operator = (const guard_obj1& rhs);
+
private:
O& m_obj;
F m_func;
@@ -275,6 +299,10 @@ class guard_obj2 : public guard_base
}
}
+ public:
+ guard_obj2(const guard_obj2& other);
+ guard_obj2& operator = (const guard_obj2& rhs);
+
private:
O& m_obj;
F m_func;
@@ -310,6 +338,10 @@ class guard_obj3 : public guard_base
}
}
+ public:
+ guard_obj3(const guard_obj3& other);
+ guard_obj3& operator = (const guard_obj3& rhs);
+
private:
O& m_obj;
F m_func;
@@ -347,6 +379,10 @@ class guard_obj4 : public guard_base
}
}
+ public:
+ guard_obj4(const guard_obj4& other);
+ guard_obj4& operator = (const guard_obj4& rhs);
+
private:
O& m_obj;
F m_func;
@@ -386,6 +422,10 @@ class guard_obj5 : public guard_base
}
}
+ public:
+ guard_obj5(const guard_obj5& other);
+ guard_obj5& operator = (const guard_obj5& rhs);
+
private:
O& m_obj;
F m_func;
View
8 e/nonblocking_bounded_fifo.h
@@ -79,10 +79,10 @@ class nonblocking_bounded_fifo
template <typename T>
nonblocking_bounded_fifo<T> :: nonblocking_bounded_fifo(size_t sz)
- : m_sz(sz)
- , m_elems(NULL)
- , m_push(0)
+ : m_push(0)
, m_pop(0)
+ , m_sz(sz)
+ , m_elems(NULL)
{
using namespace e::atomic;
assert(m_sz >= 2);
@@ -189,7 +189,7 @@ nonblocking_bounded_fifo<T> :: pop(T* t)
}
*t = elem->t;
- T fresh;
+ T fresh = T();
elem->t = fresh;
store_64_release(&elem->count, po + m_sz);
return true;
View
2 e/varint.h
@@ -36,7 +36,7 @@ char*
varint64_encode(char* dst, uint64_t value);
// Returns the length of the varint32 or varint64 encoding of "v"
-int
+inline int
varint_length(uint64_t v)
{
int len = 1;
View
6 m4/anal_warnings.m4
@@ -46,7 +46,7 @@ AC_DEFUN([ANAL_WARNINGS],
AX_CHECK_COMPILE_FLAG([-Wchar-subscripts],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wchar-subscripts"],,)
AX_CHECK_COMPILE_FLAG([-Wclobbered],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wclobbered"],,)
AX_CHECK_COMPILE_FLAG([-Wcomment],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wcomment"],,)
- AX_CHECK_COMPILE_FLAG([-Wconversion],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wconversion"],,)
+ dnl AX_CHECK_COMPILE_FLAG([-Wconversion],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wconversion"],,)
AX_CHECK_COMPILE_FLAG([-Wctor-dtor-privacy],[WANAL_CXXFLAGS="${WANAL_CXXFLAGS} -Wctor-dtor-privacy"],,)
AX_CHECK_COMPILE_FLAG([-Wdisabled-optimization],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wdisabled-optimization"],,)
AX_CHECK_COMPILE_FLAG([-Weffc++],[WANAL_CXXFLAGS="${WANAL_CXXFLAGS} -Weffc++"],,)
@@ -80,7 +80,7 @@ AC_DEFUN([ANAL_WARNINGS],
AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual],[WANAL_CXXFLAGS="${WANAL_CXXFLAGS} -Woverloaded-virtual"],,)
AX_CHECK_COMPILE_FLAG([-Wpacked-bitfield-compat],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wpacked-bitfield-compat"],,)
AX_CHECK_COMPILE_FLAG([-Wpacked],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wpacked"],,)
- AX_CHECK_COMPILE_FLAG([-Wpadded],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wpadded"],,)
+ dnl AX_CHECK_COMPILE_FLAG([-Wpadded],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wpadded"],,)
AX_CHECK_COMPILE_FLAG([-Wparentheses],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wparentheses"],,)
AX_CHECK_COMPILE_FLAG([-Wpointer-arith],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wpointer-arith"],,)
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wredundant-decls"],,)
@@ -89,7 +89,7 @@ AC_DEFUN([ANAL_WARNINGS],
AX_CHECK_COMPILE_FLAG([-Wsequence-point],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wsequence-point"],,)
AX_CHECK_COMPILE_FLAG([-Wshadow],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wshadow"],,)
AX_CHECK_COMPILE_FLAG([-Wsign-compare],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wsign-compare"],,)
- AX_CHECK_COMPILE_FLAG([-Wsign-conversion],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wsign-conversion"],,)
+ dnl AX_CHECK_COMPILE_FLAG([-Wsign-conversion],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wsign-conversion"],,)
AX_CHECK_COMPILE_FLAG([-Wsign-promo],[WANAL_CXXFLAGS="${WANAL_CXXFLAGS} -Wsign-promo"],,)
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wstack-protector"],,)
AX_CHECK_COMPILE_FLAG([-Wstrict-aliasing=3],[WANAL_CFLAGS="${WANAL_CFLAGS} -Wstrict-aliasing=3"],,)
View
12 test/bitfield.cc
@@ -39,14 +39,14 @@ namespace
TEST(BitfieldTest, CtorAndDtor)
{
e::bitfield b1(8);
- ASSERT_EQ(8, b1.bits());
- ASSERT_EQ(1, b1.bytes());
+ ASSERT_EQ(8U, b1.bits());
+ ASSERT_EQ(1U, b1.bytes());
e::bitfield b2(16);
- ASSERT_EQ(16, b2.bits());
- ASSERT_EQ(2, b2.bytes());
+ ASSERT_EQ(16U, b2.bits());
+ ASSERT_EQ(2U, b2.bytes());
e::bitfield b3(75);
- ASSERT_EQ(75, b3.bits());
- ASSERT_EQ(10, b3.bytes());
+ ASSERT_EQ(75U, b3.bits());
+ ASSERT_EQ(10U, b3.bytes());
}
static void
View
183 test/buffer.cc
@@ -44,16 +44,16 @@ TEST(BufferTest, CtorAndDtor)
{
// Create a buffer without any size
std::auto_ptr<e::buffer> a(e::buffer::create(0));
- ASSERT_EQ(0, a->size());
- ASSERT_EQ(0, a->capacity());
+ ASSERT_EQ(0U, a->size());
+ ASSERT_EQ(0U, a->capacity());
// Create a buffer which can pack 2 bytes
std::auto_ptr<e::buffer> b(e::buffer::create(2));
- ASSERT_EQ(0, b->size());
- ASSERT_EQ(2, b->capacity());
+ ASSERT_EQ(0U, b->size());
+ ASSERT_EQ(2U, b->capacity());
// Create a buffer with the three bytes "XYZ"
std::auto_ptr<e::buffer> c(e::buffer::create("xyz", 3));
- ASSERT_EQ(3, c->size());
- ASSERT_EQ(3, c->capacity());
+ ASSERT_EQ(3U, c->size());
+ ASSERT_EQ(3U, c->capacity());
}
TEST(BufferTest, PackBuffer)
@@ -66,7 +66,7 @@ TEST(BufferTest, PackBuffer)
std::auto_ptr<e::buffer> packed(e::buffer::create(34));
*packed << a << b << c << d << buf->as_slice();
- ASSERT_EQ(29, packed->size());
+ ASSERT_EQ(29U, packed->size());
ASSERT_MEMCMP(packed->data(),
"\xde\xad\xbe\xef\xca\xfe\xba\xbe"
"\x8b\xad\xf0\x0d"
@@ -76,7 +76,7 @@ TEST(BufferTest, PackBuffer)
29);
packed->pack_at(12) << d << c << buf->as_slice();
- ASSERT_EQ(29, packed->size());
+ ASSERT_EQ(29U, packed->size());
ASSERT_MEMCMP(packed->data(),
"\xde\xad\xbe\xef\xca\xfe\xba\xbe"
"\x8b\xad\xf0\x0d"
@@ -105,7 +105,7 @@ TEST(BufferTest, UnpackBuffer)
ASSERT_EQ(0x8badf00dUL, b);
ASSERT_EQ(0xface, c);
ASSERT_EQ('!', d);
- ASSERT_EQ(10, sl.size());
+ ASSERT_EQ(10U, sl.size());
ASSERT_MEMCMP("the buffer", sl.data(), 10);
}
@@ -115,13 +115,13 @@ TEST(BufferTest, UnpackErrors)
uint32_t a;
e::unpacker up = *buf >> a;
ASSERT_EQ(0x8badf00d, a);
- ASSERT_EQ(2, up.remain());
+ ASSERT_EQ(2U, up.remain());
ASSERT_FALSE(up.error());
// "a" should not change even if nup fails
e::unpacker nup = up >> a;
ASSERT_EQ(0x8badf00d, a);
- ASSERT_EQ(2, up.remain());
+ ASSERT_EQ(2U, up.remain());
ASSERT_FALSE(up.error());
ASSERT_TRUE(nup.error());
@@ -129,7 +129,7 @@ TEST(BufferTest, UnpackErrors)
uint16_t b;
up = up >> b;
ASSERT_EQ(0xface, b);
- ASSERT_EQ(0, up.remain());
+ ASSERT_EQ(0U, up.remain());
ASSERT_FALSE(up.error());
}
@@ -137,20 +137,20 @@ TEST(BufferTest, Shift)
{
// Create a buffer of four characters
std::auto_ptr<e::buffer> buf(e::buffer::create("\xde\xad\xbe\xef", 4));
- ASSERT_EQ(4, buf->size());
- ASSERT_EQ(4, buf->capacity());
+ ASSERT_EQ(4U, buf->size());
+ ASSERT_EQ(4U, buf->capacity());
ASSERT_TRUE(buf->cmp("\xde\xad\xbe\xef", 4));
// Shift once
buf->shift(2);
- ASSERT_EQ(2, buf->size());
- ASSERT_EQ(4, buf->capacity());
+ ASSERT_EQ(2U, buf->size());
+ ASSERT_EQ(4U, buf->capacity());
ASSERT_TRUE(buf->cmp("\xbe\xef", 2));
// Shift again
buf->shift(2);
- ASSERT_EQ(0, buf->size());
- ASSERT_EQ(4, buf->capacity());
+ ASSERT_EQ(0U, buf->size());
+ ASSERT_EQ(4U, buf->capacity());
ASSERT_TRUE(buf->cmp("", 0));
}
@@ -158,76 +158,76 @@ TEST(BufferTest, ShiftExcess)
{
// Create a buffer of four characters
std::auto_ptr<e::buffer> buf(e::buffer::create("\xde\xad\xbe\xef", 4));
- ASSERT_EQ(4, buf->size());
- ASSERT_EQ(4, buf->capacity());
+ ASSERT_EQ(4U, buf->size());
+ ASSERT_EQ(4U, buf->capacity());
ASSERT_TRUE(buf->cmp("\xde\xad\xbe\xef", 4));
// Shift once
buf->shift(6);
- ASSERT_EQ(0, buf->size());
- ASSERT_EQ(4, buf->capacity());
+ ASSERT_EQ(0U, buf->size());
+ ASSERT_EQ(4U, buf->capacity());
ASSERT_TRUE(buf->cmp("", 0));
}
TEST(BufferTest, IndexMem)
{
std::auto_ptr<e::buffer> buf(e::buffer::create("0123456789", 10));
- ASSERT_EQ(0, buf->index("", 0)); // Test for bad glibc
- ASSERT_EQ(0, buf->index("0", 1));
- ASSERT_EQ(1, buf->index("1", 1));
- ASSERT_EQ(2, buf->index("2", 1));
- ASSERT_EQ(3, buf->index("3", 1));
- ASSERT_EQ(4, buf->index("4", 1));
- ASSERT_EQ(5, buf->index("5", 1));
- ASSERT_EQ(6, buf->index("6", 1));
- ASSERT_EQ(7, buf->index("7", 1));
- ASSERT_EQ(8, buf->index("8", 1));
- ASSERT_EQ(9, buf->index("9", 1));
- ASSERT_EQ(0, buf->index("01", 2));
- ASSERT_EQ(1, buf->index("12", 2));
- ASSERT_EQ(2, buf->index("23", 2));
- ASSERT_EQ(3, buf->index("34", 2));
- ASSERT_EQ(4, buf->index("45", 2));
- ASSERT_EQ(5, buf->index("56", 2));
- ASSERT_EQ(6, buf->index("67", 2));
- ASSERT_EQ(7, buf->index("78", 2));
- ASSERT_EQ(8, buf->index("89", 2));
- ASSERT_EQ(0, buf->index("012", 3));
- ASSERT_EQ(1, buf->index("123", 3));
- ASSERT_EQ(2, buf->index("234", 3));
- ASSERT_EQ(3, buf->index("345", 3));
- ASSERT_EQ(4, buf->index("456", 3));
- ASSERT_EQ(5, buf->index("567", 3));
- ASSERT_EQ(6, buf->index("678", 3));
- ASSERT_EQ(7, buf->index("789", 3));
- ASSERT_EQ(0, buf->index("0123", 4));
- ASSERT_EQ(1, buf->index("1234", 4));
- ASSERT_EQ(2, buf->index("2345", 4));
- ASSERT_EQ(3, buf->index("3456", 4));
- ASSERT_EQ(4, buf->index("4567", 4));
- ASSERT_EQ(5, buf->index("5678", 4));
- ASSERT_EQ(6, buf->index("6789", 4));
- ASSERT_EQ(0, buf->index("01234", 5));
- ASSERT_EQ(1, buf->index("12345", 5));
- ASSERT_EQ(2, buf->index("23456", 5));
- ASSERT_EQ(3, buf->index("34567", 5));
- ASSERT_EQ(4, buf->index("45678", 5));
- ASSERT_EQ(5, buf->index("56789", 5));
- ASSERT_EQ(0, buf->index("012345", 6));
- ASSERT_EQ(1, buf->index("123456", 6));
- ASSERT_EQ(2, buf->index("234567", 6));
- ASSERT_EQ(3, buf->index("345678", 6));
- ASSERT_EQ(4, buf->index("456789", 6));
- ASSERT_EQ(0, buf->index("0123456", 7));
- ASSERT_EQ(1, buf->index("1234567", 7));
- ASSERT_EQ(2, buf->index("2345678", 7));
- ASSERT_EQ(3, buf->index("3456789", 7));
- ASSERT_EQ(0, buf->index("01234567", 8));
- ASSERT_EQ(1, buf->index("12345678", 8));
- ASSERT_EQ(2, buf->index("23456789", 8));
- ASSERT_EQ(0, buf->index("012345678", 9));
- ASSERT_EQ(1, buf->index("123456789", 9));
- ASSERT_EQ(0, buf->index("0123456789", 10));
+ ASSERT_EQ(0U, buf->index("", 0)); // Test for bad glibc
+ ASSERT_EQ(0U, buf->index("0", 1));
+ ASSERT_EQ(1U, buf->index("1", 1));
+ ASSERT_EQ(2U, buf->index("2", 1));
+ ASSERT_EQ(3U, buf->index("3", 1));
+ ASSERT_EQ(4U, buf->index("4", 1));
+ ASSERT_EQ(5U, buf->index("5", 1));
+ ASSERT_EQ(6U, buf->index("6", 1));
+ ASSERT_EQ(7U, buf->index("7", 1));
+ ASSERT_EQ(8U, buf->index("8", 1));
+ ASSERT_EQ(9U, buf->index("9", 1));
+ ASSERT_EQ(0U, buf->index("01", 2));
+ ASSERT_EQ(1U, buf->index("12", 2));
+ ASSERT_EQ(2U, buf->index("23", 2));
+ ASSERT_EQ(3U, buf->index("34", 2));
+ ASSERT_EQ(4U, buf->index("45", 2));
+ ASSERT_EQ(5U, buf->index("56", 2));
+ ASSERT_EQ(6U, buf->index("67", 2));
+ ASSERT_EQ(7U, buf->index("78", 2));
+ ASSERT_EQ(8U, buf->index("89", 2));
+ ASSERT_EQ(0U, buf->index("012", 3));
+ ASSERT_EQ(1U, buf->index("123", 3));
+ ASSERT_EQ(2U, buf->index("234", 3));
+ ASSERT_EQ(3U, buf->index("345", 3));
+ ASSERT_EQ(4U, buf->index("456", 3));
+ ASSERT_EQ(5U, buf->index("567", 3));
+ ASSERT_EQ(6U, buf->index("678", 3));
+ ASSERT_EQ(7U, buf->index("789", 3));
+ ASSERT_EQ(0U, buf->index("0123", 4));
+ ASSERT_EQ(1U, buf->index("1234", 4));
+ ASSERT_EQ(2U, buf->index("2345", 4));
+ ASSERT_EQ(3U, buf->index("3456", 4));
+ ASSERT_EQ(4U, buf->index("4567", 4));
+ ASSERT_EQ(5U, buf->index("5678", 4));
+ ASSERT_EQ(6U, buf->index("6789", 4));
+ ASSERT_EQ(0U, buf->index("01234", 5));
+ ASSERT_EQ(1U, buf->index("12345", 5));
+ ASSERT_EQ(2U, buf->index("23456", 5));
+ ASSERT_EQ(3U, buf->index("34567", 5));
+ ASSERT_EQ(4U, buf->index("45678", 5));
+ ASSERT_EQ(5U, buf->index("56789", 5));
+ ASSERT_EQ(0U, buf->index("012345", 6));
+ ASSERT_EQ(1U, buf->index("123456", 6));
+ ASSERT_EQ(2U, buf->index("234567", 6));
+ ASSERT_EQ(3U, buf->index("345678", 6));
+ ASSERT_EQ(4U, buf->index("456789", 6));
+ ASSERT_EQ(0U, buf->index("0123456", 7));
+ ASSERT_EQ(1U, buf->index("1234567", 7));
+ ASSERT_EQ(2U, buf->index("2345678", 7));
+ ASSERT_EQ(3U, buf->index("3456789", 7));
+ ASSERT_EQ(0U, buf->index("01234567", 8));
+ ASSERT_EQ(1U, buf->index("12345678", 8));
+ ASSERT_EQ(2U, buf->index("23456789", 8));
+ ASSERT_EQ(0U, buf->index("012345678", 9));
+ ASSERT_EQ(1U, buf->index("123456789", 9));
+ ASSERT_EQ(0U, buf->index("0123456789", 10));
ASSERT_EQ(buf->capacity(), buf->index("A", 1)); // It's not there.
ASSERT_EQ(buf->capacity(), buf->index("B", 1)); // It's not there.
}
@@ -235,16 +235,16 @@ TEST(BufferTest, IndexMem)
TEST(BufferTest, IndexChr)
{
std::auto_ptr<e::buffer> buf(e::buffer::create("0123456789", 10));
- ASSERT_EQ(0, buf->index('0'));
- ASSERT_EQ(1, buf->index('1'));
- ASSERT_EQ(2, buf->index('2'));
- ASSERT_EQ(3, buf->index('3'));
- ASSERT_EQ(4, buf->index('4'));
- ASSERT_EQ(5, buf->index('5'));
- ASSERT_EQ(6, buf->index('6'));
- ASSERT_EQ(7, buf->index('7'));
- ASSERT_EQ(8, buf->index('8'));
- ASSERT_EQ(9, buf->index('9'));
+ ASSERT_EQ(0U, buf->index('0'));
+ ASSERT_EQ(1U, buf->index('1'));
+ ASSERT_EQ(2U, buf->index('2'));
+ ASSERT_EQ(3U, buf->index('3'));
+ ASSERT_EQ(4U, buf->index('4'));
+ ASSERT_EQ(5U, buf->index('5'));
+ ASSERT_EQ(6U, buf->index('6'));
+ ASSERT_EQ(7U, buf->index('7'));
+ ASSERT_EQ(8U, buf->index('8'));
+ ASSERT_EQ(9U, buf->index('9'));
ASSERT_EQ(buf->capacity(), buf->index('A')); // It's not there.
ASSERT_EQ(buf->capacity(), buf->index('B')); // It's not there.
}
@@ -266,7 +266,8 @@ TEST(BufferTest, VectorPack)
vector.push_back(0xbeef);
vector.push_back(0xcafe);
vector.push_back(0xbabe);
- e::buffer::packer p = *buf << vector;
+ e::buffer::packer p = buf->pack_at(0);
+ p = p << vector;
ASSERT_TRUE(buf->cmp("\x00\x00\x00\x04"
"\xde\xad\xbe\xef"
"\xca\xfe\xba\xbe", 12));
@@ -279,7 +280,7 @@ TEST(BufferTest, VectorUnpack)
"\xca\xfe\xba\xbe", 12));
std::vector<uint16_t> vector;
*buf >> vector;
- ASSERT_EQ(4, vector.size());
+ ASSERT_EQ(4U, vector.size());
ASSERT_EQ(0xdead, vector[0]);
ASSERT_EQ(0xbeef, vector[1]);
ASSERT_EQ(0xcafe, vector[2]);
@@ -297,7 +298,7 @@ TEST(BufferTest, VectorUnpackFail)
e::unpacker good = *buf >> vector_good;
ASSERT_TRUE(bad.error());
ASSERT_FALSE(good.error());
- ASSERT_EQ(4, vector_good.size());
+ ASSERT_EQ(4U, vector_good.size());
ASSERT_EQ(0xdead, vector_good[0]);
ASSERT_EQ(0xbeef, vector_good[1]);
ASSERT_EQ(0xcafe, vector_good[2]);
View
40 test/convert.cc
@@ -38,11 +38,11 @@ TEST(ConvertTest, Uint64NormalCases)
try
{
- ASSERT_EQ(0, e::convert::to_uint64_t("0"));
- ASSERT_EQ(0, e::convert::to_uint64_t("0x0"));
- ASSERT_EQ(0, e::convert::to_uint64_t("0x0", 16));
- ASSERT_EQ(0, e::convert::to_uint64_t("00"));
- ASSERT_EQ(0, e::convert::to_uint64_t("00", 8));
+ ASSERT_EQ(0U, e::convert::to_uint64_t("0"));
+ ASSERT_EQ(0U, e::convert::to_uint64_t("0x0"));
+ ASSERT_EQ(0U, e::convert::to_uint64_t("0x0", 16));
+ ASSERT_EQ(0U, e::convert::to_uint64_t("00"));
+ ASSERT_EQ(0U, e::convert::to_uint64_t("00", 8));
ASSERT_EQ(18446744073709551615ULL, e::convert::to_uint64_t("18446744073709551615"));
ASSERT_EQ(18446744073709551615ULL, e::convert::to_uint64_t("0xffffffffffffffff"));
@@ -62,11 +62,11 @@ TEST(ConvertTest, Uint32NormalCases)
try
{
- ASSERT_EQ(0, e::convert::to_uint32_t("0"));
- ASSERT_EQ(0, e::convert::to_uint32_t("0x0"));
- ASSERT_EQ(0, e::convert::to_uint32_t("0x0", 16));
- ASSERT_EQ(0, e::convert::to_uint32_t("00"));
- ASSERT_EQ(0, e::convert::to_uint32_t("00", 8));
+ ASSERT_EQ(0U, e::convert::to_uint32_t("0"));
+ ASSERT_EQ(0U, e::convert::to_uint32_t("0x0"));
+ ASSERT_EQ(0U, e::convert::to_uint32_t("0x0", 16));
+ ASSERT_EQ(0U, e::convert::to_uint32_t("00"));
+ ASSERT_EQ(0U, e::convert::to_uint32_t("00", 8));
ASSERT_EQ(4294967295UL, e::convert::to_uint32_t("4294967295"));
ASSERT_EQ(4294967295UL, e::convert::to_uint32_t("0xffffffff"));
@@ -86,11 +86,11 @@ TEST(ConvertTest, Uint16NormalCases)
try
{
- ASSERT_EQ(0, e::convert::to_uint16_t("0"));
- ASSERT_EQ(0, e::convert::to_uint16_t("0x0"));
- ASSERT_EQ(0, e::convert::to_uint16_t("0x0", 16));
- ASSERT_EQ(0, e::convert::to_uint16_t("00"));
- ASSERT_EQ(0, e::convert::to_uint16_t("00", 8));
+ ASSERT_EQ(0U, e::convert::to_uint16_t("0"));
+ ASSERT_EQ(0U, e::convert::to_uint16_t("0x0"));
+ ASSERT_EQ(0U, e::convert::to_uint16_t("0x0", 16));
+ ASSERT_EQ(0U, e::convert::to_uint16_t("00"));
+ ASSERT_EQ(0U, e::convert::to_uint16_t("00", 8));
ASSERT_EQ(65535, e::convert::to_uint16_t("65535"));
ASSERT_EQ(65535, e::convert::to_uint16_t("0xffff"));
@@ -110,11 +110,11 @@ TEST(ConvertTest, Uint8NormalCases)
try
{
- ASSERT_EQ(0, e::convert::to_uint8_t("0"));
- ASSERT_EQ(0, e::convert::to_uint8_t("0x0"));
- ASSERT_EQ(0, e::convert::to_uint8_t("0x0", 16));
- ASSERT_EQ(0, e::convert::to_uint8_t("00"));
- ASSERT_EQ(0, e::convert::to_uint8_t("00", 8));
+ ASSERT_EQ(0U, e::convert::to_uint8_t("0"));
+ ASSERT_EQ(0U, e::convert::to_uint8_t("0x0"));
+ ASSERT_EQ(0U, e::convert::to_uint8_t("0x0", 16));
+ ASSERT_EQ(0U, e::convert::to_uint8_t("00"));
+ ASSERT_EQ(0U, e::convert::to_uint8_t("00", 8));
ASSERT_EQ(255, e::convert::to_uint8_t("255"));
ASSERT_EQ(255, e::convert::to_uint8_t("0xff"));
View
2 test/endian.cc
@@ -25,6 +25,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+
// C
#include <cstring>
View
8 test/guard.cc
@@ -64,6 +64,7 @@ TEST(GuardTest, Function0)
{
e::guard g = e::makeguard(&func0);
+ g.use_variable();
ASSERT_EQ(-1, check);
}
@@ -76,6 +77,7 @@ TEST(GuardTest, Function1)
{
e::guard g = e::makeguard(func1, 1);
+ g.use_variable();
ASSERT_EQ(-1, check);
}
@@ -88,6 +90,7 @@ TEST(GuardTest, Function2)
{
e::guard g = e::makeguard(func2, 1, 2);
+ g.use_variable();
ASSERT_EQ(-1, check);
}
@@ -100,6 +103,7 @@ TEST(GuardTest, Function3)
{
e::guard g = e::makeguard(func3, 1, 2, 3);
+ g.use_variable();
ASSERT_EQ(-1, check);
}
@@ -180,6 +184,7 @@ TEST(GuardTest, Object0)
{
e::guard g = e::makeobjguard(obj, &object::func0);
+ g.use_variable();
ASSERT_EQ(-1, obj.count());
}
@@ -192,6 +197,7 @@ TEST(GuardTest, Object1)
{
e::guard g = e::makeobjguard(obj, &object::func1, 1);
+ g.use_variable();
ASSERT_EQ(-1, obj.count());
}
@@ -204,6 +210,7 @@ TEST(GuardTest, Object2)
{
e::guard g = e::makeobjguard(obj, &object::func2, 1, 2);
+ g.use_variable();
ASSERT_EQ(-1, obj.count());
}
@@ -216,6 +223,7 @@ TEST(GuardTest, Object3)
{
e::guard g = e::makeobjguard(obj, &object::func3, 1, 2, 3);
+ g.use_variable();
ASSERT_EQ(-1, obj.count());
}
View
10 test/intrusive_ptr.cc
@@ -25,6 +25,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+
// e
#include "th.h"
#include "e/intrusive_ptr.h"
@@ -193,13 +195,13 @@ TEST(IntrusivePtr, Assignment)
e::intrusive_ptr<assignment> p(new assignment());
e::intrusive_ptr<assignment> q;
e::intrusive_ptr<assignment> r;
- ASSERT_EQ(1, p->m_ref);
+ ASSERT_EQ(1U, p->m_ref);
q = p;
- ASSERT_EQ(2, p->m_ref);
+ ASSERT_EQ(2U, p->m_ref);
r = p;
- ASSERT_EQ(3, p->m_ref);
+ ASSERT_EQ(3U, p->m_ref);
r = q;
- ASSERT_EQ(3, p->m_ref);
+ ASSERT_EQ(3U, p->m_ref);
}
TEST(IntrusivePtr, Booleans)
View
8 test/locking_iterable_fifo.cc
@@ -130,7 +130,7 @@ TEST(LockingIterableFifoTest, IterateFlushIterate)
}
// Iterate the rest of the way.
- for (size_t i = 11; i <= 20; ++i)
+ for (int i = 11; i <= 20; ++i)
{
ASSERT_TRUE(it.valid());
ASSERT_EQ(i, *it);
@@ -181,18 +181,18 @@ TEST(LockingIterableFifoTest, BatchAppend)
// Add batches of various sizes, iterating to verify presence.
e::locking_iterable_fifo<int>::iterator it = l.iterate();
- for (size_t i = 0; i < 1000; ++i)
+ for (int i = 0; i < 1000; ++i)
{
std::vector<int> values(i);
- for (size_t j = 0; j < i; ++j)
+ for (int j = 0; j < i; ++j)
{
values[j] = j;
}
l.batch_append(values);
- for (size_t j = 0; j < i; ++j)
+ for (int j = 0; j < i; ++j)
{
ASSERT_TRUE(it.valid());
ASSERT_EQ(j, *it);
View
2 test/runner.cc
@@ -31,5 +31,7 @@
int
main(int argc, char* argv[])
{
+ argc = argc;
+ argv = argv;
return th::run_tests();
}

0 comments on commit 6445f6c

Please sign in to comment.
Something went wrong with that request. Please try again.