summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-11 10:22:26 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-11 19:19:48 -0700
commit6ae2bbf849aa597054d7c84d20fc634ed87a1da5 (patch)
treec1deed14207996f685f28a5fb5d553db130d205c /lib9p
parentda46fcb709b9df47d788341b3bd87c545f720f4f (diff)
libmisc: Write my own assert.h with assert_notreached()
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/9p.generated.c3
-rwxr-xr-xlib9p/idl.gen3
-rw-r--r--lib9p/include/lib9p/9p.h3
-rw-r--r--lib9p/map.h2
-rw-r--r--lib9p/srv.c2
5 files changed, 8 insertions, 5 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c
index 79f779f..1a00f10 100644
--- a/lib9p/9p.generated.c
+++ b/lib9p/9p.generated.c
@@ -1,11 +1,12 @@
/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */
-#include <assert.h>
#include <stdbool.h>
#include <stddef.h> /* for size_t */
#include <inttypes.h> /* for PRI* macros */
#include <string.h> /* for memset() */
+#include <libmisc/assert.h>
+
#include <lib9p/9p.h>
#include "internal.h"
diff --git a/lib9p/idl.gen b/lib9p/idl.gen
index ec42cfd..3be1d7e 100755
--- a/lib9p/idl.gen
+++ b/lib9p/idl.gen
@@ -681,12 +681,13 @@ def gen_c(versions: set[str], typs: list[Type]) -> str:
ret = f"""/* Generated by `{' '.join(sys.argv)}`. DO NOT EDIT! */
-#include <assert.h>
#include <stdbool.h>
#include <stddef.h> /* for size_t */
#include <inttypes.h> /* for PRI* macros */
#include <string.h> /* for memset() */
+#include <libmisc/assert.h>
+
#include <lib9p/9p.h>
#include "internal.h"
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h
index 171ad3b..9d22354 100644
--- a/lib9p/include/lib9p/9p.h
+++ b/lib9p/include/lib9p/9p.h
@@ -7,10 +7,11 @@
#ifndef _LIB9P_9P_H_
#define _LIB9P_9P_H_
-#include <assert.h>
#include <stdbool.h>
#include <sys/types.h> /* for ssize_t */
+#include <libmisc/assert.h>
+
#include <lib9p/linux-errno.h>
/* configuration **************************************************************/
diff --git a/lib9p/map.h b/lib9p/map.h
index c816bde..f42bb2c 100644
--- a/lib9p/map.h
+++ b/lib9p/map.h
@@ -84,7 +84,7 @@ static VAL_T *MAP_METHOD(NAME,store)(struct NAME *m, KEY_T k, VAL_T v) {
m->items[i].val = v;
return &(m->items[i].val);
}
- __builtin_unreachable();
+ assert_notreached("should have returned from inside for() loop");
}
/**
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 9192794..e4212e5 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-#include <assert.h>
#include <alloca.h>
#include <inttypes.h> /* for PRI* */
#include <stdio.h> /* for fprintf(), stderr */
@@ -14,6 +13,7 @@
#include <libcr_ipc/chan.h>
#include <libcr_ipc/mutex.h>
#include <libcr_ipc/select.h>
+#include <libmisc/assert.h>
#include <libmisc/vcall.h>
#define IMPLEMENTATION_FOR_LIB9P_SRV_H YES