Re: [Cocci] [PATCH -next] coccinelle: platform_get_irq: Fix parse error

2019-09-05 Thread Julia Lawall
On Fri, 6 Sep 2019, YueHaibing wrote: > When do coccicheck, I get this error: > > spatch -D report --no-show-diff --very-quiet --cocci-file > ./scripts/coccinelle/api/platform_get_irq.cocci --include-headers > --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include > -I

Re: [RFC PATCH] coccinelle: check for integer overflow in binary search

2019-09-05 Thread Markus Elfring
> +@@ > +( > + while (\(…\)) { … > + } It seems that compound statements are mainly checked for control flow statements by this source code search approach so far. Would you like to handle also single statements (without the curly brackets)? (Will additional SmPL disjunctions be needed then?) >

Re: [Cocci] Matching variable declarations

2019-09-05 Thread Valentin Schneider
On 05/09/2019 13:03, Julia Lawall wrote: >> I tried to write it as >> --- >> - T >> + int >> var >> ? = E >> ; >> --- >> but that doesn't seem to be a valid syntax. > > No. ? is restricted to complete statements. > Makes sense now that I'm looking at other snippets, thanks. >> >> >> Now, I'd

Re: [RFC PATCH] coccinelle: check for integer overflow in binary search

2019-09-05 Thread Markus Elfring
> +identifier l, h, m; Can expressions make sense for these metavariables? > +@@ > +( > + while (\(l < h\|l <= h\|(h - l) > 1\|(l + 1) < h\|l < (h - 1)\)) { > + ... > +( > + ((l + h)@p / c) > +| > + ((l + h)@p >> c) > +) > + ... > + } * I suggest again to look at further possibilities to

Re: [Cocci] Matching variable declarations

2019-09-05 Thread Julia Lawall
On Thu, 5 Sep 2019, Valentin Schneider wrote: > Hi, > > I'm trying to change the type of variables that match a certain rule. > Abstracting away this specific rule and only looking at coming up with a > rule to match variable declarations, I have a few newbie questions. > > Say I want to

[Cocci] Matching variable declarations

2019-09-05 Thread Valentin Schneider
Hi, I'm trying to change the type of variables that match a certain rule. Abstracting away this specific rule and only looking at coming up with a rule to match variable declarations, I have a few newbie questions. Say I want to replace all long declarations into ints, this simple rule seems to

Re: [Cocci] [RFC PATCH] coccinelle: check for integer overflow in binary search

2019-09-05 Thread Julia Lawall
On Thu, 5 Sep 2019, Denis Efremov wrote: > > > On 05.09.2019 09:20, Julia Lawall wrote: > > > > > > On Thu, 5 Sep 2019, Denis Efremov wrote: > > > >> This is an RFC. I will resend the patch after feedback. Currently > >> I'm preparing big patchset with bsearch warnings fixed. The rule will >

Re: [RFC PATCH] coccinelle: check for integer overflow in binary search

2019-09-05 Thread Denis Efremov
On 05.09.2019 09:20, Julia Lawall wrote: > > > On Thu, 5 Sep 2019, Denis Efremov wrote: > >> This is an RFC. I will resend the patch after feedback. Currently >> I'm preparing big patchset with bsearch warnings fixed. The rule will >> be a part of this patchset if it will be considered good

Re: [RFC PATCH] coccinelle: check for integer overflow in binary search

2019-09-05 Thread Julia Lawall
On Thu, 5 Sep 2019, Denis Efremov wrote: > This is an RFC. I will resend the patch after feedback. Currently > I'm preparing big patchset with bsearch warnings fixed. The rule will > be a part of this patchset if it will be considered good enough for > checking. > > There is a known integer