aot_runtime.c: Add static assertions for some offset assumptions (#1103)

This commit is contained in:
YAMAMOTO Takashi
2022-04-20 14:58:02 +09:00
committed by GitHub
parent b36931a589
commit 0f505aafd9
2 changed files with 29 additions and 0 deletions

View File

@ -22,6 +22,19 @@ bh_assert_internal(int v, const char *file_name, int line_number,
#define bh_assert(expr) (void)0
#endif /* end of BH_DEBUG */
#if !defined(__has_extension)
#define __has_extension(a) 0
#endif
#if __STDC_VERSION__ >= 201112L \
|| (defined(__GNUC__) && __GNUC__ * 0x100 + __GNUC_MINOR__ >= 0x406) \
|| __has_extension(c_static_assert)
#define bh_static_assert(expr) _Static_assert(expr, #expr)
#else
#define bh_static_assert(expr) /* nothing */
#endif
#ifdef __cplusplus
}
#endif