diff mbox series

[1/3] scripts/coccinelle: Add headers to lib checks and fix macro fix

Message ID 20210621113804.26179-1-rpalethorpe@suse.com
State Accepted
Headers show
Series [1/3] scripts/coccinelle: Add headers to lib checks and fix macro fix | expand

Commit Message

Richard Palethorpe June 21, 2021, 11:38 a.m. UTC
We have to explicitly add the header directory.

Also allow the TEST macro fix to replace multiple variables.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
 scripts/coccinelle/libltp-test-macro.cocci |  4 +++-
 scripts/coccinelle/run-spatch.sh           | 10 ++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

Comments

Cyril Hrubis Aug. 10, 2021, 3:17 p.m. UTC | #1
Hi!
Pushed the first two patches, thanks.

I guess that we no longer need the third since we do have 'make check'
now.
diff mbox series

Patch

diff --git a/scripts/coccinelle/libltp-test-macro.cocci b/scripts/coccinelle/libltp-test-macro.cocci
index 7563d23aa..937d6c94f 100644
--- a/scripts/coccinelle/libltp-test-macro.cocci
+++ b/scripts/coccinelle/libltp-test-macro.cocci
@@ -24,7 +24,7 @@  virtual fix
 
  TEST(...)
 
- ...
+ <...
 
 (
 - TST_RET
@@ -37,6 +37,8 @@  virtual fix
 + TERRNO
 )
 
+ ...>
+
 // Replace TEST in all functions where it occurs only at the start. It
 // is slightly complicated by adding a newline if a statement appears
 // on the line after TEST(). It is not clear to me what the rules are
diff --git a/scripts/coccinelle/run-spatch.sh b/scripts/coccinelle/run-spatch.sh
index e8e6f47d8..978998cd1 100755
--- a/scripts/coccinelle/run-spatch.sh
+++ b/scripts/coccinelle/run-spatch.sh
@@ -25,6 +25,12 @@  libltp_spatch() {
 	       -D fix \
 	       --include-headers \
 	       $*
+	spatch --dir include \
+	       --use-gitgrep \
+	       --in-place \
+	       -D fix \
+	       --include-headers \
+	       $*
     else
 	spatch --dir lib \
 	       --ignore lib/parse_opts.c \
@@ -33,6 +39,10 @@  libltp_spatch() {
 	       --use-gitgrep \
 	       --include-headers \
 	       $*
+	spatch --dir include \
+	       --use-gitgrep \
+	       --include-headers \
+	       $*
     fi
 }