Skip to content

Commit 3d35d99

Browse files
committed
Renamed global variables to avoid name clashes with local variables.
This should silence MSVC warnings about local variables in various places shadowing global variables in the tests.
1 parent 4d19ed9 commit 3d35d99

138 files changed

Lines changed: 1252 additions & 1324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/sync/conditions/condition_variable/dtor_pass.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,42 @@
2323
#include <boost/thread/locks.hpp>
2424
#include <boost/core/lightweight_test.hpp>
2525

26-
boost::condition_variable* cv;
27-
boost::mutex m;
26+
boost::condition_variable* g_cv;
27+
boost::mutex g_mutex;
2828
typedef boost::unique_lock<boost::mutex> Lock;
2929

3030
bool f_ready = false;
3131
bool g_ready = false;
3232

3333
void f()
3434
{
35-
Lock lk(m);
35+
Lock lk(g_mutex);
3636
f_ready = true;
37-
cv->notify_one();
38-
cv->wait(lk);
39-
delete cv;
37+
g_cv->notify_one();
38+
g_cv->wait(lk);
39+
delete g_cv;
4040
}
4141

4242
void g()
4343
{
44-
Lock lk(m);
44+
Lock lk(g_mutex);
4545
g_ready = true;
46-
cv->notify_one();
46+
g_cv->notify_one();
4747
while (!f_ready)
4848
{
49-
cv->wait(lk);
49+
g_cv->wait(lk);
5050
}
51-
cv->notify_one();
51+
g_cv->notify_one();
5252
}
5353

5454
int main()
5555
{
56-
cv = new boost::condition_variable;
56+
g_cv = new boost::condition_variable;
5757
boost::thread th2(g);
58-
Lock lk(m);
58+
Lock lk(g_mutex);
5959
while (!g_ready)
6060
{
61-
cv->wait(lk);
61+
g_cv->wait(lk);
6262
}
6363
lk.unlock();
6464
boost::thread th1(f);

test/sync/conditions/condition_variable_any/dtor_pass.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,42 @@
2323
#include <boost/thread/locks.hpp>
2424
#include <boost/core/lightweight_test.hpp>
2525

26-
boost::condition_variable_any* cv;
27-
boost::timed_mutex m;
26+
boost::condition_variable_any* g_cv;
27+
boost::timed_mutex g_mutex;
2828
typedef boost::unique_lock<boost::timed_mutex> Lock;
2929

3030
bool f_ready = false;
3131
bool g_ready = false;
3232

3333
void f()
3434
{
35-
Lock lk(m);
35+
Lock lk(g_mutex);
3636
f_ready = true;
37-
cv->notify_one();
38-
cv->wait(lk);
39-
delete cv;
37+
g_cv->notify_one();
38+
g_cv->wait(lk);
39+
delete g_cv;
4040
}
4141

4242
void g()
4343
{
44-
Lock lk(m);
44+
Lock lk(g_mutex);
4545
g_ready = true;
46-
cv->notify_one();
46+
g_cv->notify_one();
4747
while (!f_ready)
4848
{
49-
cv->wait(lk);
49+
g_cv->wait(lk);
5050
}
51-
cv->notify_one();
51+
g_cv->notify_one();
5252
}
5353

5454
int main()
5555
{
56-
cv = new boost::condition_variable_any;
56+
g_cv = new boost::condition_variable_any;
5757
boost::thread th2(g);
58-
Lock lk(m);
58+
Lock lk(g_mutex);
5959
while (!g_ready)
6060
{
61-
cv->wait(lk);
61+
g_cv->wait(lk);
6262
}
6363
lk.unlock();
6464
boost::thread th1(f);

test/sync/futures/async/async_executor_pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ int f0()
106106
return 3;
107107
}
108108

109-
int i = 0;
109+
int g_i = 0;
110110

111111
int& f1()
112112
{
113113
boost::this_thread::sleep_for(ms(200));
114-
return i;
114+
return g_i;
115115
}
116116

117117
void f2()

test/sync/futures/async/async_pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ int f0()
109109
return 3;
110110
}
111111

112-
int i = 0;
112+
int g_i = 0;
113113

