]> wimlib.net Git - wimlib/blobdiff - include/wimlib/compiler.h
Replace BUILD_BUG_ON() with STATIC_ASSERT()
[wimlib] / include / wimlib / compiler.h
index 5327318832f3c7ffb6dd9484117e73f9333a9f75..72c100a286fd9315cccebe5c76921c1faa815f6d 100644 (file)
 #  define _force_attr
 #endif
 
-#ifndef BUILD_BUG_ON
-#  define BUILD_BUG_ON(expr)   ((void)sizeof(char[1 - 2*!!(expr)]))
+/* STATIC_ASSERT() - verify the truth of an expression at compilation time.  */
+#if __STDC_VERSION__ >= 201112L
+#  define STATIC_ASSERT(expr)  _Static_assert((expr), "")
+#else
+#  define STATIC_ASSERT(expr)  ((void)sizeof(char[1 - 2 * !(expr)]))
 #endif
 
 #endif /* _WIMLIB_COMPILER_H */