summaryrefslogtreecommitdiffstats
path: root/include/c/qual/type/type.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/c/qual/type/type.h')
-rw-r--r--include/c/qual/type/type.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/c/qual/type/type.h b/include/c/qual/type/type.h
new file mode 100644
index 0000000..bfbb9b3
--- /dev/null
+++ b/include/c/qual/type/type.h
@@ -0,0 +1,31 @@
+// Copyright 2022 Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
+
+
+#ifndef INCLUDE_C_QUAL_TYPE_TYPE_H_
+#define INCLUDE_C_QUAL_TYPE_TYPE_H_
+
+
+#include <stdbool.h>
+
+
+#if !defined(auto)
+# define auto __auto_type
+#endif
+
+
+#define c_reinterpret_cast(t, e) ((t) (e))
+
+
+#define c_voidify_p(p) \
+({ \
+ auto p_ = (p); \
+ \
+ true ? p_ : c_reinterpret_cast(void *, p_); \
+})
+
+
+#define c_is_same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+
+
+#endif // Header guard