scripts: add dummy report mode to add_namespace.cocci
Subsystems (3)
Matthias Maennich
maintainerPATCH 1/1 scripts: add dummy report mode to add_namespace.cocci
When running make coccicheck in report mode using the add_namespace.cocci file, it will fail for files that contain MODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.
In order to fix that, add the virtual rule nsdeps and only do search and replace if that rule has been explicitly requested.
In order to make spatch happy in report mode, we also need a dummy rule, as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up with.
Adjust scripts/nsdeps accordingly to set the nsdeps rule when run trough make nsdeps.
--- scripts/coccinelle/misc/add_namespace.cocci | 8 +++++++- scripts/nsdeps | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-)
scripts/coccinelle/misc/add_namespace.cocci +7 -1
@@ -6,6 +6,7 @@ /// add a missing namespace tag to a module source file. /// +virtual nsdeps virtual report @has_ns_import@
@@ -16,10 +17,15 @@ MODULE_IMPORT_NS(ns); // Add missing imports, but only adjacent to a MODULE_LICENSE statement. // That ensures we are adding it only to the main module source file. -@do_import depends on !has_ns_import@ +@do_import depends on !has_ns_import && nsdeps@ declarer name MODULE_LICENSE; expression license; identifier virtual.ns; @@ MODULE_LICENSE(license); + MODULE_IMPORT_NS(ns); + +// Dummy rule for report mode that would otherwise be empty and make spatch +// fail ("No rules apply.") +@script:python depends on report@ +@@
scripts/nsdeps +1 -1
@@ -29,7 +29,7 @@ fi generate_deps_for_ns() { $SPATCH --very-quiet --in-place --sp-file \ - $srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2 + $srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=$1 $2 } generate_deps() {
Signature · 1 line
2.27.0.rc2.251.g90737beb825-goog
Quoted 16 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and replace if that rule has been explicitly requested.
In order to make spatch happy in report mode, we also need a dummy rule, as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up with.
Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.
Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>
Shuah reported the problem to me, so you could add
Quoted 51 lines
--- scripts/coccinelle/misc/add_namespace.cocci | 8 +++++++- scripts/nsdeps | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-)scripts/coccinelle/misc/add_namespace.cocci +7
-1@@ -6,6 +6,7 @@ /// add a missing namespace tag to a module source file. /// +virtual nsdeps virtual report @has_ns_import@@@ -16,10 +17,15 @@ MODULE_IMPORT_NS(ns); // Add missing imports, but only adjacent to a MODULE_LICENSE statement. // That ensures we are adding it only to the main module source file. -@do_import depends on !has_ns_import@ +@do_import depends on !has_ns_import && nsdeps@ declarer name MODULE_LICENSE; expression license; identifier virtual.ns; @@ MODULE_LICENSE(license); + MODULE_IMPORT_NS(ns); + +// Dummy rule for report mode that would otherwise be empty and make spatch +// fail ("No rules apply.") +@script:python depends on report@ +@@scripts/nsdeps +1
-2@@ -29,7 +29,7 @@ fi generate_deps_for_ns() { $SPATCH --very-quiet --in-place --sp-file \ - $srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2 + $srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=$1 $2 } generate_deps() { --2.27.0.rc2.251.g90737beb825-goog
Quoted 28 lines · Julia Lawall
Quoted 16 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and replace if that rule has been explicitly requested.
In order to make spatch happy in report mode, we also need a dummy rule, as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up with.
Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>
Quoted 6 lines
Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Reported-by Shuah Khan <[email protected]>
Very cool. No errors with this patch. Thanks for fixing it quickly.
thanks,
-- Shuah
Matthias Maennich
maintainerQuoted 31 lines · Shuah Khan
Quoted 30 lines · Julia Lawall
Quoted 16 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and replace if that rule has been explicitly requested.
In order to make spatch happy in report mode, we also need a dummy rule, as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up with.
Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>
Quoted 7 lines
Quoted 4 lines
Shuah reported the problem to me, so you could add
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Is somebody willing to take this patch through their tree?
Cheers,
Matthias
Quoted 6 lines
thanks,
-- Shuah
Julia Lawall
maintainerQuoted 34 lines · Matthias Maennich
Quoted 33 lines · Shuah Khan
Quoted 32 lines · Julia Lawall
Quoted 16 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and replace if that rule has been explicitly requested.
In order to make spatch happy in report mode, we also need a dummy rule, as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up with.
Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Yes, that would be fine.
julia
Quoted 13 lines
Is somebody willing to take this patch through their tree?
Cheers,
MatthiasQuoted 6 lines
thanks,
-- Shuah
Shuah Khan
Tested-byQuoted 34 lines · Matthias Maennich
Quoted 33 lines · Shuah Khan
Quoted 32 lines · Julia Lawall
Quoted 16 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and replace if that rule has been explicitly requested.
In order to make spatch happy in report mode, we also need a dummy rule, as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up with.
Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Yes
Quoted 3 lines
Is somebody willing to take this patch through their tree?
My guess is that these go through kbuild git??
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 48 lines · Shuah Khan
Quoted 38 lines · Matthias Maennich
Quoted 37 lines · Shuah Khan
Quoted 36 lines · Julia Lawall
Quoted 20 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and
replace if that rule has been explicitly requested.In order to make spatch happy in report mode, we also need a dummy rule,
as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up
with.Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Quoted 8 lines
Yes
Tested-by Shuah Khan <[email protected]>Quoted 3 lines
Is somebody willing to take this patch through their tree?
My guess is that these go through kbuild git??
If you want to take this, that's fine with me. But as I had the original file come through my tree, I can take it too. It's up to you, either is ok with me.
thanks
greg k-h
Quoted 53 lines · Greg Kroah-Hartman
Quoted 52 lines · Shuah Khan
Quoted 38 lines · Matthias Maennich
Quoted 37 lines · Shuah Khan
Quoted 36 lines · Julia Lawall
Quoted 20 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and
replace if that rule has been explicitly requested.In order to make spatch happy in report mode, we also need a dummy rule,
as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up
with.Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Yes
Tested-by Shuah Khan <[email protected]>Quoted 1 line
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Is somebody willing to take this patch through their tree?
My guess is that these go through kbuild git??
If you want to take this, that's fine with me. But as I had the original file come through my tree, I can take it too. It's up to you, either is ok with me.
Great. Please take this through your tree.
thanks,
-- Shuah
Quoted 57 lines · Shuah Khan
Quoted 56 lines · Greg Kroah-Hartman
Quoted 55 lines · Shuah Khan
Quoted 38 lines · Matthias Maennich
Quoted 37 lines · Shuah Khan
Quoted 36 lines · Julia Lawall
Quoted 20 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and
replace if that rule has been explicitly requested.In order to make spatch happy in report mode, we also need a dummy rule,
as otherwise it errors out with "No rules apply". Using a script:python rule appears unrelated and odd, but this is the shortest I could come up
with.Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 7 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Yes
Tested-by Shuah Khan <[email protected]>Quoted 3 lines
Is somebody willing to take this patch through their tree?
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
My guess is that these go through kbuild git??
If you want to take this, that's fine with me. But as I had the original file come through my tree, I can take it too. It's up to you, either is ok with me.
Great. Please take this through your tree.
Greg! Looks like this one didn't make it in. Can you pick this up?
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 67 lines · Shuah Khan
Quoted 66 lines · Shuah Khan
Quoted 64 lines · Greg Kroah-Hartman
Quoted 50 lines · Shuah Khan
Quoted 40 lines · Matthias Maennich
Quoted 39 lines · Shuah Khan
Quoted 38 lines · Julia Lawall
Quoted 21 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and
replace if that rule has been explicitly requested.In order to make spatch happy in report mode, we also need a dummy rule,
as otherwise it errors out with "No rules
apply". Using a script:python
rule appears unrelated and odd, but this is the shortest I could come up
with.Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 8 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace:Fix coccicheck failed")
Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Quoted 8 lines
Yes
Tested-by Shuah Khan <[email protected]>Quoted 3 lines
Is somebody willing to take this patch through their tree?
My guess is that these go through kbuild git??
If you want to take this, that's fine with me. But as I had the original file come through my tree, I can take it too. It's up to you, either is ok with me.
Quoted 4 lines
Quoted 2 lines
Great. Please take this through your tree.
Greg! Looks like this one didn't make it in. Can you pick this up?
I think this is 55c7549819e4 ("scripts: add dummy report mode to add_namespace.cocci") in Linus's tree right now, right?
thanks,
greg k-h
Quoted 68 lines · Greg Kroah-Hartman
Quoted 67 lines · Shuah Khan
Quoted 66 lines · Shuah Khan
Quoted 64 lines · Greg Kroah-Hartman
Quoted 50 lines · Shuah Khan
Quoted 40 lines · Matthias Maennich
Quoted 39 lines · Shuah Khan
Quoted 38 lines · Julia Lawall
Quoted 21 lines · Matthias Maennich
When running
make coccicheckin report mode using theadd_namespace.coccifile, it will fail for files that containMODULE_LICENSE. Those match the replacement precondition, but spatch errors out as virtual.ns is not set.In order to fix that, add the virtual rule nsdeps and only do search and
replace if that rule has been explicitly requested.In order to make spatch happy in report mode, we also need a dummy rule,
as otherwise it errors out with "No rules
apply". Using a script:python
rule appears unrelated and odd, but this is the shortest I could come up
with.Adjust
scripts/nsdepsaccordingly to set the nsdeps rule when run troughmake nsdeps.Quoted 8 lines
Suggested-by Julia Lawall <[email protected]>Fixes c7c4e29fb5a4 ("scripts: add_namespace:Fix coccicheck failed")
Cc YueHaibing <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Acked-by Julia Lawall <[email protected]>Shuah reported the problem to me, so you could add
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Shuah Khan <[email protected]>Very cool. No errors with this patch. Thanks for fixing it quickly.
I am happy I could fix that and thanks for confirming. I assume your Tested-by could be added?
Quoted 8 lines
Yes
Tested-by Shuah Khan <[email protected]>Quoted 3 lines
Is somebody willing to take this patch through their tree?
My guess is that these go through kbuild git??
If you want to take this, that's fine with me. But as I had the original file come through my tree, I can take it too. It's up to you, either is ok with me.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Great. Please take this through your tree.
Greg! Looks like this one didn't make it in. Can you pick this up?
I think this is
55c7549819e4("scripts: add dummy report mode toadd_namespace.cocci") in Linus's tree right now, right?
Yes. It is in Linux 5.9. I was looking in the wrong place on Linux 5.8. :(
thanks,
-- Shuah