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
148148 struct V lv3 = {((struct S){7,8,{9,10}}), ((const struct W *)w)->t.t, 50};
149149 const struct pkthdr *phdr = phdr_;
150150 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 };
151154 print(ls);
152155 print(ls2);
153156 print(lt);
@@ -163,6 +166,7 @@ void foo (struct W *w, struct pkthdr *phdr_) · 9 unmodified lines
163166 print(lv);
164167 print(lv2);
165168 print(lv3);
169+ print(lt2);
166170 print(flow);
167171 }
168172 #endif
tests/tests2/86-struct-init.expect+1−0
@@ -33,4 +33,5 @@ ls3: 1 2 3 4 · 32 unmodified lines
3333 lv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e
3434 lv2: 1 2 3 4 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30
3535 lv3: 7 8 9 a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32
36+lt2: 0 9 9 9 43 43 43 43 42 42 42 0 0 0 0 0 1
3637 flow: 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