From 86e9acc7a7b714307e08ab25117ca03cecb00936 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Thu, 9 Oct 2014 13:44:26 +0000 Subject: throw away the long obsolete runtime type information in the C runtime --- src/runtime/c/gu/exn.h | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src/runtime/c/gu/exn.h') diff --git a/src/runtime/c/gu/exn.h b/src/runtime/c/gu/exn.h index faf413a96..14f77dbcf 100644 --- a/src/runtime/c/gu/exn.h +++ b/src/runtime/c/gu/exn.h @@ -2,7 +2,6 @@ #define GU_EXN_H_ #include -#include /** @file * @@ -47,9 +46,7 @@ struct GuExnData struct GuExn { /// @privatesection GuExnState state; - GuExn* parent; - GuKind* catch; - GuType* caught; + const char* caught; GuExnData data; }; @@ -59,10 +56,8 @@ struct GuExn { /// Allocate a new local exception frame. -#define gu_exn(parent_, catch_, pool_) &(GuExn){ \ +#define gu_exn(pool_) &(GuExn){ \ .state = GU_EXN_OK, \ - .parent = parent_, \ - .catch = gu_kind(catch_), \ .caught = NULL, \ .data = {.pool = pool_, .data = NULL} \ } @@ -70,8 +65,7 @@ struct GuExn { /// Allocate a new exception frame. GuExn* -gu_new_exn(GuExn* parent, GuKind* catch_kind, GuPool* pool); - +gu_new_exn(GuPool* pool); bool @@ -83,10 +77,11 @@ gu_exn_clear(GuExn* err) { err->state = GU_EXN_OK; } - - -GuType* -gu_exn_caught(GuExn* err); +#define gu_exn_caught(err, type) \ + (err->caught && strcmp(err->caught, #type) == 0) + +bool +gu_exn_caught_(GuExn* err, const char* type); static inline const void* gu_exn_caught_data(GuExn* err) @@ -104,11 +99,11 @@ gu_exn_unblock(GuExn* err); //@private GuExnData* -gu_exn_raise_(GuExn* err, GuType* type); +gu_exn_raise_(GuExn* err, const char* type); //@private GuExnData* -gu_exn_raise_debug_(GuExn* err, GuType* type, +gu_exn_raise_debug_(GuExn* err, const char* type, const char* filename, const char* func, int lineno); #ifdef NDEBUG @@ -122,7 +117,7 @@ gu_exn_raise_debug_(GuExn* err, GuType* type, /// Raise an exception. #define gu_raise(exn, T) \ - gu_exn_raise(exn, gu_type(T)) + gu_exn_raise(exn, #T) /**< * @param exn The current exception frame. * @@ -168,8 +163,6 @@ gu_ok(GuExn* exn) { typedef int GuErrno; -extern GU_DECLARE_TYPE(GuErrno, signed); - void gu_raise_errno(GuExn* err); -- cgit v1.2.3