History

Accept empty struct member decls

struct S { /*nothing*/; int a; }; is an acceptable struct declaration, there may be stray semicolons in the member list.

Michael Matz committed 10 years ago

Commit 6763b021 parent d5d881d2 files · +9 −1Browse files

Unified · Split

2 files
  1. tccgen.c +4 −1
  2. tests/tcctest.c +5 −0
tccgen.c+4−1
@@ -3250,7 +3250,10 @@ static void struct_decl(CType *type, AttributeDef *ad, int u) · 3249 unmodified lines
3250 offset = 0;3250 offset = 0;
3251 flexible = 0;3251 flexible = 0;
3252 while (tok != '}') {3252 while (tok != '}') {
3253 parse_btype(&btype, &ad1);3253 if (!parse_btype(&btype, &ad1)) {
3254 skip(';');
3255 continue;
3256 }
3254 while (1) {3257 while (1) {
3255 extra_bytes = 0;3258 extra_bytes = 0;
3256 if (flexible)3259 if (flexible)
tests/tcctest.c+5−0
@@ -642,6 +642,11 @@ union union2 { · 641 unmodified lines
642 642
643struct struct1 st1, st2;643struct struct1 st1, st2;
644 644
645struct empty_mem {
646 /* nothing */ ;
647 int x;
648};
649
645int main(int argc, char **argv)650int main(int argc, char **argv)
646{651{
647 string_test();652 string_test();

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