Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread Julia Lawall
On Fri, 14 Oct 2016, SF Markus Elfring wrote: > > You can look at patches people have previously submitted and see to what > > extent there is interest in this issue. > > I see another software development challenge here. > > The discussed source code search pattern builds on a "general

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread SF Markus Elfring
> You can look at patches people have previously submitted and see to what > extent there is interest in this issue. I see another software development challenge here. The discussed source code search pattern builds on a "general function" like "seq_printf" as an update candidate from which each

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread Julia Lawall
On Fri, 14 Oct 2016, SF Markus Elfring wrote: > > But that should be fine for detecting eg if a string has only one character. > > Did you come along similar change possibilities at other places already? > > http://lxr.free-electrons.com/source/include/linux/seq_file.h?v=4.8#L114 > >

Re: [Cocci] [PATCH] Coccinelle: misc: Improve the script for more accurate results

2016-10-14 Thread Vaishali Thakkar
On Friday 14 October 2016 02:21 PM, Lars-Peter Clausen wrote: > On 10/13/2016 07:01 PM, Vaishali Thakkar wrote: >> >> >> On Thursday 13 October 2016 09:45 PM, Julia Lawall wrote: >>> >>> >>> On Thu, 13 Oct 2016, Vaishali Thakkar wrote: >>> Currently because of the left associativity of the

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread Julia Lawall
> * But I will also need a way to construct a source code change ("plus code" in > the semantic patch) with OCaml or Python scripting, won't I? If you need to do this, you can follow the examples in demos/camltococci.cocci and demos/pythontococci.cocci julia

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread SF Markus Elfring
> You can inherit and test properties of anything you like in python or > ocaml code. If you inherit some kind of metavariable other than a > position variable, the term will be represented as a string. But that > should be fine for detecting eg if a string has only one character. Your

Re: [Cocci] [PATCH] Coccinelle: misc: Improve the script for more accurate results

2016-10-14 Thread Lars-Peter Clausen
On 10/13/2016 07:01 PM, Vaishali Thakkar wrote: > > > On Thursday 13 October 2016 09:45 PM, Julia Lawall wrote: >> >> >> On Thu, 13 Oct 2016, Vaishali Thakkar wrote: >> >>> Currently because of the left associativity of the operators, >>> pattern IRQF_ONESHOT | flags does not match with the

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread Julia Lawall
> > coccinelle/demos/first.cocci may be helpful. > > I have got the impression that this small SmPL script demonstrates the usage > of the mentioned function from your software library only for a simple > position variable. > I do not see the way so far how desired data could be extracted from a

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread SF Markus Elfring
>> With which metavariables and corresponding programming interfaces can >> strings that >> are passed to such functions be checked in more detail by the Coccinelle >> software? > > The simplest would be to use python or ocaml code to make the checks that > are needed. You can use

Re: [Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread Julia Lawall
On Fri, 14 Oct 2016, SF Markus Elfring wrote: > Hello, > > I came during my software development activities along a few Linux source > files > where I got an advice by the script "checkpatch.pl" like the following. > > WARNING: Prefer seq_puts to seq_printf > >

[Cocci] Replacing calls of general functions by more specific ones with SmPL

2016-10-14 Thread SF Markus Elfring
Hello, I came during my software development activities along a few Linux source files where I got an advice by the script "checkpatch.pl" like the following. WARNING: Prefer seq_puts to seq_printf