Skip to content
Snippets Groups Projects
Commit e1722b7e authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'improved_dying' into 'master'

Improved dying

See merge request !89
parents fef50ae8 a8dadf8b
No related branches found
No related tags found
1 merge request!89Improved dying
Pipeline #57678 passed
......@@ -10,7 +10,7 @@ void die(const char* message, bool usePerror) {
if (usePerror) {
std::perror(message);
} else {
std::cout << message << std::endl;
std::cerr << message << std::endl;
}
exit(EXIT_FAILURE);
}
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020 Florian Schmaus
// Copyright © 2020-2021 Florian Schmaus, Florian Fischer
#pragma once
#include <functional>
......@@ -9,8 +9,16 @@ using func_t = std::function<void()>;
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define DIE die(__FILE__ ":" TOSTRING(__LINE__), false)
#define DIE_MSG(x) die(__FILE__ ":" TOSTRING(__LINE__) " " #x, false)
#define DIE_MSG_ERRNO(x) die(__FILE__ ":" TOSTRING(__LINE__) " " #x, true)
// See Debug.hpp why we disable clang-format for the multi statement macro definitions
// clang-format off
// NOLINTNEXTLINE(bugprone-macro-parentheses)
#define DIE_MSG(x) do { std::stringstream sst; sst << __FILE__ ":" TOSTRING(__LINE__) " " << x; die(sst.str().c_str(), false); } while (false)
// NOLINTNEXTLINE(bugprone-macro-parentheses)
#define DIE_MSG_ERRNO(x) do { std::stringstream sst; sst << __FILE__ ":" TOSTRING(__LINE__) " " << x; die(sst.str().c_str(), true); } while (false)
// clang-format on
// We compile with -fno-exceptions for the moment.
//#define THROW(x) do { throw std::runtime_error(x); } while (false)
......
......@@ -48,7 +48,7 @@ void LawsDispatcher::dispatchLoop() {
lawsStrategy.dispatchedFiberFromAnywhere.fetch_add(1, std::memory_order_relaxed);
break;
default:
DIE_MSG("Unknown fiber flag: " << flag);
DIE_MSG("Unknown fiber source: " << next.metadata);
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment