1 // SPDX-License-Identifier: GPL-2.0-only
3 /// Zero-length and one-element arrays are deprecated, see
4 /// Documentation/process/deprecated.rst
5 /// Flexible-array members should be used instead.
9 // Copyright: (C) 2020 Denis Efremov ISPRAS.
11 // Options: --no-includes --include-headers
20 def relevant(positions):
27 identifier name, array;
29 position p : script:python() { relevant(p) };
35 * T array@p[\(0\|1\)];
40 * T array@p[\(0\|1\)];
45 * T array@p[\(0\|1\)];
50 * T array@p[\(0\|1\)];
54 @only_field depends on patch@
55 identifier name, array;
71 identifier name, array;
73 position p : script:python() { relevant(p) };
74 // position @q with rule "only_field" simplifies
75 // handling of bitfields, arrays, etc.
76 position q != only_field.q;
95 @script: python depends on report@
99 msg = "WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)"
100 coccilib.report.print_report(p[0], msg)
102 @script: python depends on org@
106 msg = "WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)"
107 coccilib.org.print_todo(p[0], msg)