aboutsummaryrefslogtreecommitdiff
path: root/common/scummsys.h
diff options
context:
space:
mode:
authorColin Snover2017-01-06 22:24:09 -0600
committerColin Snover2017-01-08 13:20:23 -0600
commit7e0b40173f1b57a81e9e3cd17709162410ac1269 (patch)
treebf793880670b22867cb8b8d36d501677b54270bc /common/scummsys.h
parent640f6039ca48f7119478acd6dd66b8ad36bf0753 (diff)
downloadscummvm-rg350-7e0b40173f1b57a81e9e3cd17709162410ac1269.tar.gz
scummvm-rg350-7e0b40173f1b57a81e9e3cd17709162410ac1269.tar.bz2
scummvm-rg350-7e0b40173f1b57a81e9e3cd17709162410ac1269.zip
COMMON: Add STATIC_ASSERT macro to scummsys.h
Diffstat (limited to 'common/scummsys.h')
-rw-r--r--common/scummsys.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/scummsys.h b/common/scummsys.h
index 1845f218bd..6fd9be81c8 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -151,6 +151,17 @@
#if !defined(__SYMBIAN32__)
#include <new>
#endif
+
+ /**
+ * Generates a compile-time assertion.
+ *
+ * @param expression An expression that can be evaluated at compile time.
+ * @param message An underscore-delimited message to be presented at compile
+ * time if the expression evaluates to false.
+ */
+ #define STATIC_ASSERT(expression, message) \
+ extern int STATIC_ASSERT_##message[(expression) ? 1 : -1]; \
+ (void)(STATIC_ASSERT_##message);
#endif
// The following math constants are usually defined by the system math.h header, but