stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Brown <mbr...@inbox.com>
Subject [PATCH] clean up unused variable warnings in new list tests
Date Wed, 28 Mar 2007 05:00:00 GMT
I just noticed the new list tests that went in today -- they look like a lot of work! -- and
started going through them to see how they could be enhanced to test the new container member
functions. All the tests compile just fine but a couple of them spit out lots of warnings
for the same unused variable. I would like to clean them up before I make any changes. For
instance, here is one I get for the list assign test:

gcc -c -I/home/mbrown/stdcxx/include/ansi -D_RWSTDDEBUG    -I/home/mbrown/stdcxx/include -I/home/mbrown/stdcxx-gcc-4.1.1-11s/include
-I/home/mbrown/stdcxx/../rwtest/include -I/home/mbrown/stdcxx/tests/include  -pedantic -nostdinc++
-g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align   /home/mbrown/stdcxx/tests/containers/23.list.assign.cpp
/home/mbrown/stdcxx/tests/containers/23.list.assign.cpp: In member function ‘List& AssignRangeOverload<List,
Iterator>::operator()(List&, const ContainerTestCaseData<typename Cont::value_type>&)
const [with List = std::list<UserClass, UserAlloc<UserClass, AllocTypes<UserClass>
> >, Iterator = std::reverse_iterator<__rw::__rw_debug_iter<std::list<UserClass,
UserAlloc<UserClass, AllocTypes<UserClass> > >, std::__rw_list_iter<UserClass,
long int, const UserClass*, const UserClass&>, std::__rw_list_iter<UserClass, long
int, UserClass*, UserClass&> > >]’:
/home/mbrown/stdcxx/tests/containers/23.list.assign.cpp:556:   instantiated from here
/home/mbrown/stdcxx/tests/containers/23.list.assign.cpp:249: warning: unused variable ‘tcase’

And here is the patch that makes the warnings go away:

Index: /home/mbrown/stdcxx/tests/containers/23.list.insert.cpp
===================================================================
--- /home/mbrown/stdcxx/tests/containers/23.list.insert.cpp     (revision 523168)
+++ /home/mbrown/stdcxx/tests/containers/23.list.insert.cpp     (working copy)
@@ -383,8 +383,6 @@
     operator() (List &lst, 
                 const ContainerTestCaseData<ListVal>& tdata) const {
 
-        const ContainerTestCase &tcase = tdata.tcase_;
-
         // create a pair of iterators into the list object being modified
         ListIter first1 (lst.begin ());
         _rw_advance (first1, tdata.off1_);
@@ -415,8 +413,6 @@
     operator() (List &lst, 
                 const ContainerTestCaseData<ListVal>& tdata) const {
 
-        const ContainerTestCase &tcase = tdata.tcase_;
-
         // create a pair of iterators into the list object being modified
         ListIter first1 (lst.begin ());
         _rw_advance (first1, tdata.off1_);
@@ -460,8 +456,6 @@
     operator() (List& lst,
                 const ContainerTestCaseData<ListVal>& tdata) const {
 
-        const ContainerTestCase &tcase = tdata.tcase_;
-
         ListIter first1 (lst.begin ());
         _rw_advance (first1, tdata.off1_);
 
Index: /home/mbrown/stdcxx/tests/containers/23.list.assign.cpp
===================================================================
--- /home/mbrown/stdcxx/tests/containers/23.list.assign.cpp     (revision 523168)
+++ /home/mbrown/stdcxx/tests/containers/23.list.assign.cpp     (working copy)
@@ -246,8 +246,6 @@
     operator() (List &lst, 
                 const ContainerTestCaseData<ListVal>& tdata) const {
 
-        const ContainerTestCase &tcase = tdata.tcase_;
-
         bool reverse_iter = ListIds::ReverseIterator == tdata.func_.iter_id_
             || ListIds::ConstReverseIterator == tdata.func_.iter_id_;

And the ChangeLog entry to go with it:

2007-03-27  Mark Brown  <mbrown@inbox.com>

	* 23.list.insert.cpp (InsertRange, InsertRangeOverload,
	InsertRangePtrOverload): Removed unused variable: tcase.
	* 23.list.assign (AssignRangeOverload): Same.

-- Mark

Mime
View raw message