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
7445 AttributeDef ad, adbase;7445 AttributeDef ad, adbase;
7446 7446
7447 while (1) {7447 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 }
7448 if (!parse_btype(&btype, &adbase)) {7461 if (!parse_btype(&btype, &adbase)) {
7449 if (is_for_loop_init)7462 if (is_for_loop_init)
7450 return 0;7463 return 0;
tcctok.h+1−0
@@ -38,6 +38,7 @@ · 37 unmodified lines
38 DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */38 DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */
39 39
40 DEF(TOK_GENERIC, "_Generic")40 DEF(TOK_GENERIC, "_Generic")
41 DEF(TOK_STATIC_ASSERT, "_Static_assert")
41 42
42 DEF(TOK_FLOAT, "float")43 DEF(TOK_FLOAT, "float")
43 DEF(TOK_DOUBLE, "double")44 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