Fix clang 6.0 warnings in tests: unused members, suspicious return types

This commit is contained in:
Ion Gaztañaga
2018-09-18 14:26:31 +02:00
parent d94fbc76cc
commit 99326f50fb
9 changed files with 20 additions and 4 deletions

View File

@@ -98,7 +98,7 @@ int main()
//Test the objects inserted in our lists //Test the objects inserted in our lists
for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){ for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){
if(&*bit1 != &*it1 || &*bit2 != &*it2) return false; if(&*bit1 != &*it1 || &*bit2 != &*it2) return 1;
} }
return 0; return 0;
} }

View File

@@ -26,6 +26,9 @@ class MyClass : public any_base_hook<> //Base hook
MyClass(int i = 0) : int_(i) MyClass(int i = 0) : int_(i)
{} {}
//<-
int get_int() const { return int_; }
//->
}; };
int main() int main()

View File

@@ -87,7 +87,7 @@ int main()
//Test the objects inserted in our lists //Test the objects inserted in our lists
for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){ for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){
if(&*bit1 != &*it1 || &*bit2 != &*it2) return false; if(&*bit1 != &*it1 || &*bit2 != &*it2) return 1;
} }
return 0; return 0;
} }

View File

@@ -23,6 +23,9 @@ class MyClass : public list_base_hook<>
list_member_hook<> member_hook_; list_member_hook<> member_hook_;
MyClass(int i) : int_(i) {} MyClass(int i) : int_(i) {}
//<-
int get_int() const { return int_; }
//->
}; };
//Define a list that will store MyClass using the base hook //Define a list that will store MyClass using the base hook

View File

@@ -26,6 +26,9 @@ class MyClass : public list_base_hook<> //This is a derivation hook
MyClass(int i) MyClass(int i)
: int_(i) : int_(i)
{} {}
//<-
int get_int() const { return int_; }
//->
}; };
//Define a list that will store MyClass using the public base hook //Define a list that will store MyClass using the public base hook

View File

@@ -88,7 +88,7 @@ int main()
//Test the objects inserted in our lists //Test the objects inserted in our lists
for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){ for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){
if(&*bit1 != &*it1 || &*bit2 != &*it2) return false; if(&*bit1 != &*it1 || &*bit2 != &*it2) return 1;
} }
return 0; return 0;
} }

View File

@@ -100,7 +100,7 @@ int main()
int checker = 0; int checker = 0;
for( intrusive_list_t::const_iterator it = plist->begin(), itend(plist->end()) for( intrusive_list_t::const_iterator it = plist->begin(), itend(plist->end())
; it != itend; ++it, ++checker){ ; it != itend; ++it, ++checker){
if(it->get() != checker) return false; if(it->get() != checker) return 1;
} }
//Now delete the list and after that, the nodes //Now delete the list and after that, the nodes

View File

@@ -27,6 +27,9 @@ class MyClass : public slist_base_hook<>
MyClass(int i) MyClass(int i)
: int_(i) : int_(i)
{} {}
//<-
int get_int() const { return int_; }
//->
}; };
//Define an slist that will store MyClass using the public base hook //Define an slist that will store MyClass using the public base hook

View File

@@ -44,11 +44,15 @@ class MyClass
, public virtual VirtualBase3 , public virtual VirtualBase3
{ {
int int_; int int_;
public: public:
list_member_hook<> list_hook_; list_member_hook<> list_hook_;
MyClass(int i = 0) MyClass(int i = 0)
: int_(i) : int_(i)
{} {}
//<-
int get_int() const { return int_; }
//->
}; };
//Define a list that will store MyClass using the public base hook //Define a list that will store MyClass using the public base hook