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 * check-name: Check -Wcontext
321 context.c:69:13: warning: context imbalance in 'warn_lock1' - wrong count at exit
322 context.c:74:13: warning: context imbalance in 'warn_lock2' - wrong count at exit
323 context.c:81:13: warning: context imbalance in 'warn_lock3' - wrong count at exit
324 context.c:88:13: warning: context imbalance in 'warn_unlock1' - unexpected unlock
325 context.c:93:13: warning: context imbalance in 'warn_unlock2' - unexpected unlock
326 context.c:131:12: warning: context imbalance in 'warn_if1' - wrong count at exit
327 context.c:140:12: warning: context imbalance in 'warn_if2' - different lock contexts for basic block
328 context.c:202:9: warning: context imbalance in 'warn_while1' - different lock contexts for basic block
329 context.c:210:17: warning: context imbalance in 'warn_while2' - unexpected unlock
330 context.c:216:9: warning: context imbalance in 'warn_while3' - wrong count at exit
331 context.c:274:13: warning: context imbalance in 'warn_goto1' - wrong count at exit
332 context.c:283:13: warning: context imbalance in 'warn_goto2' - wrong count at exit
333 context.c:300:5: warning: context imbalance in 'warn_goto3' - different lock contexts for basic block
334 context.c:315:5: warning: context imbalance in 'warn_cond_lock1' - different lock contexts for basic block