mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
drd/tests/annotate_smart_pointer: Avoid non-POD variable length arrays
Non-POD variable length arrays are supported by g++ but not by clang. Hence convert the variable length array in this test program into a vector. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13606
This commit is contained in:
parent
9de72049d5
commit
625c6aa3df
@ -29,6 +29,7 @@
|
||||
#include <climits> // PTHREAD_STACK_MIN
|
||||
#include <iostream> // std::cerr
|
||||
#include <stdlib.h> // atoi()
|
||||
#include <vector>
|
||||
#ifdef _WIN32
|
||||
#include <process.h> // _beginthreadex()
|
||||
#include <windows.h> // CRITICAL_SECTION
|
||||
@ -311,12 +312,11 @@ int main(int argc, char** argv)
|
||||
|
||||
for (int j = 0; j < iterations; ++j)
|
||||
{
|
||||
Thread T[nthreads];
|
||||
|
||||
std::vector<Thread> T(nthreads);
|
||||
smart_ptr<counter> p(new counter);
|
||||
p->post_increment();
|
||||
for (int i = 0; i < nthreads; ++i)
|
||||
T[i].Create(thread_func, new smart_ptr<counter>(p));
|
||||
for (std::vector<Thread>::iterator q = T.begin(); q != T.end(); q++)
|
||||
q->Create(thread_func, new smart_ptr<counter>(p));
|
||||
{
|
||||
// Avoid that counter.m_mutex introduces a false ordering on the
|
||||
// counter.m_count accesses.
|
||||
@ -324,8 +324,8 @@ int main(int argc, char** argv)
|
||||
nanosleep(&delay, 0);
|
||||
}
|
||||
p = NULL;
|
||||
for (int i = 0; i < nthreads; ++i)
|
||||
T[i].Join();
|
||||
for (std::vector<Thread>::iterator q = T.begin(); q != T.end(); q++)
|
||||
q->Join();
|
||||
}
|
||||
std::cerr << "Done.\n";
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user