1 #define __cond_lock(c) ((c) ? ({ __context__(1); 1; }) : 0)
3 static void a(void) __attribute__((context(0,1)))
8 static void r(void) __attribute__((context(1,0)))
13 extern void _ca(int fail
);
14 #define ca(fail) __cond_lock(_ca(fail))
16 static void good_paired1(void)
22 static void good_paired2(void)
30 static void good_paired3(void)
38 static void good_lock1(void) __attribute__((context(0,1)))
43 static void good_lock2(void) __attribute__((context(0,1)))
50 static void good_lock3(void) __attribute__((context(0,1)))
57 static void good_unlock1(void) __attribute__((context(1,0)))
62 static void good_unlock2(void) __attribute__((context(1,0)))
69 static void warn_lock1(void)
74 static void warn_lock2(void)
81 static void warn_lock3(void)
88 static void warn_unlock1(void)
93 static void warn_unlock2(void)
100 extern int condition
, condition2
;
102 static int good_if1(void)
113 static void good_if2(void)
121 static void good_if3(void)
131 static int warn_if1(void)
140 static int warn_if2(void)
150 static void good_while1(void)
158 static void good_while2(void)
166 static void good_while3(void)
178 static void good_while4(void)
189 static void good_while5(void)
200 static void warn_while1(void)
207 static void warn_while2(void)
214 static void warn_while3(void)
224 static void good_goto1(void)
232 static void good_goto2(void)
242 static void good_goto3(void)
253 static void good_goto4(void)
263 static void good_goto5(void)
274 static void warn_goto1(void)
283 static void warn_goto2(void)
293 static void warn_goto3(void)
303 static void good_cond_lock1(void)
306 condition2
= 1; /* do stuff */
311 static void warn_cond_lock1(void)
314 condition2
= 1; /* do stuff */
318 static void warn_odd_looping(void)
322 for (i
= 0; i
< 2; i
++)
324 for (i
= 0; i
< 2; i
++)
328 static void warn_huge_switch(void)
371 static int warn_conditional(void)
384 * check-name: Check -Wcontext
387 context.c:71:3: warning: context imbalance in 'warn_lock1': wrong count at exit
388 context.c:71:3: default context: wanted 0, got 1
389 context.c:78:3: warning: context imbalance in 'warn_lock2': wrong count at exit
390 context.c:78:3: default context: wanted 0, got 1
391 context.c:85:3: warning: context imbalance in 'warn_lock3': wrong count at exit
392 context.c:85:3: default context: wanted 0, got 1
393 context.c:90:3: warning: context problem in 'warn_unlock1': 'r' expected different context
394 context.c:90:3: default context: wanted >= 1, got 0
395 context.c:97:3: warning: context problem in 'warn_unlock2': 'r' expected different context
396 context.c:97:3: default context: wanted >= 1, got 0
397 context.c:137:9: warning: context imbalance in 'warn_if1': wrong count at exit
398 context.c:137:9: default context: wanted 0, got 1
399 context.c:147:9: warning: context imbalance in 'warn_if2': wrong count at exit
400 context.c:147:9: default context: wanted 0, got 1
401 context.c:203:4: warning: context imbalance in 'warn_while1': wrong count at exit
402 context.c:203:4: default context: wanted 0, got 1
403 context.c:210:4: warning: context problem in 'warn_while2': 'r' expected different context
404 context.c:210:4: default context: wanted >= 1, got 0
405 context.c:220:4: warning: context imbalance in 'warn_while3': wrong count at exit
406 context.c:220:4: default context: wanted 0, got 1
407 context.c:280:5: warning: context imbalance in 'warn_goto1': wrong count at exit
408 context.c:280:5: default context: wanted 0, got 1
409 context.c:290:6: warning: context imbalance in 'warn_goto2': wrong count at exit
410 context.c:290:6: default context: wanted 0, got 1
411 context.c:300:6: warning: context problem in 'warn_goto3': 'r' expected different context
412 context.c:300:6: default context: wanted >= 1, got 0
413 context.c:315:6: warning: context problem in 'warn_cond_lock1': 'r' expected different context
414 context.c:315:6: default context: wanted >= 1, got 0
415 context.c:325:10: warning: context problem in 'warn_odd_looping': 'r' expected different context
416 context.c:325:10: default context: wanted >= 1, got 0
417 context.c:360:10: warning: context problem in 'warn_huge_switch': 'r' expected different context
418 context.c:360:10: default context: wanted >= 1, got 0
419 context.c:380:12: warning: context imbalance in 'warn_conditional': wrong count at exit
420 context.c:380:12: default context: wanted 0, got 1