Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Mention new configuration keys.
[simgrid.git] / src / simgrid / Exception.cpp
index cd4fc1f..134eefd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2018-2020. 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,6 +9,11 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
 
 namespace simgrid {
 
+// 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;
 ForcefulKillException::~ForcefulKillException() = default;
 
 void ForcefulKillException::do_throw()
@@ -16,7 +21,7 @@ void ForcefulKillException::do_throw()
   throw ForcefulKillException();
 }
 
-bool ForcefulKillException::try_n_catch(std::function<void(void)> try_block)
+bool ForcefulKillException::try_n_catch(const std::function<void()>& try_block)
 {
   bool res;
   try {