Add initial implementation of quick_exit

This commit is contained in:
Peter Dimov
2018-09-05 17:06:42 +03:00
parent 56bd3784bf
commit 5e08874182
4 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
#define BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/quick_exit.hpp
//
// Copyright 2018 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
#include <cstdlib>
namespace boost
{
void quick_exit( int code )
{
std::quick_exit( code );
}
} // namespace boost
#endif // #ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED

View File

@ -127,5 +127,8 @@ run exchange_move_test.cpp ;
run empty_value_test.cpp ;
run empty_value_size_test.cpp ;
run quick_exit_test.cpp ;
run-fail quick_exit_fail.cpp ;
use-project /boost/core/swap : ./swap ;
build-project ./swap ;

17
test/quick_exit_fail.cpp Normal file
View File

@ -0,0 +1,17 @@
// Test for quick_exit.hpp
//
// Copyright 2018 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/core/quick_exit.hpp>
int main()
{
boost::quick_exit( 1 );
return 0;
}

17
test/quick_exit_test.cpp Normal file
View File

@ -0,0 +1,17 @@
// Test for quick_exit.hpp
//
// Copyright 2018 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/core/quick_exit.hpp>
int main()
{
boost::quick_exit( 0 );
return 1;
}