1 | #pragma once |
---|---|
2 | |
3 | #ifdef __cplusplus |
4 | #define UACPI_STATIC_ASSERT static_assert |
5 | #else |
6 | #define UACPI_STATIC_ASSERT _Static_assert |
7 | #endif |
8 | |
9 | #define UACPI_BUILD_BUG_ON_WITH_MSG(expr, msg) UACPI_STATIC_ASSERT(!(expr), msg) |
10 | |
11 | #define UACPI_BUILD_BUG_ON(expr) \ |
12 | UACPI_BUILD_BUG_ON_WITH_MSG(expr, "BUILD BUG: " #expr " evaluated to true") |
13 | |
14 | #define UACPI_EXPECT_SIZEOF(type, size) \ |
15 | UACPI_BUILD_BUG_ON_WITH_MSG(sizeof(type) != size, \ |
16 | "BUILD BUG: invalid type size") |
17 |