Skip to content

Commit a39d6c1

Browse files
committed
Merge branch 'master' of https://github.com/daniele77/cli
2 parents a0ed100 + 429ecc8 commit a39d6c1

File tree

7 files changed

+14
-16
lines changed

7 files changed

+14
-16
lines changed

include/cli/cli.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ namespace cli
362362
Menu* current;
363363
std::unique_ptr<Menu> globalScopeMenu;
364364
std::ostream& out;
365-
std::function< void(std::ostream&)> enterAction = []( std::ostream& ){};
366-
std::function< void(std::ostream&)> exitAction = []( std::ostream& ){};
365+
std::function< void(std::ostream&)> enterAction = []( std::ostream& ) noexcept {};
366+
std::function< void(std::ostream&)> exitAction = []( std::ostream& ) noexcept {};
367367
detail::History history;
368368
bool exit{ false }; // to prevent the prompt after exit command
369369
};

include/cli/clifilesession.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CliFileSession : public CliSession
5050
if (!_in.good()) throw std::invalid_argument("istream invalid");
5151
if (!_out.good()) throw std::invalid_argument("ostream invalid");
5252
ExitAction(
53-
[this](std::ostream&)
53+
[this](std::ostream&) noexcept
5454
{
5555
exit = true;
5656
}

include/cli/detail/server.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,12 @@ class Server
125125
Server& operator = ( const Server& ) = delete;
126126

127127
Server(typename ASIOLIB::ContextType& ios, unsigned short port) :
128-
acceptor(ios, asiolib::ip::tcp::endpoint(asiolib::ip::tcp::v4(), port)),
129-
socket(ios)
128+
acceptor(ios, asiolib::ip::tcp::endpoint(asiolib::ip::tcp::v4(), port))
130129
{
131130
Accept();
132131
}
133132
Server(typename ASIOLIB::ContextType& ios, std::string address, unsigned short port) :
134-
acceptor(ios, asiolib::ip::tcp::endpoint(ASIOLIB::IpAddressFromString(address), port)),
135-
socket(ios)
133+
acceptor(ios, asiolib::ip::tcp::endpoint(ASIOLIB::IpAddressFromString(address), port))
136134
{
137135
Accept();
138136
}
@@ -142,16 +140,16 @@ class Server
142140
private:
143141
void Accept()
144142
{
145-
acceptor.async_accept(socket, [this](asiolibec::error_code ec)
143+
acceptor.async_accept([this](asiolibec::error_code ec, asiolib::ip::tcp::socket socket)
146144
{
147145
if (!ec) CreateSession(std::move(socket))->Start();
148146
Accept();
149147
});
150148
}
151149
asiolib::ip::tcp::acceptor acceptor;
152-
asiolib::ip::tcp::socket socket;
153150
};
154151

152+
155153
} // namespace detail
156154
} // namespace cli
157155

test/scheduler_test_templates.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void SchedulingTest()
3838
{
3939
S scheduler;
4040
bool done = false;
41-
scheduler.Post( [&done](){ done = true; } );
41+
scheduler.Post( [&done]() noexcept { done = true; } );
4242
scheduler.ExecOne();
4343
BOOST_CHECK(done);
4444
}
@@ -56,7 +56,7 @@ void SameThreadTest()
5656
{
5757
postThreadId = this_thread::get_id();
5858
scheduler.Post(
59-
[&runThreadId]()
59+
[&runThreadId]() noexcept
6060
{
6161
runThreadId = this_thread::get_id();
6262
}

test/test_boostasioscheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(BoostAsioNonOwner)
5555
detail::BoostAsioLib::ContextType ioc;
5656
BoostAsioScheduler scheduler(ioc);
5757
bool done = false;
58-
scheduler.Post( [&done](){ done = true; } );
58+
scheduler.Post( [&done]() noexcept { done = true; } );
5959
ioc.run_one();
6060
BOOST_CHECK(done);
6161
}

test/test_cli.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(EnterActions)
385385
bool enterActionDone = false;
386386

387387
cli.EnterAction(
388-
[&enterActionDone](std::ostream &) { enterActionDone = true; });
388+
[&enterActionDone](std::ostream &) noexcept { enterActionDone = true; });
389389

390390
stringstream oss;
391391

@@ -401,7 +401,7 @@ BOOST_AUTO_TEST_CASE(ExitActions)
401401

402402
Cli cli(move(rootMenu));
403403
bool exitActionDone = false;
404-
cli.ExitAction([&](std::ostream&){ exitActionDone=true; });
404+
cli.ExitAction([&](std::ostream&) noexcept { exitActionDone=true; });
405405

406406
stringstream oss;
407407

@@ -425,7 +425,7 @@ BOOST_AUTO_TEST_CASE(Exceptions)
425425

426426
// std exception type, custom handler
427427
bool excActionDone = false;
428-
cli.StdExceptionHandler( [&](std::ostream&, const std::string&, const std::exception&){ excActionDone = true; } );
428+
cli.StdExceptionHandler( [&](std::ostream&, const std::string&, const std::exception&) noexcept { excActionDone = true; } );
429429
BOOST_CHECK_NO_THROW( UserInput(cli, oss, "stdexception") );
430430
BOOST_CHECK(excActionDone);
431431

test/test_standaloneasioscheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(StandaloneAsioNonOwner)
5555
detail::StandaloneAsioLib::ContextType ioc;
5656
StandaloneAsioScheduler scheduler(ioc);
5757
bool done = false;
58-
scheduler.Post( [&done](){ done = true; } );
58+
scheduler.Post( [&done]() noexcept { done = true; } );
5959
ioc.run_one();
6060
BOOST_CHECK(done);
6161
}

0 commit comments

Comments
 (0)