From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, stephen@networkplumber.org,
Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH 1/4] cocci: add script for zero-length arrays in structs
Date: Thu, 2 Jun 2022 16:08:31 +0100 [thread overview]
Message-ID: <20220602150834.643745-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20220602150834.643745-1-bruce.richardson@intel.com>
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>
---
devtools/cocci/zero_length_array.cocci | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 devtools/cocci/zero_length_array.cocci
diff --git a/devtools/cocci/zero_length_array.cocci b/devtools/cocci/zero_length_array.cocci
new file mode 100644
index 0000000000..de8783bc7a
--- /dev/null
+++ b/devtools/cocci/zero_length_array.cocci
@@ -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;
--
2.34.1
next prev parent reply other threads:[~2022-06-02 15:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 15:08 [PATCH 0/4] clean up zero-length arrays Bruce Richardson
2022-06-02 15:08 ` Bruce Richardson [this message]
2022-06-02 15:08 ` [PATCH 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-02 15:08 ` [PATCH 3/4] lib: " Bruce Richardson
2022-06-02 15:08 ` [PATCH 4/4] app: examples: " Bruce Richardson
2022-06-02 15:20 ` [PATCH 0/4] clean up zero-length arrays Morten Brørup
2022-06-02 15:35 ` Stephen Hemminger
2022-06-02 16:13 ` [PATCH v2 " Bruce Richardson
2022-06-02 16:13 ` [PATCH v2 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-02 16:13 ` [PATCH v2 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-03 7:19 ` David Marchand
2022-06-03 7:36 ` Bruce Richardson
2022-06-03 9:18 ` Bruce Richardson
2022-06-02 16:13 ` [PATCH v2 3/4] lib: " Bruce Richardson
2022-06-02 16:13 ` [PATCH v2 4/4] app: examples: " Bruce Richardson
2022-06-03 6:56 ` [PATCH v2 0/4] clean up zero-length arrays Hemant Agrawal
2022-06-03 10:13 ` [PATCH v3 " Bruce Richardson
2022-06-03 10:13 ` [PATCH v3 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-03 10:30 ` Morten Brørup
2022-06-03 10:38 ` Bruce Richardson
2022-06-03 10:13 ` [PATCH v3 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-03 10:13 ` [PATCH v3 3/4] lib: " Bruce Richardson
2022-06-03 10:13 ` [PATCH v3 4/4] app: examples: " Bruce Richardson
2022-06-03 11:13 ` [PATCH v3 0/4] clean up zero-length arrays Bruce Richardson
2022-06-03 11:16 ` [PATCH v4 " Bruce Richardson
2022-06-03 11:16 ` [PATCH v4 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-03 11:16 ` [PATCH v4 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-03 11:16 ` [PATCH v4 3/4] lib: " Bruce Richardson
2022-06-03 11:16 ` [PATCH v4 4/4] app: examples: " Bruce Richardson
2022-06-07 14:16 ` [PATCH v4 0/4] clean up zero-length arrays David Marchand
2022-06-09 15:19 ` Tyler Retzlaff
2022-06-08 15:23 ` [PATCH " Stephen Hemminger
2022-06-14 9:40 ` Bruce Richardson
2022-06-14 9:45 ` Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220602150834.643745-2-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).