1 static void a(void) __attribute__((context(TEST
,0,1)))
6 static void r(void) __attribute__((context(TEST
,1,0)))
8 __context__(TEST
,-1,1);
11 static void a2(void) __attribute__((context(TEST2
,0,1)))
16 static void r2(void) __attribute__((context(TEST2
,1,0)))
18 __context__(TEST2
,-1,1);
21 #define check_test2() __context__(TEST2,0,1)
23 static void good_paired1(void)
31 static void good_paired2(void)
41 static void good_paired3(void)
53 static void good_lock1(void) __attribute__((context(TEST
,0,1)))
58 static void good_lock2(void) __attribute__((context(TEST
,0,1)))
65 static void good_lock3(void) __attribute__((context(TEST
,0,1)))
72 static void good_unlock1(void) __attribute__((context(TEST
,1,0)))
77 static void good_unlock2(void) __attribute__((context(TEST
,1,0)))
84 static void warn_lock1(void)
89 static void warn_lock2(void)
96 static void warn_lock3(void)
103 static void warn_unlock1(void)
108 static void warn_unlock2(void)
115 extern int condition
, condition2
;
117 static int good_if1(void)
128 static void good_if2(void)
136 static void good_if3(void)
146 static int warn_if1(void)
155 static int warn_if2(void)
165 static void good_while1(void)
173 static void good_while2(void)
181 static void good_while3(void)
193 static void good_while4(void)
204 static void good_while5(void)
215 static void warn_while1(void)
222 static void warn_while2(void)
229 static void warn_while3(void)
239 static void good_goto1(void)
247 static void good_goto2(void)
257 static void good_goto3(void)
268 static void good_goto4(void)
278 static void good_goto5(void)
289 static void warn_goto1(void)
298 static void warn_goto2(void)
308 static void warn_goto3(void)
318 static void warn_multiple1(void)
324 static void warn_multiple2(void)
330 static void warn_mixed1(void)
336 static void warn_mixed2(void)
346 static void warn_mixed3(void)
356 static void warn_mixed4(void)
367 static void good_mixed1(void)
378 static void good_mixed2(void)
388 static int need_lock(void) __attribute__((context(TEST
,1,1)))
392 static void need_lock_exact(void) __attribute__((exact_context(TEST
,1,1)))
396 static void need_lock2(void) __attribute__((context(TEST
,1,1)))
401 static void good_fn(void)
408 static void good_fn2(void)
417 static void good_fn2(void)
425 static void good_fn3(void) __attribute__((context(TEST
,1,1)))
431 static void warn_fn(void)
438 static void warn_fn2(void)
445 static void good_exact_fn(void)
452 static void warn_exact_fn1(void)
461 static void warn_exact_fn2(void)
468 static inline void need_lock3(void) __attribute__((context(TEST
,1,1)))
472 static void warn_fn3(void)
479 #define __acquire(x) __context__(x,1)
480 #define __release(x) __context__(x,-1)
483 do { __acquire(RCU); } while (0)
486 do { __release(RCU); } while (0)
488 static void good_mixed_with_if(void)
501 * check-name: Check -Wcontext with lock names
504 context-named.c:86:3: warning: context imbalance in 'warn_lock1': wrong count at exit
505 context-named.c:86:3: context 'TEST': wanted 0, got 1
506 context-named.c:93:3: warning: context imbalance in 'warn_lock2': wrong count at exit
507 context-named.c:93:3: context 'TEST': wanted 0, got 1
508 context-named.c:100:3: warning: context imbalance in 'warn_lock3': wrong count at exit
509 context-named.c:100:3: context 'TEST': wanted 0, got 1
510 context-named.c:105:3: warning: context problem in 'warn_unlock1': 'r' expected different context
511 context-named.c:105:3: context 'TEST': wanted >= 1, got 0
512 context-named.c:112:3: warning: context problem in 'warn_unlock2': 'r' expected different context
513 context-named.c:112:3: context 'TEST': wanted >= 1, got 0
514 context-named.c:152:9: warning: context imbalance in 'warn_if1': wrong count at exit
515 context-named.c:152:9: context 'TEST': wanted 0, got 1
516 context-named.c:162:9: warning: context imbalance in 'warn_if2': wrong count at exit
517 context-named.c:162:9: context 'TEST': wanted 0, got 1
518 context-named.c:218:4: warning: context imbalance in 'warn_while1': wrong count at exit
519 context-named.c:218:4: context 'TEST': wanted 0, got 1
520 context-named.c:225:4: warning: context problem in 'warn_while2': 'r' expected different context
521 context-named.c:225:4: context 'TEST': wanted >= 1, got 0
522 context-named.c:235:4: warning: context imbalance in 'warn_while3': wrong count at exit
523 context-named.c:235:4: context 'TEST': wanted 0, got 1
524 context-named.c:295:5: warning: context imbalance in 'warn_goto1': wrong count at exit
525 context-named.c:295:5: context 'TEST': wanted 0, got 1
526 context-named.c:305:6: warning: context imbalance in 'warn_goto2': wrong count at exit
527 context-named.c:305:6: context 'TEST': wanted 0, got 1
528 context-named.c:315:6: warning: context problem in 'warn_goto3': 'r' expected different context
529 context-named.c:315:6: context 'TEST': wanted >= 1, got 0
530 context-named.c:321:7: warning: context imbalance in 'warn_multiple1': wrong count at exit
531 context-named.c:321:7: context 'TEST': wanted 0, got 1
532 context-named.c:327:6: warning: context imbalance in 'warn_multiple2': wrong count at exit
533 context-named.c:327:6: context 'TEST2': wanted 0, got 1
534 context-named.c:333:6: warning: context problem in 'warn_mixed1': 'r' expected different context
535 context-named.c:333:6: context 'TEST': wanted >= 1, got 0
536 context-named.c:343:6: warning: context problem in 'warn_mixed2': 'r' expected different context
537 context-named.c:343:6: context 'TEST': wanted >= 1, got 0
538 context-named.c:353:6: warning: context problem in 'warn_mixed3': 'r' expected different context
539 context-named.c:353:6: context 'TEST': wanted >= 1, got 0
540 context-named.c:364:6: warning: context imbalance in 'warn_mixed4': wrong count at exit
541 context-named.c:364:6: context 'TEST2': wanted 0, got 1
542 context-named.c:434:14: warning: context problem in 'warn_fn': 'need_lock' expected different context
543 context-named.c:434:14: context 'TEST': wanted >= 1, got 0
544 context-named.c:441:15: warning: context problem in 'warn_fn2': 'need_lock2' expected different context
545 context-named.c:441:15: context 'TEST': wanted >= 1, got 0
546 context-named.c:456:20: warning: context problem in 'warn_exact_fn1': 'need_lock_exact' expected different context
547 context-named.c:456:20: context 'TEST': wanted 1, got 2
548 context-named.c:464:20: warning: context problem in 'warn_exact_fn2': 'need_lock_exact' expected different context
549 context-named.c:464:20: context 'TEST': wanted 1, got 0
550 context-named.c:475:15: warning: context problem in 'warn_fn3': 'need_lock3' expected different context
551 context-named.c:475:15: context 'TEST': wanted >= 1, got 0