History

struct-init: Support range inits for local vars

Implement missing support for range init for local variables.

Michael Matz committed 10 years ago

Commit 4e46c221 parent 4cb70473 files · +33 −17Browse files

Showing the changes to tests (2 of 3 files). Show all

Unified · Split

2 files
  1. tests/tests2/86-struct-init.c +4 −0
  2. tests/tests2/86-struct-init.expect +1 −0
tests/tests2/86-struct-init.c+4−0
@@ -148,6 +148,9 @@ void foo (struct W *w, struct pkthdr *phdr_) · 147 unmodified lines
148 struct V lv3 = {((struct S){7,8,{9,10}}), ((const struct W *)w)->t.t, 50};148 struct V lv3 = {((struct S){7,8,{9,10}}), ((const struct W *)w)->t.t, 50};
149 const struct pkthdr *phdr = phdr_;149 const struct pkthdr *phdr = phdr_;
150 struct flowi6 flow = { .daddr = phdr->daddr, .saddr = phdr->saddr };150 struct flowi6 flow = { .daddr = phdr->daddr, .saddr = phdr->saddr };
151 int elt = 0x42;
152 /* Range init, overlapping */
153 struct T lt2 = { { [1 ... 5] = 9, [6 ... 10] = elt, [4 ... 7] = elt+1 }, 1 };
151 print(ls);154 print(ls);
152 print(ls2);155 print(ls2);
153 print(lt);156 print(lt);
@@ -163,6 +166,7 @@ void foo (struct W *w, struct pkthdr *phdr_) · 9 unmodified lines
163 print(lv);166 print(lv);
164 print(lv2);167 print(lv2);
165 print(lv3);168 print(lv3);
169 print(lt2);
166 print(flow);170 print(flow);
167}171}
168#endif172#endif
tests/tests2/86-struct-init.expect+1−0
@@ -33,4 +33,5 @@ ls3: 1 2 3 4 · 32 unmodified lines
33lv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e33lv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e
34lv2: 1 2 3 4 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 3034lv2: 1 2 3 4 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30
35lv3: 7 8 9 a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3235lv3: 7 8 9 a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32
36lt2: 0 9 9 9 43 43 43 43 42 42 42 0 0 0 0 0 1
36flow: 9 8 7 6 0 0 0 0 0 0 0 0 0 0 0 0 6 5 4 3 0 0 0 0 0 0 0 0 0 0 0 037flow: 9 8 7 6 0 0 0 0 0 0 0 0 0 0 0 0 6 5 4 3 0 0 0 0 0 0 0 0 0 0 0 0

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