File: | pr/Linux4.19_x86_64_gcc_glibc_PTH_64_DBG.OBJ/pr/tests/../../../pr/tests/lazyinit.c |
Warning: | line 79, column 17 Value stored to 'tcp' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | |
6 | /* |
7 | ** File: lazyinit.c |
8 | ** Description: Testing lazy initialization |
9 | ** |
10 | ** Since you only get to initialize once, you have to rerun the test |
11 | ** for each test case. The test cases are numbered. If you want to |
12 | ** add more tests, take the next number and add it to the switch |
13 | ** statement. |
14 | ** |
15 | ** This test is problematic on systems that don't support the notion |
16 | ** of console output. The workarounds to emulate that feature include |
17 | ** initializations themselves, which defeats the purpose here. |
18 | */ |
19 | |
20 | #include "prcvar.h" |
21 | #include "prenv.h" |
22 | #include "prinit.h" |
23 | #include "prinrval.h" |
24 | #include "prio.h" |
25 | #include "prlock.h" |
26 | #include "prlog.h" |
27 | #include "prthread.h" |
28 | #include "prtypes.h" |
29 | |
30 | #include <stdio.h> |
31 | #include <stdlib.h> |
32 | |
33 | static void PR_CALLBACK lazyEntry(void *arg) |
34 | { |
35 | PR_ASSERT(NULL == arg)((((void*)0) == arg)?((void)0):PR_Assert("NULL == arg","../../../pr/tests/lazyinit.c" ,35)); |
36 | } /* lazyEntry */ |
37 | |
38 | |
39 | int main(int argc, char **argv) |
40 | { |
41 | PRUintn pdkey; |
42 | PRStatus status; |
43 | char *path = NULL((void*)0); |
44 | PRDir *dir = NULL((void*)0); |
45 | PRLock *ml = NULL((void*)0); |
46 | PRCondVar *cv = NULL((void*)0); |
47 | PRThread *thread = NULL((void*)0); |
48 | PRIntervalTime interval = 0; |
49 | PRFileDesc *file, *udp, *tcp, *pair[2]; |
50 | PRIntn test; |
51 | |
52 | if ( argc < 2) |
53 | { |
54 | test = 0; |
55 | } |
56 | else { |
57 | test = atoi(argv[1]); |
58 | } |
59 | |
60 | switch (test) |
61 | { |
62 | case 0: ml = PR_NewLock(); |
63 | break; |
64 | |
65 | case 1: interval = PR_SecondsToInterval(1); |
66 | break; |
67 | |
68 | case 2: thread = PR_CreateThread( |
69 | PR_USER_THREAD, lazyEntry, NULL((void*)0), PR_PRIORITY_NORMAL, |
70 | PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); |
71 | break; |
72 | |
73 | case 3: file = PR_Open("./tmp-", PR_RDONLY0x01, 0); |
74 | break; |
75 | |
76 | case 4: udp = PR_NewUDPSocket(); |
77 | break; |
78 | |
79 | case 5: tcp = PR_NewTCPSocket(); |
Value stored to 'tcp' is never read | |
80 | break; |
81 | |
82 | case 6: dir = PR_OpenDir("./tmp-"); |
83 | break; |
84 | |
85 | case 7: (void)PR_NewThreadPrivateIndex(&pdkey, NULL((void*)0)); |
86 | break; |
87 | |
88 | case 8: path = PR_GetEnv("PATH"); |
89 | break; |
90 | |
91 | case 9: status = PR_NewTCPSocketPair(pair); |
92 | break; |
93 | |
94 | case 10: PR_SetConcurrency(2); |
95 | break; |
96 | |
97 | default: |
98 | printf( |
99 | "lazyinit: unrecognized command line argument: %s\n", |
100 | argv[1] ); |
101 | printf( "FAIL\n" ); |
102 | exit( 1 ); |
103 | break; |
104 | } /* switch() */ |
105 | return 0; |
106 | } /* Lazy */ |
107 | |
108 | /* lazyinit.c */ |