On Fri, 1 Nov 2019, Ondřej Surý wrote:

> Hi Julia,
>
> thanks for the quick response.
>
> > On 1 Nov 2019, at 14:09, Julia Lawall <julia.law...@lip6.fr> wrote:
> >
> > This is not possible.  ... describes control-flow paths.  Nothing happens
> > after a return.  Your attempt above would match functions where all
> > control-flow paths end with return (ISC_R_SUCCESS);, even if some of those
> > returns are in if branches.
>
> I think that would be still fine, I mostly want the Coccinelle to select the 
> functions
> that need my attention and we also use Coccinelle in our CI pipelines, so we 
> don’t
> reintroduce the code we already cleaned up.
>
> So, if I could just mark the functions that *only* return ISC_R_SUCCESS 
> anywhere,
> it would be enough for my use case.  I would then go through the results by 
> hand
> and write a targeted spatch for every selected function.  That’s fine, even 
> though
> Coccinelle feels like a magic wand, I don’t expect it to be one.
>
> The spatch you sent ends up with:
>
> minus: parse error:
>   File "cocci/dummy.spatch", line 7, column 0, charpos = 50
>   around = 'foo',
>   whole content = foo(...) {

Sorry, you also need:

typedef isc_result_t;

in the metavariable list.

>
> BTW Coccinelle is such a great tool, it has helped with BIND 9
> refactoring so much, so thank you for working on that!

Nice to hear :) Thanks.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to