[Cocci] Regression since recent parentypes patches were merged

2020-05-12 Thread Christoph Böhmwalder
be any more specific. Anyways, is this a bug? Or was I doing something wrong in the first place? Thanks and best regards, -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage ___ Cocci ma

Re: [Cocci] Matching against a declarer macro

2020-03-29 Thread Christoph Böhmwalder
ble. If not, I guess we can probably just live with the workaround. julia Thanks yet again for all your help. -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage ___ Cocc

Re: [Cocci] Matching against a declarer macro

2020-03-29 Thread Christoph Böhmwalder
metavariable. Right, I do want to exactly match NODE_END, so I removed the declaration; still no match though. If it is detected as a known macro it should be able to be substituted, right? julia Thanks, -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recov

Re: [Cocci] Matching against a declarer macro

2020-03-29 Thread Christoph Böhmwalder
Am 27.03.20 um 17:15 schrieb Julia Lawall: On Fri, 27 Mar 2020, Christoph Böhmwalder wrote: Am 27.03.20 um 16:47 schrieb Julia Lawall:> Are you sure that the C code is parsed successfully? I'm not at all sure that static is allowed in an argument list. Types are allowed, bu static is o

Re: [Cocci] Matching against a declarer macro

2020-03-27 Thread Christoph Böhmwalder
Am 27.03.20 um 16:47 schrieb Julia Lawall:> Are you sure that the C code is parsed successfully? I'm not at all sure that static is allowed in an argument list. Types are allowed, bu static is only part of a type. I'm pretty sure it is parsed successfully. At least spatch doesn't complain

[Cocci] Matching against a declarer macro

2020-03-27 Thread Christoph Böhmwalder
to solve this would be appreciated, thanks! -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA —  Disaster Recovery — Software defined Storage ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

Re: [Cocci] const in parameter lists

2019-09-12 Thread Christoph Böhmwalder
to answer your question -- my priority here is to get the code compiling; I don't actually care about any of the consts. Best case scenario would be to have it remove whether or not the consts are there and always add the new parameter with a const. -- Christoph Böhmwalder LINBIT | Keeping the Digita

[Cocci] Remove entire multidecl

2019-08-08 Thread Christoph Böhmwalder
; + Not exactly what I expected... Thanks, -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo

Re: [Cocci] Make rule depend on comment

2019-08-05 Thread Christoph Böhmwalder
I'm not sure if this is objectively the best solution, but it seems the most logical to me. I'd be glad to hear any input you might have regarding this. Again, thanks for all the help! -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running D

[Cocci] Make rule depend on comment

2019-08-02 Thread Christoph Böhmwalder
make the rule depend on the comment being there? Thanks, -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

Re: [Cocci] spatch inserting the following rule into the patch

2019-07-22 Thread Christoph Böhmwalder
he Ubuntu repos would be appropriate? Thanks, Christoph -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

[Cocci] spatch inserting the following rule into the patch

2019-07-19 Thread Christoph Böhmwalder
the __attribute__ in the first rule *and* the function call as an argument in the second rule, if I remove either of those the patch works as intended. Regards, Christoph -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage

[Cocci] Indentation when adding an if

2019-06-03 Thread Christoph Böhmwalder
Hi, Consider the following C code and cocci patch: #include int x; int main(int argc, char **argv) { if (y) do_something(x); } @@ identifier x; @@ - do_something(x); + if (x) + do_one_thing(); + else + do_another_thing(); For this input, spatch produces the

Re: [Cocci] Checking change scope for a data type replacement

2019-05-27 Thread Christoph Böhmwalder
On 27.05.19 16:16, Markus Elfring wrote: Am I missing something? It depends on details. Your initial transformation approach can be written also as follows. @replacement@ identifier x; @@ -int +int* x; > In which scopes would you like to add the asterisk for the usage of a pointer data

[Cocci] Are types re-evaluated between subsequent rules?

2019-05-27 Thread Christoph Böhmwalder
Hi, I'm having trouble understanding coccinelles behaviour here. Consider the following C code and cocci rules: #include int x; int main(int argc, char **argv) { f(x); } @@ identifier x; @@ - int x; + int *x; @@ int *x; @@ - f(x) + g(x) Since I read on some slides[0] that "Later

[Cocci] "depends on" per file

2019-05-24 Thread Christoph Böhmwalder
Hi, I'm trying to replace a function with a one-liner, where the one-liner has a dependency on a header file that the function doesn't. Now I want to include said header file iff it isn't already included in the affected file. In more concrete terms, this is my script: @ find_linux_dcache_h @

Re: [Cocci] Does coccinelle support non-standard C?

2019-05-22 Thread Christoph Böhmwalder
On 22.05.19 13:55, Julia Lawall wrote: On Wed, 22 May 2019, Christoph Böhmwalder wrote: On 22.05.19 13:37, Julia Lawall wrote: Is it always exactly this string that you want to add? In my case, yes. I don't have any metavariable substitutions, etc; it's always the same constant code

Re: [Cocci] Does coccinelle support non-standard C?

2019-05-22 Thread Christoph Böhmwalder
On 22.05.19 13:37, Julia Lawall wrote: Is it always exactly this string that you want to add? In my case, yes. I don't have any metavariable substitutions, etc; it's always the same constant code. -- Regards, Christoph ___ Cocci mailing list

[Cocci] Does coccinelle support non-standard C?

2019-05-22 Thread Christoph Böhmwalder
Hi, Consider the following snippet of C: #define f() ({ puts("hello"); 0; }) int main() { printf("%d\n", f()); } It uses an expression statement in the definition of `f`, which is a gcc extension. Now let's try to write a semantic patch to generate something like this: @@ @@ -