summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordzwdz2021-09-05 19:04:21 +0200
committerdzwdz2021-09-05 19:04:21 +0200
commite447090093a01fea0b27c4340fcb54bbf9ae3396 (patch)
tree5a9b6e120caa68f9a6f505499bb1a67fa352ee68
parent252f5e40c1c054e6ad52a413567460f3ed2917f4 (diff)
error out when <*/types.h> isn't included in headers which need it
-rw-r--r--src/init/types.h2
-rw-r--r--src/kernel/types.h2
-rw-r--r--src/shared/syscalls.h6
-rw-r--r--src/shared/vfs.h7
4 files changed, 12 insertions, 5 deletions
diff --git a/src/init/types.h b/src/init/types.h
index d06d171..2c56484 100644
--- a/src/init/types.h
+++ b/src/init/types.h
@@ -1,2 +1,4 @@
#pragma once
+
+#define TYPES_INCLUDED
typedef char* user_ptr;
diff --git a/src/kernel/types.h b/src/kernel/types.h
index eb12f08..891e644 100644
--- a/src/kernel/types.h
+++ b/src/kernel/types.h
@@ -1,3 +1,5 @@
#pragma once
#include <stdint.h>
+
+#define TYPES_INCLUDED
typedef uintptr_t user_ptr;
diff --git a/src/shared/syscalls.h b/src/shared/syscalls.h
index 7a1acaf..0222f37 100644
--- a/src/shared/syscalls.h
+++ b/src/shared/syscalls.h
@@ -1,8 +1,10 @@
-// requires the user_ptr type from kernel/types.h or init/types.h
-
#pragma once
#include <stddef.h>
+#ifndef TYPES_INCLUDED
+# error "please include <kernel/types.h> or <init/types.h> before this file"
+#endif
+
typedef int handle_t;
enum {
diff --git a/src/shared/vfs.h b/src/shared/vfs.h
index d88c424..730a288 100644
--- a/src/shared/vfs.h
+++ b/src/shared/vfs.h
@@ -1,8 +1,9 @@
-// requires the user_ptr type from kernel/types.h or init/types.h
-// TODO add some macro magic which prints an error when it isn't defined
-
#pragma once
+#ifndef TYPES_INCLUDED
+# error "please include <kernel/types.h> or <init/types.h> before this file"
+#endif
+
enum vfs_op_types {
VFSOP_OPEN,
VFSOP_WRITE,