[LTP] [PATCH 1/3] scripts/coccinelle: Add headers to lib checks and fix macro fix
Richard Palethorpe
rpalethorpe@suse.com
Mon Jun 21 13:38:02 CEST 2021
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(-)
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
}
--
2.31.1
More information about the ltp
mailing list