catch_uncaught_exceptions.cpp 713 B

12345678910111213141516171819202122232425
  1. /*
  2. * Created by Josh on 1/2/2018.
  3. * Copyright 2018 Two Blue Cubes Ltd. All rights reserved.
  4. *
  5. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #include "catch_compiler_capabilities.h"
  9. #include "catch_uncaught_exceptions.h"
  10. #include "catch_config_uncaught_exceptions.hpp"
  11. #include <exception>
  12. namespace Catch {
  13. bool uncaught_exceptions() {
  14. #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
  15. return false;
  16. #elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
  17. return std::uncaught_exceptions() > 0;
  18. #else
  19. return std::uncaught_exception();
  20. #endif
  21. }
  22. } // end namespace Catch