Re: [Cocci] Red Hat Women in open source award

2016-02-21 Thread Mansour Moufid
Voted. Best of luck, I hope you win! ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

[Cocci] how to ignore a list of identifiers

2017-07-14 Thread Mansour Moufid
Hi everyone, I'm trying to add the const qualifier to variables of a certain type, except for a few. For example, I'd like to modify this program: void foo(void) { int a = 1; int b = 2; int c = 3; int d = 4; } to: void foo(void) { const int

Re: [Cocci] Adjusting replacement lists with SmPL?

2020-10-24 Thread Mansour Moufid
On Fri, Oct 23, 2020 at 11:00 AM Markus Elfring wrote: > > > I'd like to add a statement after another within a preprocessor expression, > > How do you think about to refer to a “#define directive”? I mean, not specifically in the #define, but anywhere. (I don't try to patch preprocessor

[Cocci] Newline escape in preprocessor

2020-10-22 Thread Mansour Moufid
Hi, I'd like to add a statement after another within a preprocessor expression, but spatch adds the line without an escape (backslash). x.c: #define X(a) x(a); (I know the above is not technically correct but it's super common.) x.cocci: @@ expression e; @@ x(e);

Re: [Cocci] qualified function rule

2021-01-29 Thread Mansour Moufid
On Wed, Jan 27, 2021 at 3:23 PM James K. Lowden wrote: > > I don't understand how, if it's possible, to qualify a function in a > rule. I want the class of all functions having a parameter of a > particular type. > > The code I'm working with has hundreds of unnecessary casts. Many > functions

Re: [Cocci] changing of_get_mac_address() to pass a buffer

2021-04-04 Thread Mansour Moufid
On Thu, Apr 1, 2021 at 4:13 AM Michael Walle wrote: > > Hi, > > so first I need to say I've never used coccinelle before, > so please bear with me ;) > > To make of_get_mac_address() work with DSA ports (and a nvmem > provider) I'd need to change the semantics of of_get_mac_address(). > Right now

Re: [Cocci] Replacing a struct member with a function call

2021-03-15 Thread Mansour Moufid
On Sun, Mar 14, 2021, 20:43 Thomas Adam wrote: > Hello, > > I can see I was as clear as mud with my explanation -- apologies for > that, so let me try again. > > In my original example: > > struct monitor { > struct { > int width; > int height > } virtual; > }; > > ...

Re: [Cocci] linux-kernel janitorial RFP: Mark static arrays as const

2021-03-03 Thread Mansour Moufid
On Tue, Mar 2, 2021 at 4:22 PM Joe Perches wrote: > > Here is a possible opportunity to reduce data usage in the kernel. > > $ git grep -P -n '^static\s+(?!const|struct)(?:\w+\s+){1,3}\w+\s*\[\s*\]' > drivers/ | \ > grep -v __initdata | \ > wc -l > 3250 > > Meaning there are ~3000

Re: [Cocci] how to make substitutions at the end of the function, vs. the end of the block ?

2021-07-31 Thread Mansour Moufid
On Fri, Jul 30, 2021 at 7:00 AM Andrew  Yourtchenko wrote: > > However, when I run it, the "done: " label, etc. gets inserted twice: Every return statement is the end of a function. ;) I don't know of a way to match only the "last" return statement in a function, maybe with scripting...