History

add a cleanup test that use a lot of scope

matthias committed 7 years ago

Commit de92fbe1 parent 26f0cf02 files · +25 −1Browse files

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

Unified · Split

2 files
  1. tests/tests2/101_cleanup.c +24 −1
  2. tests/tests2/101_cleanup.expect +1 −0
tests/tests2/101_cleanup.c+24−1
@@ -1,5 +1,26 @@
11 #include <tcclib.h>
22
3+static int glob_i = 0;
4+
5+void incr_glob_i(int *i)
6+{
7+ glob_i += *i;
8+}
9+
10+#define INCR_GI { \
11+ int i __attribute__ ((__cleanup__(incr_glob_i))) = 1; \
12+ }
13+
14+#define INCR_GI0 INCR_GI INCR_GI INCR_GI INCR_GI
15+#define INCR_GI1 INCR_GI0 INCR_GI0 INCR_GI0 INCR_GI0
16+#define INCR_GI2 INCR_GI1 INCR_GI1 INCR_GI1 INCR_GI1
17+#define INCR_GI3 INCR_GI2 INCR_GI2 INCR_GI2 INCR_GI2
18+#define INCR_GI4 INCR_GI3 INCR_GI3 INCR_GI3 INCR_GI3
19+#define INCR_GI5 INCR_GI4 INCR_GI4 INCR_GI4 INCR_GI4
20+#define INCR_GI6 INCR_GI5 INCR_GI5 INCR_GI5 INCR_GI5
21+#define INCR_GI7 INCR_GI6 INCR_GI6 INCR_GI6 INCR_GI6
22+
23+
324 void check2(char **hum);
425
526 void check(int *j)
@@ -103,7 +124,9 @@ int main() · 97 unmodified lines
103124 __attribute__ ((__cleanup__(check_oh_i))) char oh_i = 'o', o = 'a';
104125 }
105126
106− naaaaaaaa:
127+ INCR_GI7;
128+ printf("glob_i: %d\n", glob_i);
129+ naaaaaaaa:
107130 if (!chk) {
108131 __attribute__ ((__cleanup__(check_oh_i))) char oh_i = 'f';
109132 double __attribute__ ((__cleanup__(goto_hell))) f = 2.6;
tests/tests2/101_cleanup.expect+1−0
@@ -1,5 +1,6 @@
11 c: a
22 c: o
3+glob_i: 65536
34 oo: 2.600000
45 c: f
56 str: I don't think this should be print(but gcc got it wrong too)

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