History

add C11 _Static_assert support

matthias committed 7 years ago

Commit 5a010181 parent 85483f32 files · +14 −0Browse files

Unified · Split

2 files
  1. tccgen.c +13 −0
  2. tcctok.h +1 −0
tccgen.c+13−0
@@ -7445,6 +7445,19 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) · 7444 unmodified lines
74457445 AttributeDef ad, adbase;
74467446
74477447 while (1) {
7448+ if (tok == TOK_STATIC_ASSERT) {
7449+ int c;
7450+
7451+ next();
7452+ skip('(');
7453+ c = expr_const();
7454+ skip(',');
7455+ if (c == 0)
7456+ tcc_error("%s", get_tok_str(tok, &tokc));
7457+ next();
7458+ skip(')');
7459+ continue;
7460+ }
74487461 if (!parse_btype(&btype, &adbase)) {
74497462 if (is_for_loop_init)
74507463 return 0;
tcctok.h+1−0
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */
3939
4040 DEF(TOK_GENERIC, "_Generic")
41+ DEF(TOK_STATIC_ASSERT, "_Static_assert")
4142
4243 DEF(TOK_FLOAT, "float")
4344 DEF(TOK_DOUBLE, "double")

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t