From 7e0b40173f1b57a81e9e3cd17709162410ac1269 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 6 Jan 2017 22:24:09 -0600 Subject: COMMON: Add STATIC_ASSERT macro to scummsys.h --- common/scummsys.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'common') 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 #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 -- cgit v1.2.3