about summary refs log tree commit diff
path: root/boot/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/common.c')
-rw-r--r--boot/common.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/boot/common.c b/boot/common.c
index d92684e..ccae087 100644
--- a/boot/common.c
+++ b/boot/common.c
@@ -10,6 +10,7 @@
 
 #pragma once
 
+#include <math.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
@@ -17,7 +18,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <math.h>
 
 #define uint8 uint8_t
 #define uint16 uint16_t
@@ -46,6 +46,8 @@
 #define nil NULL
 #define unknown void
 
+#define NORETURN _Noreturn
+
 // ansi escape codes for terminal color and style
 #define ANSI(code) "\33[" code "m"
 
@@ -77,6 +79,7 @@
 // call on irrecoverable failure.
 // prints a very sad, apologetic message for
 // the user and aborts program with failure status.
+NORETURN
 void
 failure(const ascii* message)
 {
@@ -98,6 +101,13 @@ check(bool condition, const ascii* message)
     if (!condition) failure(message);
 }
 
+NORETURN
+void
+unreachable()
+{
+    failure("unreachable code reached");
+}
+
 // for each entry in a linked list.
 #define FOR_EACH(type, cursor, head) for (type cursor = head; cursor != nil; cursor = cursor->next)