Showing the changes to tests (2 of 2 files). Show all
Unified · Split
| @@ -1,6 +1,13 @@ | |||
| 1 | #include <stdio.h> | 1 | extern int printf(const char*, ...); |
| 2 | 2 | ||
| 3 | struct fred | 3 | struct fred; |
| 4 | |||
| 5 | void fred$(struct fred* this) | ||
| 6 | { | ||
| 7 | printf("~fred()\n"); | ||
| 8 | } | ||
| 9 | |||
| 10 | struct __attribute__((__cleanup__(fred$))) fred | ||
| 4 | { | 11 | { |
| 5 | int boris; | 12 | int boris; |
| 6 | int natasha; | 13 | int natasha; |
| @@ -8,7 +15,7 @@ struct fred · 1 unmodified line | |||
| 8 | 15 | ||
| 9 | int main() | 16 | int main() |
| 10 | { | 17 | { |
| 11 | struct fred bloggs; | 18 | struct fred __attribute__((__cleanup__(fred$))) bloggs; |
| 12 | 19 | ||
| 13 | bloggs.boris = 12; | 20 | bloggs.boris = 12; |
| 14 | bloggs.natasha = 34; | 21 | bloggs.natasha = 34; |
| @@ -1,6 +1,8 @@ | |||
| 1 | 03_struct.c:14: warning: attribute '__cleanup__' ignored on type | ||
| 1 | 12 | 2 | 12 |
| 2 | 34 | 3 | 34 |
| 3 | 12 | 4 | 12 |
| 4 | 34 | 5 | 34 |
| 5 | 56 | 6 | 56 |
| 6 | 78 | 7 | 78 |
| 8 | ~fred() | ||