mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-26 08:00:09 +08:00
add C11 _Static_assert support
This commit is contained in:
parent
85483f321d
commit
5a0101856b
13
tccgen.c
13
tccgen.c
@ -7445,6 +7445,19 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym)
|
|||||||
AttributeDef ad, adbase;
|
AttributeDef ad, adbase;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
if (tok == TOK_STATIC_ASSERT) {
|
||||||
|
int c;
|
||||||
|
|
||||||
|
next();
|
||||||
|
skip('(');
|
||||||
|
c = expr_const();
|
||||||
|
skip(',');
|
||||||
|
if (c == 0)
|
||||||
|
tcc_error("%s", get_tok_str(tok, &tokc));
|
||||||
|
next();
|
||||||
|
skip(')');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!parse_btype(&btype, &adbase)) {
|
if (!parse_btype(&btype, &adbase)) {
|
||||||
if (is_for_loop_init)
|
if (is_for_loop_init)
|
||||||
return 0;
|
return 0;
|
||||||
|
1
tcctok.h
1
tcctok.h
@ -38,6 +38,7 @@
|
|||||||
DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */
|
DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */
|
||||||
|
|
||||||
DEF(TOK_GENERIC, "_Generic")
|
DEF(TOK_GENERIC, "_Generic")
|
||||||
|
DEF(TOK_STATIC_ASSERT, "_Static_assert")
|
||||||
|
|
||||||
DEF(TOK_FLOAT, "float")
|
DEF(TOK_FLOAT, "float")
|
||||||
DEF(TOK_DOUBLE, "double")
|
DEF(TOK_DOUBLE, "double")
|
||||||
|
Loading…
Reference in New Issue
Block a user