add NORETURN macro
This commit is contained in:
parent
75037adfaa
commit
7c35e50260
|
@ -33,6 +33,13 @@ extern "C" {
|
|||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* noreturn */
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
# define NORETURN _Noreturn
|
||||
#elif __GNUC__ || __clang__
|
||||
# define NORETURN __attribute__((noreturn))
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "picrin/value.h"
|
||||
|
||||
|
@ -173,10 +180,10 @@ struct pic_lib *pic_find_library(pic_state *, pic_value);
|
|||
void pic_import(pic_state *, pic_value);
|
||||
void pic_export(pic_state *, pic_sym);
|
||||
|
||||
void pic_abort(pic_state *, const char *);
|
||||
void pic_raise(pic_state *, pic_value);
|
||||
void pic_error(pic_state *, const char *);
|
||||
void pic_errorf(pic_state *, const char *, size_t, ...);
|
||||
NORETURN void pic_abort(pic_state *, const char *);
|
||||
NORETURN void pic_raise(pic_state *, pic_value);
|
||||
NORETURN void pic_error(pic_state *, const char *);
|
||||
NORETURN void pic_errorf(pic_state *, const char *, size_t, ...);
|
||||
void pic_warn(pic_state *, const char *);
|
||||
|
||||
void pic_debug(pic_state *, pic_value);
|
||||
|
|
|
@ -72,7 +72,7 @@ native_stack_extend(pic_state *pic, struct pic_cont *cont)
|
|||
restore_cont(pic, cont);
|
||||
}
|
||||
|
||||
static void
|
||||
NORETURN static void
|
||||
restore_cont(pic_state *pic, struct pic_cont *cont)
|
||||
{
|
||||
pic_value v;
|
||||
|
@ -128,7 +128,7 @@ walk_to_block(pic_state *pic, struct pic_block *here, struct pic_block *there)
|
|||
}
|
||||
}
|
||||
|
||||
static pic_value
|
||||
NORETURN static pic_value
|
||||
cont_call(pic_state *pic)
|
||||
{
|
||||
struct pic_proc *proc;
|
||||
|
@ -145,9 +145,6 @@ cont_call(pic_state *pic)
|
|||
walk_to_block(pic, pic->blk, cont->blk);
|
||||
|
||||
restore_cont(pic, cont);
|
||||
|
||||
/* the function never returns */
|
||||
return pic_undef_value();
|
||||
}
|
||||
|
||||
pic_value
|
||||
|
|
11
src/error.c
11
src/error.c
|
@ -84,7 +84,7 @@ pic_error_with_exception_handler(pic_state *pic)
|
|||
return v;
|
||||
}
|
||||
|
||||
static pic_value
|
||||
NORETURN static pic_value
|
||||
pic_error_raise(pic_state *pic)
|
||||
{
|
||||
pic_value v;
|
||||
|
@ -92,9 +92,6 @@ pic_error_raise(pic_state *pic)
|
|||
pic_get_args(pic, "o", &v);
|
||||
|
||||
pic_raise(pic, v);
|
||||
|
||||
/* the function never returns */
|
||||
return pic_undef_value();
|
||||
}
|
||||
|
||||
static pic_value
|
||||
|
@ -116,7 +113,7 @@ pic_error_raise_continuable(pic_state *pic)
|
|||
return a;
|
||||
}
|
||||
|
||||
static pic_value
|
||||
NORETURN static pic_value
|
||||
pic_error_error(pic_state *pic)
|
||||
{
|
||||
char *str;
|
||||
|
@ -133,10 +130,8 @@ pic_error_error(pic_state *pic)
|
|||
e->irrs = pic_list_from_array(pic, argc, argv);
|
||||
|
||||
pic_raise(pic, pic_obj_value(e));
|
||||
|
||||
/* never returns */
|
||||
return pic_undef_value();
|
||||
}
|
||||
|
||||
static pic_value
|
||||
pic_error_error_object_p(pic_state *pic)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue