cocci: add script for zero-length arrays in structs
Add script to replace [0] with [] when used at the end of a struct. The script also includes an additional struct member to match against so as to avoid issues with arrays with only a single zero-length element. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
parent
63f3f7cd44
commit
beeed9d92a
21
devtools/cocci/zero_length_array.cocci
Normal file
21
devtools/cocci/zero_length_array.cocci
Normal file
@ -0,0 +1,21 @@
|
||||
// Replace zero-length array members with []
|
||||
@@
|
||||
identifier st, member, arr;
|
||||
type T1, T2;
|
||||
@@
|
||||
struct st {
|
||||
...
|
||||
T1 member;
|
||||
- T2 arr[0];
|
||||
+ T2 arr[];
|
||||
};
|
||||
@@
|
||||
identifier st, member, arr, id;
|
||||
type T1, T2;
|
||||
@@
|
||||
struct st {
|
||||
...
|
||||
T1 member;
|
||||
- T2 arr[0];
|
||||
+ T2 arr[];
|
||||
} id;
|
Loading…
Reference in New Issue
Block a user