1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-26 13:18:31 +00:00

Add support for static_assert

Add C11's _Static_assert and static_assert macro.

This is like #error, but is handled at a later stage
of translation, so it is possible to check sizes of
types, values of enums, etc.

https://en.cppreference.com/w/c/language/_Static_assert
https://port70.net/~nsz/c/c11/n1570.html#6.7.10
This commit is contained in:
Jesse Rosenstock
2020-07-26 22:16:47 +02:00
committed by Oliver Schmidt
parent c72fa735b9
commit 3df6c383c0
10 changed files with 274 additions and 0 deletions
+6
View File
@@ -46,6 +46,12 @@ extern void __fastcall__ _afailed (const char*, unsigned);
# define assert(expr) ((expr)? (void)0 : _afailed(__FILE__, __LINE__))
#endif
/*
** TODO: Guard with #if __STDC_VERSION__ >= 201112L or similar when there
** is a C11 mode.
*/
#define static_assert _Static_assert
/* End of assert.h */