From ac163a34b9d70346df80fcac44054e8dffe9ad43 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 24 Jun 2024 01:05:44 -0400 Subject: [PATCH] abort --- CMakeLists.txt | 2 +- include/blt/std/assert.h | 4 ++++ libraries/parallel-hashmap | 2 +- src/blt/std/assert.cpp | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b1ef6e..4adaffd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.17.17) +set(BLT_VERSION 0.17.18) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/std/assert.h b/include/blt/std/assert.h index 4cd648f..a55285e 100644 --- a/include/blt/std/assert.h +++ b/include/blt/std/assert.h @@ -16,6 +16,8 @@ namespace blt void b_assert_failed(const char* expression, const char* msg, const char* path, int line); void b_throw(const char* what, const char* path, int line); + + void b_abort(const char* what, const char* path, int line); } /** @@ -54,4 +56,6 @@ namespace blt #define BLT_THROW(throwable) do {blt::b_throw(throwable.what(), __FILE__, __LINE__); throw throwable;} while(0) +#define BLT_ABORT(message) do {blt::b_abort(message, __FILE__, __LINE__); } while (0) + #endif //BLT_ASSERT_H diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 1036816..d88c5e1 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 10368163ab1f4367d2f0685b5928b1c973ebd1ec +Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b diff --git a/src/blt/std/assert.cpp b/src/blt/std/assert.cpp index 046aad8..102015d 100644 --- a/src/blt/std/assert.cpp +++ b/src/blt/std/assert.cpp @@ -124,5 +124,21 @@ namespace blt { } + void b_abort(const char* what, const char* path, int line) + { +#if defined(__GNUC__) && !defined(__EMSCRIPTEN__) + BLT_STACK_TRACE(50); +#endif + BLT_FATAL("----{ABORT}----"); + BLT_FATAL("\tWhat: ", what); + BLT_FATAL("\tcalled from %s:%d", path, line); +#if defined(__GNUC__) && !defined(__EMSCRIPTEN__) + printStacktrace(messages, size, path, line); + + BLT_FREE_STACK_TRACE(); +#endif + std::exit(EXIT_FAILURE); + } + } \ No newline at end of file