Skip to content

Commit 817f4b3

Browse files
himanshujha199640nashif
authored andcommitted
coccinelle: Suppress reports/warnings for ext/
The following addition `depends on !(file in "ext")` allows to exclude `ext/` warnings reported by coccinelle scripts. Signed-off-by: Himanshu Jha <[email protected]>
1 parent 7aeeb92 commit 817f4b3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

scripts/coccinelle/array_size.cocci

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ virtual report
2424
// For context mode
2525
//----------------------------------------------------------
2626

27-
@depends on i&&context@
27+
@depends on i&&context && !(file in "ext")@
2828
type T;
2929
T[] E;
3030
@@
@@ -40,7 +40,7 @@ T[] E;
4040
// For patch mode
4141
//----------------------------------------------------------
4242

43-
@depends on i&&patch@
43+
@depends on i&&patch && !(file in "ext")@
4444
type T;
4545
T[] E;
4646
@@
@@ -59,7 +59,7 @@ T[] E;
5959
// For org and report mode
6060
//----------------------------------------------------------
6161

62-
@r depends on (org || report)@
62+
@r depends on (org || report) && !(file in "ext")@
6363
type T;
6464
T[] E;
6565
position p;

scripts/coccinelle/deref_null.cocci

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ virtual report
1616

1717
// The following two rules are separate, because both can match a single
1818
// expression in different ways
19-
@pr1 expression@
19+
@pr1 depends on !(file in "ext")@
2020
expression E;
2121
identifier f;
2222
position p1;
2323
@@
2424

2525
(E != NULL && ...) ? <+...E->f@p1...+> : ...
2626

27-
@pr2 expression@
27+
@pr2 depends on !(file in "ext")@
2828
expression E;
2929
identifier f;
3030
position p2;
@@ -38,7 +38,7 @@ position p2;
3838
sizeof(<+...E->f@p2...+>)
3939
)
4040

41-
@ifm@
41+
@ifm depends on !(file in "ext")@
4242
expression *E;
4343
statement S1,S2;
4444
position p1;
@@ -48,7 +48,7 @@ if@p1 ((E == NULL && ...) || ...) S1 else S2
4848

4949
// For org and report modes
5050

51-
@r depends on !context && (org || report) exists@
51+
@r depends on !context && (org || report) && !(file in "ext") exists@
5252
expression subE <= ifm.E;
5353
expression *ifm.E;
5454
expression E1,E2;
@@ -169,7 +169,7 @@ cocci.print_main(msg_safe,p)
169169
170170
// For context mode
171171
172-
@depends on context && !org && !report exists@
172+
@depends on context && !org && !report && !(file in "ext") exists@
173173
expression subE <= ifm.E;
174174
expression *ifm.E;
175175
expression E1,E2;
@@ -212,15 +212,15 @@ else S3
212212
// The following three rules are duplicates of ifm, pr1 and pr2 respectively.
213213
// It is need because the previous rule as already made a "change".
214214

215-
@pr11 depends on context && !org && !report expression@
215+
@pr11 depends on context && !org && !report && !(file in "ext") && pr1@
216216
expression E;
217217
identifier f;
218218
position p1;
219219
@@
220220

221221
(E != NULL && ...) ? <+...E->f@p1...+> : ...
222222

223-
@pr12 depends on context && !org && !report expression@
223+
@pr12 depends on context && !org && !report && pr2@
224224
expression E;
225225
identifier f;
226226
position p2;
@@ -234,7 +234,7 @@ position p2;
234234
sizeof(<+...E->f@p2...+>)
235235
)
236236

237-
@ifm1 depends on context && !org && !report@
237+
@ifm1 depends on context && !org && !report && !(file in "ext") && ifm@
238238
expression *E;
239239
statement S1,S2;
240240
position p1;

scripts/coccinelle/noderef.cocci

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ virtual report
1313
virtual context
1414
virtual patch
1515

16-
@depends on patch@
16+
@depends on patch && !(file in "ext")@
1717
expression *x;
1818
expression f;
1919
expression i;
@@ -47,7 +47,7 @@ f(...,i*sizeof(
4747
),...,(T)(x),...)
4848
)
4949

50-
@r depends on !patch@
50+
@r depends on !patch && !(file in "ext")@
5151
expression *x;
5252
expression f;
5353
expression i;

scripts/coccinelle/semicolon.cocci

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ virtual report
1212
virtual context
1313
virtual org
1414

15-
@r_default@
15+
@r_default depends on !(file in "ext")@
1616
position p;
1717
@@
1818
switch (...)
1919
{
2020
default: ...;@p
2121
}
2222

23-
@r_case@
23+
@r_case depends on !(file in "ext")@
2424
position p;
2525
@@
2626
(
@@ -43,7 +43,7 @@ case ...:;@p
4343
}
4444
)
4545

46-
@r1@
46+
@r1 depends on !(file in "ext")@
4747
statement S;
4848
position p1;
4949
position p != {r_default.p, r_case.p};

0 commit comments

Comments
 (0)