Skip to content

Commit 911b6af

Browse files
committed
add ctassert
1 parent 43d0fa6 commit 911b6af

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/platform.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !defined(__has_extension)
2+
#define __has_extension(a) 0
3+
#endif
4+
15
#if defined(__clang__) && defined(__has_attribute) && __has_attribute(musttail)
26
#define __musttail __attribute__((musttail))
37
#else
@@ -45,3 +49,10 @@
4549
#define __alloc_size2(a, b)
4650
#endif
4751
#endif
52+
53+
/* compile-time assertion */
54+
#if __STDC_VERSION__ >= 201112L || __has_extension(c_static_assert)
55+
#define ctassert(e) _Static_assert(e, #e)
56+
#else
57+
#define ctassert(e)
58+
#endif

0 commit comments

Comments
 (0)