Re: [PATCH 1/2] coccicheck: add M= option to control which dir is processed

From: Nicolas Palix
Date: Wed Jun 08 2011 - 15:10:10 EST


Hi,

On Wed, Jun 8, 2011 at 9:00 PM, Greg Dietsche <gregory.dietsche@xxxxxxx> 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@xxxxxxx>
>> ---
>> Â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/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/