summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-08-27 00:18:07 +0200
committerJohannes Weiner <hannes@cmpxchg.org>2009-08-27 00:18:07 +0200
commit126151f6382ef2ffb47d2074e96edae65a40f01d (patch)
tree91c93061173ee84a949044648207cda09ce043a9
parentbffb4ca65c8a2adfb6c3240563e76a775232ee16 (diff)
util: mark sheep_bug() 'noreturn' with gcc
-rw-r--r--include/sheep/util.h8
-rw-r--r--sheep/core.c2
-rw-r--r--sheep/eval.c2
3 files changed, 8 insertions, 4 deletions
diff --git a/include/sheep/util.h b/include/sheep/util.h
index 37dd6d8..7df60cb 100644
--- a/include/sheep/util.h
+++ b/include/sheep/util.h
@@ -9,13 +9,19 @@
#include <stdarg.h>
#include <stddef.h>
+#ifdef __GNUC__
+#define __noreturn __attribute__((noreturn))
+#else
+#define __noreturn
+#endif
+
void *sheep_malloc(size_t);
void *sheep_zalloc(size_t);
void *sheep_realloc(void *, size_t);
char *sheep_strdup(const char *);
void sheep_free(const void *);
-void sheep_bug(const char *, ...);
+void __noreturn sheep_bug(const char *, ...);
#define sheep_bug_on(cond) \
do if (cond) \
diff --git a/sheep/core.c b/sheep/core.c
index fa24e32..7d4566d 100644
--- a/sheep/core.c
+++ b/sheep/core.c
@@ -47,7 +47,6 @@ static int do_verify(const char *caller, char control, sheep_t object)
object->type == &sheep_function_type;
}
sheep_bug("unexpected unpack control %c", control);
- return 0xdead;
}
static const char *map_control(char control)
@@ -63,7 +62,6 @@ static const char *map_control(char control)
return p[0] + 1;
sheep_bug("incomplete controlnames table");
- return "dead";
}
static int verify(const char *caller, char control, sheep_t object)
diff --git a/sheep/eval.c b/sheep/eval.c
index f377d7f..01510de 100644
--- a/sheep/eval.c
+++ b/sheep/eval.c
@@ -307,9 +307,9 @@ sheep_t sheep_call(struct sheep_vm *vm, sheep_t callable,
case 1:
return value;
case 0:
+ default:
return __sheep_eval(vm, &vm->code, sheep_data(callable));
}
- return (void *)0xdead;
}
void sheep_evaluator_init(struct sheep_vm *vm)