You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Mark Brown <mb...@inbox.com> on 2007/03/28 07:00:00 UTC
[PATCH] clean up unused variable warnings in new list tests
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 <mb...@inbox.com>
* 23.list.insert.cpp (InsertRange, InsertRangeOverload,
InsertRangePtrOverload): Removed unused variable: tcase.
* 23.list.assign (AssignRangeOverload): Same.
-- Mark
Re: [PATCH] clean up unused variable warnings in new list tests
Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [mailto:msebor@gmail.com]
>> Sent: Wednesday, March 28, 2007 6:22 PM
>> To: stdcxx-dev@incubator.apache.org
>> Subject: Re: [PATCH] clean up unused variable warnings in new
>> list tests
>>
>> This looks good to me Mark but let's wait for Farid to review it.
>> If he's happy with go ahead and commit it.
>
> I see no problem with the patch.
Good. Please go ahead and commit it then.
Martin
RE: [PATCH] clean up unused variable warnings in new list tests
Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:msebor@gmail.com]
> Sent: Wednesday, March 28, 2007 6:22 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: [PATCH] clean up unused variable warnings in new
> list tests
>
> This looks good to me Mark but let's wait for Farid to review it.
> If he's happy with go ahead and commit it.
I see no problem with the patch.
Farid.
Re: [PATCH] clean up unused variable warnings in new list tests
Posted by Martin Sebor <ms...@gmail.com>.
This looks good to me Mark but let's wait for Farid to review it.
If he's happy with go ahead and commit it.
Martin
On Tue, 2007-03-27 at 21:00 -0800, Mark Brown wrote:
> 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 <mb...@inbox.com>
>
> * 23.list.insert.cpp (InsertRange, InsertRangeOverload,
> InsertRangePtrOverload): Removed unused variable: tcase.
> * 23.list.assign (AssignRangeOverload): Same.
>
> -- Mark