summaryrefslogtreecommitdiff
path: root/include/nsutils/assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/nsutils/assert.h')
-rw-r--r--include/nsutils/assert.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/nsutils/assert.h b/include/nsutils/assert.h
new file mode 100644
index 0000000..7f59f2f
--- /dev/null
+++ b/include/nsutils/assert.h
@@ -0,0 +1,24 @@
+/*
+ * This file is part of LibNSUtils.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2022 Michael Drake <tlsa@netsurf-browser.org>
+ */
+
+/**
+ * \file
+ * Static assertion macro.
+ */
+
+#ifndef NSUTILS_ASSERT_H__
+#define NSUTILS_ASSERT_H__
+
+/** Compile time assertion macro. */
+#define ns_static_assert(e) \
+{ \
+ enum { \
+ ns_static_assert_check = 1 / (!!(e)) \
+ }; \
+}
+
+#endif