current_function_test.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <boost/config.hpp>
  2. #if defined(BOOST_MSVC)
  3. #pragma warning(disable: 4786) // identifier truncated in debug info
  4. #pragma warning(disable: 4710) // function not inlined
  5. #pragma warning(disable: 4711) // function selected for automatic inline expansion
  6. #pragma warning(disable: 4514) // unreferenced inline removed
  7. #endif
  8. //
  9. // current_function_test.cpp - a test for boost/current_function.hpp
  10. //
  11. // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
  12. //
  13. // Distributed under the Boost Software License, Version 1.0. (See
  14. // accompanying file LICENSE_1_0.txt or copy at
  15. // http://www.boost.org/LICENSE_1_0.txt)
  16. //
  17. #include <boost/current_function.hpp>
  18. #include <boost/config.hpp>
  19. #include <cstdio>
  20. void message(char const * file, long line, char const * func, char const * msg)
  21. {
  22. #if !defined(BOOST_NO_STDC_NAMESPACE)
  23. using std::printf;
  24. #endif
  25. printf("%s(%ld): %s in function '%s'\n", file, line, msg, func);
  26. }
  27. #define MESSAGE(msg) message(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, msg)
  28. int main()
  29. {
  30. MESSAGE("assertion failed");
  31. return 0;
  32. }