publish UNREACHABLE macro
This commit is contained in:
parent
acfa79bc62
commit
ef7d01971b
|
@ -56,6 +56,13 @@ extern "C" {
|
||||||
# define GENSYM(x) GENSYM1__(x,__LINE__)
|
# define GENSYM(x) GENSYM1__(x,__LINE__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__ || __clang__
|
||||||
|
# define UNREACHABLE() (__builtin_unreachable())
|
||||||
|
#else
|
||||||
|
# include <assert.h>
|
||||||
|
# define UNREACHABLE() (assert(false))
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "picrin/value.h"
|
#include "picrin/value.h"
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "picrin/proc.h"
|
#include "picrin/proc.h"
|
||||||
#include "picrin/var.h"
|
#include "picrin/var.h"
|
||||||
|
|
||||||
#define UNREACHABLE (assert(false))
|
|
||||||
|
|
||||||
struct pic_var *
|
struct pic_var *
|
||||||
pic_var_new(pic_state *pic, pic_value init, struct pic_proc *conv /* = NULL */)
|
pic_var_new(pic_state *pic, pic_value init, struct pic_proc *conv /* = NULL */)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +65,7 @@ get_var_from_proc(pic_state *pic, struct pic_proc *proc)
|
||||||
|
|
||||||
typeerror:
|
typeerror:
|
||||||
pic_error(pic, "expected parameter");
|
pic_error(pic, "expected parameter");
|
||||||
UNREACHABLE;
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
|
@ -94,7 +92,7 @@ var_call(pic_state *pic)
|
||||||
else {
|
else {
|
||||||
pic_abort(pic, "logic flaw");
|
pic_abort(pic, "logic flaw");
|
||||||
}
|
}
|
||||||
UNREACHABLE;
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pic_proc *
|
struct pic_proc *
|
||||||
|
|
Loading…
Reference in New Issue