* coccicheck: Add M= option
@ 2011-06-08 3:29 Greg Dietsche
2011-06-08 3:29 ` [PATCH 1/2] coccicheck: add M= option to control which dir is processed Greg Dietsche
2011-06-08 3:29 ` [PATCH 2/2] coccinelle.txt: update documentation to include M= option Greg Dietsche
0 siblings, 2 replies; 11+ messages in thread
From: Greg Dietsche @ 2011-06-08 3:29 UTC (permalink / raw)
To: julia; +Cc: rdunlap, Gilles.Muller, npalix.work, cocci, linux-doc, linux-kernel
This patch set adds support for M= to coccicheck. This makes
using Coccinelle easier for those wishing to check specific
drivers or sub systems with Coccinelle.
Thanks!
Greg
[PATCH 1/2] coccinelle.txt update documentation to include M= option
[PATCH 2/2] coccicheck: add M option to control which dir is processed
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] coccicheck: add M= option to control which dir is processed
2011-06-08 3:29 coccicheck: Add M= option Greg Dietsche
@ 2011-06-08 3:29 ` Greg Dietsche
2011-06-08 19:00 ` Greg Dietsche
2011-06-08 3:29 ` [PATCH 2/2] coccinelle.txt: update documentation to include M= option Greg Dietsche
1 sibling, 1 reply; 11+ messages in thread
From: Greg Dietsche @ 2011-06-08 3:29 UTC (permalink / raw)
To: julia
Cc: rdunlap, Gilles.Muller, npalix.work, cocci, linux-doc,
linux-kernel, Greg Dietsche
Examples:
make coccicheck M=drivers/net/wireless/
make coccicheck SUBDIRS=drivers/net/wireless/
Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
---
scripts/coccicheck | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 1bb1a1b..6f08efa 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -10,13 +10,22 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
# OPTIONS=$*
# Workaround for Coccinelle < 0.2.3
- FLAGS="-I $srctree/include -very_quiet"
+ if [ "$KBUILD_EXTMOD" = "" ] ; then
+ FLAGS="-I $srctree/include -very_quiet"
+ else
+ echo 'M= is only supported for Coccinelle >= 0.2.3'
+ exit 1
+ fi
shift $(( $# - 1 ))
OPTIONS=$1
else
ONLINE=0
FLAGS="-very_quiet"
- OPTIONS="-dir $srctree"
+ if [ "$KBUILD_EXTMOD" = "" ] ; then
+ OPTIONS="-dir $srctree"
+ else
+ OPTIONS="-dir $KBUILD_EXTMOD"
+ fi
fi
if [ ! -x "$SPATCH" ]; then
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] coccinelle.txt: update documentation to include M= option
2011-06-08 3:29 coccicheck: Add M= option Greg Dietsche
2011-06-08 3:29 ` [PATCH 1/2] coccicheck: add M= option to control which dir is processed Greg Dietsche
@ 2011-06-08 3:29 ` Greg Dietsche
1 sibling, 0 replies; 11+ messages in thread
From: Greg Dietsche @ 2011-06-08 3:29 UTC (permalink / raw)
To: julia
Cc: rdunlap, Gilles.Muller, npalix.work, cocci, linux-doc,
linux-kernel, Greg Dietsche
Adding documentation for the new M= option which limits Coccinelle
to a specific set of directories.
Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
---
Documentation/coccinelle.txt | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt
index 96b6903..cf44eb6 100644
--- a/Documentation/coccinelle.txt
+++ b/Documentation/coccinelle.txt
@@ -102,9 +102,15 @@ or
make coccicheck COCCI=<my_SP.cocci> MODE=report
- Using Coccinelle on (modified) files
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Controlling Which Files are Processed by Coccinelle
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+By default the entire kernel source tree is checked.
+
+To apply Coccinelle to a specific directory, M= can be used.
+For example, to check drivers/net/wireless/ one may write:
+ make coccicheck M=drivers/net/wireless/
+
To apply Coccinelle on a file basis, instead of a directory basis, the
following command may be used:
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] coccicheck: add M= option to control which dir is processed
2011-06-08 3:29 ` [PATCH 1/2] coccicheck: add M= option to control which dir is processed Greg Dietsche
@ 2011-06-08 19:00 ` Greg Dietsche
2011-06-08 19:10 ` Nicolas Palix
0 siblings, 1 reply; 11+ messages in thread
From: Greg Dietsche @ 2011-06-08 19:00 UTC (permalink / raw)
To: Greg Dietsche
Cc: julia, rdunlap, Gilles.Muller, npalix.work, cocci, linux-doc,
linux-kernel
On 06/07/2011 10:29 PM, Greg Dietsche wrote:
> Examples:
> make coccicheck M=drivers/net/wireless/
> make coccicheck SUBDIRS=drivers/net/wireless/
>
> Signed-off-by: Greg Dietsche<Gregory.Dietsche@cuw.edu>
> ---
> scripts/coccicheck | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 1bb1a1b..6f08efa 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -10,13 +10,22 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
> # OPTIONS=$*
>
> # Workaround for Coccinelle< 0.2.3
> - FLAGS="-I $srctree/include -very_quiet"
> + if [ "$KBUILD_EXTMOD" = "" ] ; then
> + FLAGS="-I $srctree/include -very_quiet"
> + else
> + echo 'M= is only supported for Coccinelle>= 0.2.3'
> + exit 1
> + fi
> shift $(( $# - 1 ))
> OPTIONS=$1
> else
> ONLINE=0
> FLAGS="-very_quiet"
> - OPTIONS="-dir $srctree"
> + if [ "$KBUILD_EXTMOD" = "" ] ; then
> + OPTIONS="-dir $srctree"
> + else
> + OPTIONS="-dir $KBUILD_EXTMOD"
>
So far I've found one bug after reading Nicolas's comments on the other
thread. In order to have the diffs print file names correctly, I
definitely need to update my patch to do this:
+ OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree"
Also, do I need to tell cocci where the includes are? Based on my somewhat limited knowledge and testing, I'm not sure... but so far the tests seem to work without it. If we really do need to tell it about the includes, then the line should read:
+ OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include"
> + fi
> fi
>
> if [ ! -x "$SPATCH" ]; then
>
Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] coccicheck: add M= option to control which dir is processed
2011-06-08 19:00 ` Greg Dietsche
@ 2011-06-08 19:10 ` Nicolas Palix
2011-06-11 15:29 ` [PATCH 1/2 V2] " Greg Dietsche
2011-06-11 15:33 ` [PATCH 1/2] " Greg Dietsche
0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Palix @ 2011-06-08 19:10 UTC (permalink / raw)
To: Greg Dietsche
Cc: julia, rdunlap, Gilles.Muller, cocci, linux-doc, linux-kernel
Hi,
On Wed, Jun 8, 2011 at 9:00 PM, Greg Dietsche <gregory.dietsche@cuw.edu> wrote:
>
>
> On 06/07/2011 10:29 PM, Greg Dietsche wrote:
>>
>> Examples:
>> make coccicheck M=drivers/net/wireless/
>> make coccicheck SUBDIRS=drivers/net/wireless/
>>
>> Signed-off-by: Greg Dietsche<Gregory.Dietsche@cuw.edu>
>> ---
>> scripts/coccicheck | 13 +++++++++++--
>> 1 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/coccicheck b/scripts/coccicheck
>> index 1bb1a1b..6f08efa 100755
>> --- a/scripts/coccicheck
>> +++ b/scripts/coccicheck
>> @@ -10,13 +10,22 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
>> # OPTIONS=$*
>>
>> # Workaround for Coccinelle< 0.2.3
>> - FLAGS="-I $srctree/include -very_quiet"
>> + if [ "$KBUILD_EXTMOD" = "" ] ; then
>> + FLAGS="-I $srctree/include -very_quiet"
>> + else
>> + echo 'M= is only supported for Coccinelle>= 0.2.3'
>> + exit 1
>> + fi
>> shift $(( $# - 1 ))
>> OPTIONS=$1
>> else
>> ONLINE=0
>> FLAGS="-very_quiet"
>> - OPTIONS="-dir $srctree"
>> + if [ "$KBUILD_EXTMOD" = "" ] ; then
>> + OPTIONS="-dir $srctree"
>> + else
>> + OPTIONS="-dir $KBUILD_EXTMOD"
>>
>
> So far I've found one bug after reading Nicolas's comments on the other
> thread. In order to have the diffs print file names correctly, I definitely
> need to update my patch to do this:
>
> + OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree"
>
> Also, do I need to tell cocci where the includes are? Based on my somewhat
> limited knowledge and testing, I'm not sure... but so far the tests seem to
> work without it. If we really do need to tell it about the includes, then
> the line should read:
>
> + OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include"
I am not familiar with out-of-tree development but I guess that in
that case we should
also add a "-I $KBUILD_EXTMOD/include" ?
The use of -I by Coccinelle depends on the other options (like
-include_headers or -all_includes).
Such options are retrieved from the comments in the cocci files.
So the need for -I depends on the semantic patch you consider. I think
it is thus better
to be "exhaustive" in that case.
Julia, is there any performance problem in doing so ?
>
>
>
>> + fi
>> fi
>>
>> if [ ! -x "$SPATCH" ]; then
>>
>
> Greg
>
>
--
Nicolas Palix
http://sardes.inrialpes.fr/~npalix/
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2 V2] coccicheck: add M= option to control which dir is processed
2011-06-08 19:10 ` Nicolas Palix
@ 2011-06-11 15:29 ` Greg Dietsche
2011-06-11 15:33 ` [PATCH 1/2] " Greg Dietsche
1 sibling, 0 replies; 11+ messages in thread
From: Greg Dietsche @ 2011-06-11 15:29 UTC (permalink / raw)
To: julia
Cc: Nicolas.Palix, rdunlap, Gilles.Muller, cocci, linux-doc,
linux-kernel, Greg Dietsche
Examples:
make coccicheck M=drivers/net/wireless/
make coccicheck SUBDIRS=drivers/net/wireless/
Version 2:
fix patch file names when using M=
tell coccinelle where the include files are
Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
---
scripts/coccicheck | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 1bb1a1b..1ceecdf 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -10,13 +10,22 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
# OPTIONS=$*
# Workaround for Coccinelle < 0.2.3
- FLAGS="-I $srctree/include -very_quiet"
+ if [ "$KBUILD_EXTMOD" = "" ] ; then
+ FLAGS="-I $srctree/include -very_quiet"
+ else
+ echo 'M= is only supported for Coccinelle >= 0.2.3'
+ exit 1
+ fi
shift $(( $# - 1 ))
OPTIONS=$1
else
ONLINE=0
FLAGS="-very_quiet"
- OPTIONS="-dir $srctree"
+ if [ "$KBUILD_EXTMOD" = "" ] ; then
+ OPTIONS="-dir $srctree"
+ else
+ OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include"
+ fi
fi
if [ ! -x "$SPATCH" ]; then
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] coccicheck: add M= option to control which dir is processed
2011-06-08 19:10 ` Nicolas Palix
2011-06-11 15:29 ` [PATCH 1/2 V2] " Greg Dietsche
@ 2011-06-11 15:33 ` Greg Dietsche
2011-06-11 15:40 ` Julia Lawall
1 sibling, 1 reply; 11+ messages in thread
From: Greg Dietsche @ 2011-06-11 15:33 UTC (permalink / raw)
To: Nicolas Palix
Cc: julia, rdunlap, Gilles.Muller, cocci, linux-doc, linux-kernel
On 06/08/2011 02:10 PM, Nicolas Palix wrote:
> I am not familiar with out-of-tree development but I guess that in
> that case we should
> also add a "-I $KBUILD_EXTMOD/include" ?
>
>
I decided to skip doing this in V2 of the patch. I did a very quick test
and cocci didn't seem to like two -I flags on one command line.
> The use of -I by Coccinelle depends on the other options (like
> -include_headers or -all_includes).
> Such options are retrieved from the comments in the cocci files.
> So the need for -I depends on the semantic patch you consider. I think
> it is thus better
> to be "exhaustive" in that case.
>
> Julia, is there any performance problem in doing so ?
>
Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] coccicheck: add M= option to control which dir is processed
2011-06-11 15:33 ` [PATCH 1/2] " Greg Dietsche
@ 2011-06-11 15:40 ` Julia Lawall
2011-06-11 17:22 ` Greg Dietsche
0 siblings, 1 reply; 11+ messages in thread
From: Julia Lawall @ 2011-06-11 15:40 UTC (permalink / raw)
To: Greg Dietsche
Cc: Nicolas Palix, rdunlap, Gilles.Muller, cocci, linux-doc, linux-kernel
On Sat, 11 Jun 2011, Greg Dietsche wrote:
> On 06/08/2011 02:10 PM, Nicolas Palix wrote:
> > I am not familiar with out-of-tree development but I guess that in
> > that case we should
> > also add a "-I $KBUILD_EXTMOD/include" ?
> >
> >
> I decided to skip doing this in V2 of the patch. I did a very quick test and
> cocci didn't seem to like two -I flags on one command line.
What was the problem and what version of coccinelle do you have? To my
recollection, the ability to have multiple -I options was added sometime
not so long ago.
julia
> > The use of -I by Coccinelle depends on the other options (like
> > -include_headers or -all_includes).
> > Such options are retrieved from the comments in the cocci files.
> > So the need for -I depends on the semantic patch you consider. I think
> > it is thus better
> > to be "exhaustive" in that case.
> >
> > Julia, is there any performance problem in doing so ?
> >
>
> Greg
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] coccicheck: add M= option to control which dir is processed
2011-06-11 15:40 ` Julia Lawall
@ 2011-06-11 17:22 ` Greg Dietsche
2011-06-11 17:53 ` [PATCH 1/2 v3] " Greg Dietsche
0 siblings, 1 reply; 11+ messages in thread
From: Greg Dietsche @ 2011-06-11 17:22 UTC (permalink / raw)
To: Julia Lawall
Cc: Nicolas Palix, rdunlap, Gilles.Muller, cocci, linux-doc, linux-kernel
On 06/11/2011 10:40 AM, Julia Lawall wrote:
> On Sat, 11 Jun 2011, Greg Dietsche wrote:
>
>
>> On 06/08/2011 02:10 PM, Nicolas Palix wrote:
>>
>>> I am not familiar with out-of-tree development but I guess that in
>>> that case we should
>>> also add a "-I $KBUILD_EXTMOD/include" ?
>>>
>>>
>>>
>> I decided to skip doing this in V2 of the patch. I did a very quick test and
>> cocci didn't seem to like two -I flags on one command line.
>>
> What was the problem and what version of coccinelle do you have? To my
> recollection, the ability to have multiple -I options was added sometime
> not so long ago.
>
>
Hmm... my 'quick' test must have been bad. I just tested again with
0.2.3 (debian squeeze) and 1.0.0-rc3 and both seem to work just with
multiple -I options. As I recall, originally, the script just exited
with a code of 1 in my original test...
so the updated line really should read:
OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I
$KBUILD_EXTMOD/include"
I'll send an updated patch in a day or two. I've got some other stuff to
do today. Also, I noticed another bug that I'll need to fix too. The
lines in my patch that read:
echo 'M= is only supported for Coccinelle >= 0.2.3'
exit 1
are flat out wrong... :(
Greg
> julia
>
>
>>> The use of -I by Coccinelle depends on the other options (like
>>> -include_headers or -all_includes).
>>> Such options are retrieved from the comments in the cocci files.
>>> So the need for -I depends on the semantic patch you consider. I think
>>> it is thus better
>>> to be "exhaustive" in that case.
>>>
>>> Julia, is there any performance problem in doing so ?
>>>
>>>
>> Greg
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2 v3] coccicheck: add M= option to control which dir is processed
2011-06-11 17:22 ` Greg Dietsche
@ 2011-06-11 17:53 ` Greg Dietsche
2011-11-04 1:17 ` Greg Dietsche
0 siblings, 1 reply; 11+ messages in thread
From: Greg Dietsche @ 2011-06-11 17:53 UTC (permalink / raw)
To: julia
Cc: Nicolas.Palix, rdunlap, Gilles.Muller, cocci, linux-doc,
linux-kernel, Greg Dietsche
Examples:
make coccicheck M=drivers/net/wireless/
make coccicheck SUBDIRS=drivers/net/wireless/
Version 2:
fix patch file names when using M=
tell coccinelle where the include files are
Version 3:
Add second include option to support out of tree development
Fix error message
Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
---
scripts/coccicheck | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 1bb1a1b..3c27764 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -9,14 +9,23 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
# FLAGS="-ignore_unknown_options -very_quiet"
# OPTIONS=$*
-# Workaround for Coccinelle < 0.2.3
- FLAGS="-I $srctree/include -very_quiet"
- shift $(( $# - 1 ))
- OPTIONS=$1
+ if [ "$KBUILD_EXTMOD" = "" ] ; then
+ # Workaround for Coccinelle < 0.2.3
+ FLAGS="-I $srctree/include -very_quiet"
+ shift $(( $# - 1 ))
+ OPTIONS=$1
+ else
+ echo M= is not currently supported when C=1 or C=2
+ exit 1
+ fi
else
ONLINE=0
FLAGS="-very_quiet"
- OPTIONS="-dir $srctree"
+ if [ "$KBUILD_EXTMOD" = "" ] ; then
+ OPTIONS="-dir $srctree"
+ else
+ OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include"
+ fi
fi
if [ ! -x "$SPATCH" ]; then
--
1.7.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2 v3] coccicheck: add M= option to control which dir is processed
2011-06-11 17:53 ` [PATCH 1/2 v3] " Greg Dietsche
@ 2011-11-04 1:17 ` Greg Dietsche
0 siblings, 0 replies; 11+ messages in thread
From: Greg Dietsche @ 2011-11-04 1:17 UTC (permalink / raw)
To: Greg Dietsche
Cc: julia, Nicolas.Palix, rdunlap, Gilles.Muller, cocci, linux-doc,
linux-kernel
On 06/11/2011 12:53 PM, Greg Dietsche wrote:
> Examples:
> make coccicheck M=drivers/net/wireless/
> make coccicheck SUBDIRS=drivers/net/wireless/
>
> Version 2:
> fix patch file names when using M=
> tell coccinelle where the include files are
>
> Version 3:
> Add second include option to support out of tree development
> Fix error message
>
> Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
> ---
> scripts/coccicheck | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 1bb1a1b..3c27764 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -9,14 +9,23 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
> # FLAGS="-ignore_unknown_options -very_quiet"
> # OPTIONS=$*
>
> -# Workaround for Coccinelle < 0.2.3
> - FLAGS="-I $srctree/include -very_quiet"
> - shift $(( $# - 1 ))
> - OPTIONS=$1
> + if [ "$KBUILD_EXTMOD" = "" ] ; then
> + # Workaround for Coccinelle < 0.2.3
> + FLAGS="-I $srctree/include -very_quiet"
> + shift $(( $# - 1 ))
> + OPTIONS=$1
> + else
> + echo M= is not currently supported when C=1 or C=2
> + exit 1
> + fi
> else
> ONLINE=0
> FLAGS="-very_quiet"
> - OPTIONS="-dir $srctree"
> + if [ "$KBUILD_EXTMOD" = "" ] ; then
> + OPTIONS="-dir $srctree"
> + else
> + OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include"
> + fi
> fi
>
> if [ ! -x "$SPATCH" ]; then
what's the process for getting this into the kernel tree?
Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-11-04 1:55 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 3:29 coccicheck: Add M= option Greg Dietsche
2011-06-08 3:29 ` [PATCH 1/2] coccicheck: add M= option to control which dir is processed Greg Dietsche
2011-06-08 19:00 ` Greg Dietsche
2011-06-08 19:10 ` Nicolas Palix
2011-06-11 15:29 ` [PATCH 1/2 V2] " Greg Dietsche
2011-06-11 15:33 ` [PATCH 1/2] " Greg Dietsche
2011-06-11 15:40 ` Julia Lawall
2011-06-11 17:22 ` Greg Dietsche
2011-06-11 17:53 ` [PATCH 1/2 v3] " Greg Dietsche
2011-11-04 1:17 ` Greg Dietsche
2011-06-08 3:29 ` [PATCH 2/2] coccinelle.txt: update documentation to include M= option Greg Dietsche
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).