-
Notifications
You must be signed in to change notification settings - Fork 378
/
flint.lnt
334 lines (269 loc) · 9.87 KB
/
flint.lnt
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
// Copyright (c) 2013-2020 Varnish Software AS
// SPDX-License-Identifier: BSD-2-Clause
// See LICENSE file for full text of license
/*
* Toplevel control file for FlexeLint
*/
//d__flexelint_v9__=1
+fan
// No automatic custody
-ffc
-hm4
///////////////////////////////////////////////////////////////////////
// electives
//+e9*
-e904
-e935
-e955
-e956
//+e958 // report internal struct padding
//+e959 // report struct tail/size padding
-e960
-e961
-efile(966, "/usr/include/*") // unused indir include
-efile(966, "../../include/tbl/*")
-e964
-e970
-e971
-e9012
-e9021
-e9022
-e9023
-e9024
-e9026
-e9034
-e9037
-e9042
-e9048
-e9050
-e9051
-e9067
+e9071 // defined macro '...' is reserved to the compiler
+e9075 // external symbol without declaration
-esym(9075, main)
-e9085
-e9105
-e9107
-e9109
-e9113
-e9131
-e9132
-e9133
-e9136
-e9140
-e9141
-e9147 // we dont use & on func_pointers
-e9149
-e9158
-e9159
-e9165
///////////////////////////////////////////////////////////////////////
// This does not work with pcre2.h, the injected /* lint ... */ comments
// interfere with macro argument concatenation. Clear flexelint bug
// because it does not happen when run with -p
// -emacro((835),*) // A zero has been given as ___ argument to operator '___
-e835 // A zero has been given as ___ argument to operator '___
///////////////////////////////////////////////////////////////////////
// build/config related
-efile(451, "tbl/*.h") // No include guard
-efile(537, "tbl/*.h") // Repeated include
-efile(967, "tbl/*.h") // No include guard
-efile(451, "../../include/vut_options.h") // No include guard
-efile(451, "../../include/vapi/vapi_options.h") // No include guard
-efile(451, ../../config.h) // No include guard
-efile(766, ../../config.h) // Header file '___' not used in module '___'
+libh(../../config.h)
-esym(768, vmod_priv) // global struct member '___' (___) not referenced
///////////////////////////////////////////////////////////////////////
// Thread/locking, too many false positives still
-e454 // A thread mutex has been locked but not unlocked___
-e455 // A thread mutex that had not been locked is being unlocked
-e456 // Two execution paths are being combined with different mutex lock states
-e457 // unprotected write access
-e458 // unprotected access
-e459 // unprotected access
///////////////////////////////////////////////////////////////////////
// General stylistic issues
-e663 // Suspicious array to pointer conversion
//-e574 // Signed-unsigned mix with relational
-e641 // Converting enum '...' to int
-e716 // while(1) ...
-e726 // Extraneous comma ignored
-e728 // Symbol ... not explicitly initialized
-e737 // Loss of sign in promotion from int to unsigned int
-e763 // Redundant declaration for symbol '...' previously declared
-e717 // do ... while(0);
-e777 // Testing floats for equality
-e785 // Too few initializers for aggregate
-e786 // String concatenation within initializer
-e788 // enum constant '___' not used within defaulted switch
-esym(818, argv) // Pointer parameter '...' could be declared as pointing to const
-e850 // loop variable modified in loop
/*
* va_list's are opaque for a reason, but we pretend to FlexeLint that it
* is just a void*, so it proposes constification, which is not generally OK,
* for instance on register-spilling architectures.
* XXX: Maybe 'ap' is a badly chosen conventional name here...
*/
-esym(818, ap) // Pointer parameter '...' could be declared as pointing to const
-efunc(789, main) // Assigning address of auto variable '...' to static
// +e958 // padding
///////////////////////////////////////////////////////////////////////
// System/Posix/Iso-C library related
-emacro(747, isnan) // significant coercion
-emacro(506, isinf) // Constant value Boolean
-emacro(866, isinf) // Unusual use of '?' in argument to sizeof
-emacro(736, isinf) // Loss of precision
// ignore retval
-esym(534, printf)
-esym(534, fprintf)
-esym(534, vfprintf)
-esym(534, sprintf)
-esym(534, fputc)
-esym(534, memset)
-esym(534, memcpy)
-esym(534, memmove)
-esym(534, strcat)
-esym(534, strcpy)
-esym(534, strncpy)
-esym(534, sleep)
-esym(534, usleep)
///////////////////////////////////////////////////////////////////////
// Vmod/vmodtool.py
//-esym(14, vmod_enum_*) // Symbol '___' previously defined (___)
//-esym(759, vmod_enum_*) // header declaration for symbol '___' defined at (___)
//-esym(765, vmod_enum_*) // external '___' (___) could be made static
///////////////////////////////////////////////////////////////////////
// <vut.h>
-sem(VUT_Error, r_no)
///////////////////////////////////////////////////////////////////////
// <vas.h>
-sem(VAS_Fail, r_no) // does not return
-emacro(506, assert) // constant value boolean
-emacro(827, assert) // loop not reachable
-emacro(774, assert) // boolean always true
-emacro(731, assert) // boolean arg to eq/non-eq
-emacro(731, xxxassert) // arg to eq/non-eq
-emacro(527, WRONG) // unreachable code
-emacro(774, VALID_OBJ) // boolean always true
-emacro(506, VALID_OBJ) // Constant value Boolean
-emacro(506, v_static_assert) // Constant value Boolean
-esym(751, __vassert_*) // local typedef '___' (___) not referenced
///////////////////////////////////////////////////////////////////////
// Places where we use x<<0 for reasons of symmetry
-emacro(835, VCT_SP) // A zero has been given as ___ argument to operator '___'
-emacro(835, VSL_COPT_TAIL) // A zero has been given as ___ argument to operator '___'
-emacro(835, SLT_F_UNUSED) // A zero has been given as ___ argument to operator '___'
-emacro(835, ARGV_COMMENT) // A zero has been given as ___ argument to operator '___'
-emacro(835, F_SEEN_ixIX) // A zero has been given as ___ argument to operator '___'
-emacro(835, VEX_OPT_CASELESS) // A zero has been given as ___ argument to operator '___'
///////////////////////////////////////////////////////////////////////
// <vsb.h>
-esym(759, VSB_*) // header decl could be moved
-esym(765, VSB_*) // extern could be made static
-esym(714, VSB_*) // symb not ref
-sem(VSB_new, @p == (1p ? 1p : malloc(1)))
-sem(VSB_delete, custodial(1))
// ignore retval
-esym(534, VSB_cat)
-esym(534, VSB_bcat)
-esym(534, VSB_putc)
-esym(534, VSB_printf)
-esym(534, VSB_vprintf)
///////////////////////////////////////////////////////////////////////
// <vte.h>
// ignore retval
-esym(534, VTE_cat)
-esym(534, VTE_putc)
-esym(534, VTE_printf)
///////////////////////////////////////////////////////////////////////
// <vtree.h>
// -emacro(801, VRBT_*) // goto considered bad
-emacro(527, VRBT_*) // unreachable code
-emacro(740, VRBT_*) // unusual pointer cast
-emacro(438, VRBT_*) // last value assigned not used
-emacro(613, VRBT_*) // Possible use of null pointer 'child' in left argument to
-emacro(838, VRBT_*) // Previously assigned value to variable 'child' has not been used
-emacro(50, VRBT_GENERATE_*) // Attempted to take the address of a non-lvalue
-emacro(506, VRBT_GENERATE_*) // Constant value Boolean
-emacro(845, VRBT_GENERATE_*) // The left argument to operator '&&' is certain to be 0
-emacro(774, VRBT_GENERATE_*) // Boolean within 'if' always evaluates to False
-esym(534, *_VRBT_REMOVE) // ignore retval
-esym(534, *_VRBT_INSERT) // ignore retval
///////////////////////////////////////////////////////////////////////
// <vqueue.h>
-esym(755, VLIST_*) // Global macro not ref.
-esym(755, VSLIST_*)
-esym(755, VSTAILQ_*)
-esym(755, VTAILQ_*)
// 506 = constant value boolean
-emacro(506, VTAILQ_FOREACH_REVERSE_SAFE)
-emacro(506, VTAILQ_FOREACH_SAFE)
-emacro(506, VSTAILQ_FOREACH_SAFE) // constant value boolean
// 826 = Suspicious pointer-to-pointer conversion (area to o small)
-emacro((826), VTAILQ_LAST)
-emacro((826), VTAILQ_PREV)
-emacro(740, VTAILQ_LAST) // Unusual pointer cast (incompatible indirect types)
-emacro(740, VTAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
-esym(754, "*::vtqh_first") // local struct member '...' not referenced
///////////////////////////////////////////////////////////////////////
// <vdef.h>
-emacro(527, NEEDLESS) // unreachable code
-emacro(160, _vtake) // The sequence '( {' is non standard
+rw( __typeof__ )
///////////////////////////////////////////////////////////////////////
// <vrt.h>
-emacro(446, TOSTRAND, TOSTRANDS) // side effect in initializer
///////////////////////////////////////////////////////////////////////
// <libvarnishapi>
-esym(765, vsl_vbm_bitclr)
-esym(759, vsl_vbm_bitclr)
-esym(765, vsl_vbm_bitset)
-esym(759, vsl_vbm_bitset)
-esym(765, vsm_diag)
-esym(759, vsm_diag)
///////////////////////////////////////////////////////////////////////
// "miniobj.h"
-emacro(774, REPLACE)
// It is ok to default after handling a few select SLT_* tags
-esym(788, VSL_tag_e::SLT_*) // enum constant '...' not used within defaulted switch
-esym(785,VSL_tags) // Sparse array
///////////////////////////////////////////////////////////////////////
// readline etc.
-esym(534, add_history)
///////////////////////////////////////////////////////////////////////
// -lcurses
-esym(534, beep)
-esym(534, curs_set)
-esym(534, delwin)
-esym(534, doupdate)
-esym(534, endwin)
-esym(534, initscr)
-esym(534, intrflush)
-esym(534, keypad)
-esym(534, mvprintw)
-esym(534, waddnstr)
-esym(534, mvwprintw)
-esym(534, nodelay)
-esym(534, noecho)
-esym(534, nonl)
-esym(534, raw)
-esym(534, waddch)
-esym(534, wattr_off)
-esym(534, wattr_on)
-esym(534, wbkgd)
-esym(534, werase)
-esym(534, wmove)
-esym(534, wnoutrefresh)
-esym(534, wprintw)
-esym(534, wredrawln)
-esym(534, wrefresh)
///////////////////////////////////////////////////////////////////////
// Noise reduction, review periodically
-e459 // unlocked access from func-ptr
-e679 // Suspicious Truncation in arithmetic expression combining with pointer
-e712 // Loss of precision (___) (___ to ___)
-e713 // Loss of precision (___) (___ to ___)
-e732 // Loss of sign (___) (___ to ___)
-e734 // Loss of precision (___) (___ bits to ___ bits)
-e747 // Significant prototype coercion (___) ___ to ___