forked from M-Labs/artiq
1
0
Fork 0

Add artiq_raise_from_c macro.

This commit is contained in:
whitequark 2015-07-27 13:56:18 +03:00
parent edffb40ef2
commit 244ace19e1
1 changed files with 13 additions and 0 deletions

View File

@ -30,6 +30,19 @@ void __artiq_raise(struct artiq_exception *artiq_exn)
void __artiq_reraise() void __artiq_reraise()
__attribute__((noreturn)); __attribute__((noreturn));
#define artiq_raise_from_c(exnname, exnmsg, exnparam0, exnparam1, exnparam2) \
do { \
struct artiq_exception exn = { \
.name = exnname, \
.message = exnmsg, \
.param = { exnparam0, exnparam1, exnparam2 }, \
.file = __FILE__, \
.line = __LINE__, \
.column = 0 \
}; \
__artiq_raise(&exn); \
} while(0)
/* Called by the runtime */ /* Called by the runtime */
void __artiq_terminate(struct artiq_exception *artiq_exn, void __artiq_terminate(struct artiq_exception *artiq_exn,
struct artiq_backtrace_item *backtrace, struct artiq_backtrace_item *backtrace,