You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/10/24 14:22:17 UTC
svn commit: r587873 -
/incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
Author: faridz
Date: Wed Oct 24 05:22:17 2007
New Revision: 587873
URL: http://svn.apache.org/viewvc?rev=587873&view=rev
Log:
2007-10-24 Travis Vitek <vi...@roguewave.com>
STDCXX-587
* 20.temp.buffer.mt.cpp (test_return_buffer): Set buffer pointer
to 0 after deallocating.
(thr_func): Provide default values for buffers. Deallocate buffers
that remain allocated after thread loop.
Modified:
incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
Modified: incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp?rev=587873&r1=587872&r2=587873&view=diff
==============================================================================
--- incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp (original)
+++ incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp Wed Oct 24 05:22:17 2007
@@ -117,6 +117,7 @@
assert (len == buf.second * sizeof (T));
std::return_temporary_buffer<T>(buf.first);
+ buf.first = 0;
}
/**************************************************************************/
@@ -137,10 +138,10 @@
#endif // _RWSTD_INT64_T
- std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0;
- std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1;
- std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2;
- std::pair<Type64*, std::ptrdiff_t> buf3;
+ std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0 (0, 0);
+ std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1 (0, 0);
+ std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2 (0, 0);
+ std::pair<Type64*, std::ptrdiff_t> buf3 (0, 0);
for (unsigned i = 0; i != rw_opt_nloops; ++i) {
@@ -181,6 +182,12 @@
break;
}
}
+
+ // free any buffers that remain allocated
+ if (buf0.first) test_return_buffer (targs, buf0);
+ if (buf1.first) test_return_buffer (targs, buf1);
+ if (buf2.first) test_return_buffer (targs, buf2);
+ if (buf3.first) test_return_buffer (targs, buf3);
return 0;
}
Re: svn commit: r587873 - /incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [mailto:sebor@roguewave.com]
>> Sent: Wednesday, October 24, 2007 5:45 PM
>> To: stdcxx-dev@incubator.apache.org
>> Subject: Re: svn commit: r587873 -
>> /incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
>>
>> faridz@apache.org wrote:
>>> Author: faridz
>>> Date: Wed Oct 24 05:22:17 2007
>>> New Revision: 587873
>>>
>>> URL: http://svn.apache.org/viewvc?rev=587873&view=rev
>> [...]
>>> @@ -137,10 +138,10 @@
>>>
>>> #endif // _RWSTD_INT64_T
>>>
>>> - std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0;
>>> - std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1;
>>> - std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2;
>>> - std::pair<Type64*, std::ptrdiff_t> buf3;
>>> + std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0 (0, 0);
>>> + std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1 (0, 0);
>>> + std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2 (0, 0);
>>> + std::pair<Type64*, std::ptrdiff_t> buf3 (0, 0);
>> Why is this necessary? Shouldn't the default ctor zero out
>> (i.e., default-initialize) its members?
>> Is this is a workaround for a compiler bug? (If so, which one?)
>
> I think it was "just for sure".
The reason I asked is because having to explicitly initialize
the members by passing arguments to the ctor, even on a single
platform, would mean that std::pair is broken (on that platform)
and the 20.pairs.cpp test should fail. I don't know if there is
a platform where it does but on the two I looked at (gcc 3.2.3
on Linux and MSVC 7.1) it passes.
Martin
>
> Reverted back thus:
> http://svn.apache.org/viewvc?view=rev&revision=587909
>
> Farid.
RE: svn commit: r587873 - /incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com]
> Sent: Wednesday, October 24, 2007 5:45 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: svn commit: r587873 -
> /incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
>
> faridz@apache.org wrote:
> > Author: faridz
> > Date: Wed Oct 24 05:22:17 2007
> > New Revision: 587873
> >
> > URL: http://svn.apache.org/viewvc?rev=587873&view=rev
> [...]
> > @@ -137,10 +138,10 @@
> >
> > #endif // _RWSTD_INT64_T
> >
> > - std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0;
> > - std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1;
> > - std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2;
> > - std::pair<Type64*, std::ptrdiff_t> buf3;
> > + std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0 (0, 0);
> > + std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1 (0, 0);
> > + std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2 (0, 0);
> > + std::pair<Type64*, std::ptrdiff_t> buf3 (0, 0);
>
> Why is this necessary? Shouldn't the default ctor zero out
> (i.e., default-initialize) its members?
> Is this is a workaround for a compiler bug? (If so, which one?)
I think it was "just for sure".
Reverted back thus:
http://svn.apache.org/viewvc?view=rev&revision=587909
Farid.
Re: svn commit: r587873 - /incubator/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
Posted by Martin Sebor <se...@roguewave.com>.
faridz@apache.org wrote:
> Author: faridz
> Date: Wed Oct 24 05:22:17 2007
> New Revision: 587873
>
> URL: http://svn.apache.org/viewvc?rev=587873&view=rev
[...]
> @@ -137,10 +138,10 @@
>
> #endif // _RWSTD_INT64_T
>
> - std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0;
> - std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1;
> - std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2;
> - std::pair<Type64*, std::ptrdiff_t> buf3;
> + std::pair<_RWSTD_INT8_T*, std::ptrdiff_t> buf0 (0, 0);
> + std::pair<_RWSTD_INT16_T*, std::ptrdiff_t> buf1 (0, 0);
> + std::pair<_RWSTD_INT32_T*, std::ptrdiff_t> buf2 (0, 0);
> + std::pair<Type64*, std::ptrdiff_t> buf3 (0, 0);
Why is this necessary? Shouldn't the default ctor zero out
(i.e., default-initialize) its members?
Is this is a workaround for a compiler bug? (If so, which one?)
Martin