114114
int& f1()
115115
{
116116
boost::this_thread::sleep_for(ms(200));
117-
return i;
117+
return g_i;
118118
}
119119

120120
void f2()
@@ -153,8 +153,8 @@ struct check_timer {
153153
boost::chrono::nanoseconds delay;
154154
Clock::time_point start;
155155
check_timer(boost::chrono::nanoseconds delay)
156-
: delay(delay)
157-
, start(Clock::now())
156+
: delay(delay)
157+
, start(Clock::now())
158158
{
159159
}
160160
~check_timer() {
@@ -490,7 +490,7 @@ int main()
490490
check_timer timer(ms(500));
491491
res = &f.get();
492492
}
493-
BOOST_TEST(res == &i);
493+
BOOST_TEST(res == &g_i);
494494
}
495495
catch (std::exception& ex)
496496
{
@@ -513,7 +513,7 @@ int main()
513513
check_timer timer(ms(500));
514514
res = &f.get();
515515
}
516-
BOOST_TEST(res == &i);
516+
BOOST_TEST(res == &g_i);
517517
}
518518
catch (std::exception& ex)
519519
{
@@ -536,7 +536,7 @@ int main()
536536
check_timer timer(ms(500));
537537
res = &f.get();
538538
}
539-
BOOST_TEST(res == &i);
539+
BOOST_TEST(res == &g_i);
540540
}
541541
catch (std::exception& ex)
542542
{
@@ -560,7 +560,7 @@ int main()
560560
check_timer timer(ms(500));
561561
res = &f.get();
562562
}
563-
BOOST_TEST(res == &i);
563+
BOOST_TEST(res == &g_i);
564564
}
565565
catch (std::exception& ex)
566566
{

test/sync/futures/future/get_or_pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ void func2(boost::promise<int> p)
5151
p.set_exception(::make_exception_ptr(3));
5252
}
5353

54-
int j = 0;
54+
int g_j = 0;
5555

5656
void func3(boost::promise<int&> p)
5757
{
5858
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
59-
j = 5;
60-
p.set_value(j);
59+
g_j = 5;
60+
p.set_value(g_j);
6161
}
6262

6363
void func4(boost::promise<int&> p)

test/sync/futures/future/get_pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ void func2(boost::promise<int> p)
6161
p.set_exception(::make_exception_ptr(3));
6262
}
6363

64-
int j = 0;
64+
int g_j = 0;
6565

6666
void func3(boost::promise<int&> p)
6767
{
6868
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
69-
j = 5;
70-
p.set_value(j);
69+
g_j = 5;
70+
p.set_value(g_j);
7171
}
7272

7373
void func4(boost::promise<int&> p)

test/sync/futures/future/move_assign_pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include <boost/thread/future.hpp>
2424
#include <boost/core/lightweight_test.hpp>
2525

26-
boost::mutex m0;
27-
boost::mutex m1;
28-
2926
int main()
3027
{
3128
{

test/sync/futures/future/move_ctor_pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <boost/thread/future.hpp>
2424
#include <boost/core/lightweight_test.hpp>
2525

26-
boost::mutex m;
27-
2826
int main()
2927
{
3028
{
@@ -75,4 +73,3 @@ int main()
7573

7674
return boost::report_errors();
7775
}
78-

test/sync/futures/future/wait_for_pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ void func1(boost::promise<int> p)
5656
p.set_value(3);
5757
}
5858

59-
int j = 0;
59+
int g_j = 0;
6060

6161
void func3(boost::promise<int&> p)
6262
{
6363
boost::this_thread::sleep_for(ms(500));
64-
j = 5;
65-
p.set_value(j);
64+
g_j = 5;
65+
p.set_value(g_j);
6666
}
6767

6868
void func5(boost::promise<void> p)

test/sync/futures/future/wait_pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ void func1(boost::promise<int> p)
5454
p.set_value(3);
5555
}
5656

57-
int j = 0;
57+
int g_j = 0;
5858

5959
void func3(boost::promise<int&> p)
6060
{
6161
boost::this_thread::sleep_for(ms(500));
62-
j = 5;
63-
p.set_value(j);
62+
g_j = 5;
63+
p.set_value(g_j);
6464
}
6565

6666
void func5(boost::promise<void> p)

0 commit comments

Comments
 (0)