aboutsummaryrefslogtreecommitdiffstats
path: root/include/static_assert.h
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-10 05:30:02 +0200
committerSven Gothel <[email protected]>2014-06-10 05:30:02 +0200
commitf95bf4457fbc31112fa82dacbc1b7e094b9fd1cf (patch)
tree965ba5b8e6fc8e6bfe7a981c1dfb1179bb9adcde /include/static_assert.h
parent7297c3214a4c648aaee81a9877da15b88f798197 (diff)
parentc07fb7b45c1e345dbaa439882250de5b2213026f (diff)
Merge branch 'UPSTREAM' into UPSTREAM_MERGE
Diffstat (limited to 'include/static_assert.h')
-rw-r--r--include/static_assert.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/static_assert.h b/include/static_assert.h
new file mode 100644
index 00000000..65283cf0
--- /dev/null
+++ b/include/static_assert.h
@@ -0,0 +1,17 @@
+#ifndef AL_STATIC_ASSERT_H
+#define AL_STATIC_ASSERT_H
+
+#include <assert.h>
+
+
+#ifndef static_assert
+#ifdef HAVE_C11_STATIC_ASSERT
+#define static_assert _Static_assert
+#else
+#define CTASTR2(_pre,_post) _pre##_post
+#define CTASTR(_pre,_post) CTASTR2(_pre,_post)
+#define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__)
+#endif
+#endif
+
+#endif /* AL_STATIC_ASSERT_H */