X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4d02714ee138a3bd9b02e0064b7a2aa26407e9e8..72884f9c682441d0a9de0f2df63b47cde7822058:/src/simgrid/Exception.cpp diff --git a/src/simgrid/Exception.cpp b/src/simgrid/Exception.cpp index cd4fc1fa22..d250e733c0 100644 --- a/src/simgrid/Exception.cpp +++ b/src/simgrid/Exception.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2018-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -9,21 +9,34 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); namespace simgrid { -ForcefulKillException::~ForcefulKillException() = default; +// DO NOT define destructors for exceptions in Exception.hpp. +// Defining it here ensures that the exceptions are defined only in libsimgrid, but not in libsimgrid-java. +// Doing otherwise naturally breaks things (at least on freebsd with clang). + +Exception::~Exception() = default; +TimeoutException::~TimeoutException() = default; +HostFailureException::~HostFailureException() = default; +NetworkFailureException::~NetworkFailureException() = default; +StorageFailureException::~StorageFailureException() = default; +VmFailureException::~VmFailureException() = default; +CancelException::~CancelException() = default; +TracingError::~TracingError() = default; +ParseError::~ParseError() = default; +ForcefulKillException::~ForcefulKillException() = default; void ForcefulKillException::do_throw() { throw ForcefulKillException(); } -bool ForcefulKillException::try_n_catch(std::function try_block) +bool ForcefulKillException::try_n_catch(const std::function& try_block) { bool res; try { try_block(); res = true; - } catch (ForcefulKillException const&) { - XBT_DEBUG("Caught a ForcefulKillException"); + } catch (ForcefulKillException const& e) { + XBT_DEBUG("Caught a ForcefulKillException: %s", e.what()); res = false; } return res;