Merge from trunk

[SVN r68054]
This commit is contained in:
Beman Dawes
2011-01-12 14:57:41 +00:00
parent 7ce0af2bba
commit 17d5ed080b
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,36 @@
// boost/detail/lightweight_main.hpp -------------------------------------------------//
// Copyright Beman Dawes 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#include <iostream>
#include <exception>
//--------------------------------------------------------------------------------------//
// //
// exception reporting main() that calls cpp_main() //
// //
//--------------------------------------------------------------------------------------//
int cpp_main(int argc, char* argv[]);
int main(int argc, char* argv[])
{
try
{
return cpp_main(argc, argv);
}
catch (const std::exception& ex)
{
std::cout
<< "\nERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\n"
<< "\n****************************** std::exception *****************************\n"
<< ex.what()
<< "\n***************************************************************************\n"
<< std::endl;
}
return 1;
}

View File

@ -24,6 +24,7 @@
//
#include <boost/current_function.hpp>
#include <boost/assert.hpp>
#include <iostream>
namespace boost
@ -32,9 +33,26 @@ namespace boost
namespace detail
{
struct report_errors_reminder
{
bool called_report_errors_function;
report_errors_reminder() : called_report_errors_function(false) {}
~report_errors_reminder()
{
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
}
};
inline report_errors_reminder& report_errors_remind()
{
static report_errors_reminder r;
return r;
}
inline int & test_errors()
{
static int x = 0;
report_errors_remind();
return x;
}
@ -68,6 +86,8 @@ template<class T, class U> inline void test_eq_impl( char const * expr1, char co
inline int report_errors()
{
detail::report_errors_remind().called_report_errors_function = true;
int errors = detail::test_errors();
if( errors == 0 )