publish UNREACHABLE macro

This commit is contained in:
Yuichi Nishiwaki 2014-03-19 17:40:31 +09:00
parent acfa79bc62
commit ef7d01971b
2 changed files with 9 additions and 4 deletions

View File

@ -56,6 +56,13 @@ extern "C" {
# define GENSYM(x) GENSYM1__(x,__LINE__)
#endif
#if __GNUC__ || __clang__
# define UNREACHABLE() (__builtin_unreachable())
#else
# include <assert.h>
# define UNREACHABLE() (assert(false))
#endif
#include "config.h"
#include "picrin/value.h"

View File

@ -6,8 +6,6 @@
#include "picrin/proc.h"
#include "picrin/var.h"
#define UNREACHABLE (assert(false))
struct pic_var *
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:
pic_error(pic, "expected parameter");
UNREACHABLE;
UNREACHABLE();
}
static pic_value
@ -94,7 +92,7 @@ var_call(pic_state *pic)
else {
pic_abort(pic, "logic flaw");
}
UNREACHABLE;
UNREACHABLE();
}
struct pic_proc *