File: libs.expect

package info (click to toggle)
lclint 1%3A2.4b-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,996 kB
  • ctags: 9,589
  • sloc: ansic: 100,034; lex: 2,754; yacc: 2,472; makefile: 835
file content (172 lines) | stat: -rw-r--r-- 9,344 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

libs.c: (in function compare2)
libs.c:14:10: Observer storage returned without qualification: "ok"
   libs.c:14:10: Storage becomes observer
libs.c: (in function leave)
libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo"
libs.c:21:3: Unreachable code: exit(i)
libs.c: (in function print)
libs.c:33:3: Assignment of int to char: c = fgetc(f)
libs.c:34:3: Assignment of int to char: c = getc(f)
libs.c: (in function main)
libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int,
                 int) returns int]: compare
libs.c:46:10: Function bsearch called with 4 args, expects 5
libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU...
libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x
libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:54:11: Unrecognized identifier: SIGHUP
libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void]
                 * gets [function (int, int) returns int]: compare
libs.c:54:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, c...
libs.c:55:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, l...

Finished LCLint checking --- 15 code errors found, as expected

libs.c: (in function compare2)
libs.c:14:10: Observer storage returned without qualification: "ok"
   libs.c:14:10: Storage becomes observer
libs.c: (in function leave)
libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo"
libs.c:21:3: Unreachable code: exit(i)
libs.c: (in function print)
libs.c:33:3: Assignment of int to char: c = fgetc(f)
libs.c:34:3: Assignment of int to char: c = getc(f)
libs.c: (in function main)
libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int,
                 int) returns int]: compare
libs.c:46:10: Function bsearch called with 4 args, expects 5
libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU...
libs.c:51:16: Function qsort expects arg 2 to be size_t gets unsigned int: x
libs.c:51:19: Function qsort expects arg 3 to be size_t gets unsigned int: x
libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x
libs.c:52:13: Function qsort expects arg 2 to be size_t gets unsigned int: x
libs.c:52:16: Function qsort expects arg 3 to be size_t gets unsigned int: x
libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:54:11: Unrecognized identifier: SIGHUP
libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void]
                 * gets [function (int, int) returns int]: compare
libs.c:54:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, c...
libs.c:55:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, l...

Finished LCLint checking --- 19 code errors found, as expected

libs.c: (in function compare2)
libs.c:14:10: Observer storage returned without qualification: "ok"
   libs.c:14:10: Storage becomes observer
libs.c: (in function leave)
libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo"
libs.c:21:3: Unreachable code: exit(i)
libs.c: (in function print)
libs.c:29:3: Undocumented modification of *f possible from call to fprintf:
                fprintf(f, s)
libs.c:33:7: Undocumented modification of *f possible from call to fgetc:
                fgetc(f)
libs.c:33:3: Assignment of int to char: c = fgetc(f)
libs.c:34:7: Undocumented modification of *f possible from call to getc:
                getc(f)
libs.c:34:3: Assignment of int to char: c = getc(f)
libs.c: (in function main)
libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int,
                 int) returns int]: compare
libs.c:46:10: Function bsearch called with 4 args, expects 5
libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU...
libs.c:51:16: Function qsort expects arg 2 to be size_t gets unsigned int: x
libs.c:51:19: Function qsort expects arg 3 to be size_t gets unsigned int: x
libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x
libs.c:52:13: Function qsort expects arg 2 to be size_t gets unsigned int: x
libs.c:52:16: Function qsort expects arg 3 to be size_t gets unsigned int: x
libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:54:11: Unrecognized identifier: SIGHUP
libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void]
                 * gets [function (int, int) returns int]: compare
libs.c:54:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, c...
libs.c:55:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, l...

Finished LCLint checking --- 22 code errors found, as expected

libs.c: (in function compare2)
libs.c:14:10: Observer storage returned without qualification: "ok"
   libs.c:14:10: Storage becomes observer
libs.c: (in function leave)
libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo"
libs.c:21:3: Unreachable code: exit(i)
libs.c: (in function print)
libs.c:29:3: Undocumented modification of *f possible from call to fprintf:
                fprintf(f, s)
libs.c:29:3: Return value (type int) ignored: fprintf(f, s)
libs.c:30:3: Called procedure printf may access global stdout
libs.c:30:3: Undocumented modification of *stdout possible from call to printf:
                printf(s)
libs.c:30:3: Return value (type int) ignored: printf(s)
libs.c:31:12: Undocumented use of global stderr
libs.c:31:3: Undocumented modification of *stderr possible from call to
                fprintf: fprintf(stderr, s)
libs.c:31:3: Return value (type int) ignored: fprintf(stderr, s)
libs.c:33:7: Called procedure fgetc may access global errno
libs.c:33:7: Undocumented modification of *f possible from call to fgetc:
                fgetc(f)
libs.c:33:7: Undocumented modification of errno possible from call to fgetc:
                fgetc(f)
libs.c:33:3: Assignment of int to char: c = fgetc(f)
libs.c:34:7: Undocumented modification of *f possible from call to getc:
                getc(f)
libs.c:34:3: Assignment of int to char: c = getc(f)
libs.c: (in function main)
libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int,
                 int) returns int]: compare
libs.c:46:10: Function bsearch called with 4 args, expects 5
libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU...
libs.c:51:16: Function qsort expects arg 2 to be size_t gets unsigned int: x
libs.c:51:19: Function qsort expects arg 3 to be size_t gets unsigned int: x
libs.c:51:3: Called procedure qsort may access global errno
libs.c:51:3: Undocumented modification of errno possible from call to qsort:
                qsort(NULL, x, x, ([function () returns int] *)compare)
libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x
libs.c:52:13: Function qsort expects arg 2 to be size_t gets unsigned int: x
libs.c:52:16: Function qsort expects arg 3 to be size_t gets unsigned int: x
libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *)
    returns int] * gets [function () returns char] *:
    ([function () returns char] *)compare2
libs.c:52:3: Called procedure qsort may access global errno
libs.c:52:3: Undocumented modification of errno possible from call to qsort:
                qsort(x, x, x, ([function () returns char] *)compare2)
libs.c:54:11: Unrecognized identifier: SIGHUP
libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void]
                 * gets [function (int, int) returns int]: compare
libs.c:54:3: Called procedure signal may access global errno
libs.c:54:3: Undocumented modification of errno possible from call to signal:
                signal(SIGHUP, compare)
libs.c:54:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, c...
libs.c:55:3: Called procedure signal may access global errno
libs.c:55:3: Undocumented modification of errno possible from call to signal:
                signal(SIGHUP, leave)
libs.c:55:3: Return value (type [function (int) returns void]) ignored:
                signal(SIGHUP, l...

Finished LCLint checking --- 39 code errors found, as expected