unreachable code: don't warn about empty statements
[smatch.git] / validation / sm_wine_locking.c
bloba136d15b97104b9e2a2726f840130b9a2e8511ca
1 int create_window_handle(int x);
2 void WIN_ReleasePtr(int x);
3 void EnterCriticalSection(int x);
4 void LeaveCriticalSection(int x);
5 void USER_Lock(void);
6 void USER_Unlock(void);
7 int GDI_GetObjPtr(int x);
8 void GDI_ReleaseObj(int x);
10 void test1(void)
12 int a;
13 int b = create_window_handle(a);
14 int c;
15 int d, e;
16 int z = frob();
18 if (d = GDI_GetObjPtr(e))
19 GDI_ReleaseObj(e);
20 if (GDI_GetObjPtr(e))
21 GDI_ReleaseObj(e);
22 EnterCriticalSection(c);
23 USER_Lock();
24 if (b) {
25 LeaveCriticalSection(c);
26 WIN_ReleasePtr(b);
28 WIN_ReleasePtr(b);
29 if (z)
30 return;
31 USER_Unlock();
32 if (!b)
33 LeaveCriticalSection(c);
36 * check-name: WINE locking
37 * check-command: smatch -p=wine --spammy sm_wine_locking.c
39 * check-output-start
40 sm_wine_locking.c:28 test1() error: double unlock 'create_window_handle:b'
41 sm_wine_locking.c:30 test1() warn: 'CriticalSection:c' is sometimes locked here and sometimes unlocked.
42 sm_wine_locking.c:33 test1() warn: inconsistent returns USER_Lock:: locked (30) unlocked (33)
43 * check-output-end