Q: does spatch understand typeof?
Hello,
trivial example:
@r@ int x; @@ * x = 0;
C code:
void f(void)
{
int a;
__typeof__(a) b;
a = 0; // this matches
b = 0; // this doesn't
}is it correct?
Thanks,
Oleg.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 21 lines · Oleg Nesterov
Hello,
trivial example:
@r@ int x; @@ * x = 0;C code:
void f(void) { int a; __typeof__(a) b; a = 0; // this matches b = 0; // this doesn't }
Quoted 1 line
is it correct?
Yes, it doesn't currently understand typeof. If it's a big problem, it should be easy to fix.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 3 lines · Julia Lawall
Yes, it doesn't currently understand typeof. If it's a big problem, it should be easy to fix.
OK, thanks Julia.
Another question...
inc.h:
struct TTT { int mem; } *ptr;test.c:
#include "inc.h"
void func(void)
{
ptr->mem = 0;
}test.cocci:
@r@ struct TTT *p; @@ * p->mem
$ spatch --sp-file test.cocci test.c
(ONCE) Expected tokens mem TTT
Skipping: test.c
I tried to play with various --.*include.* options, but nothing seems to work unless I add "inc.h" to the command line explicitly.
Oleg.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 30 lines · Oleg Nesterov
Quoted 3 lines · Julia Lawall
Yes, it doesn't currently understand typeof. If it's a big problem, it should be easy to fix.
OK, thanks Julia.
Another question...
inc.h:struct TTT { int mem; } *ptr;
test.c:#include "inc.h" void func(void) { ptr->mem = 0; }
test.cocci:@r@ struct TTT *p; @@ * p->mem
Quoted 7 lines
$ spatch --sp-file test.cocci test.c(ONCE) Expected tokens mem TTT
Skipping:test.cI tried to play with various --.*include.* options, but nothing seems to work unless I add "
inc.h" to the command line explicitly.
The problem is that the file filtering happens before the parsing, and it is the parsing that finds the includes. You can disable the file filtering with --disable-worth-trying-opt.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 2 lines · Oleg Nesterov
Another question...
Oh, and another one ;)
http://coccinelle.lip6.fr/docs/main_grammar006.html mentions "typeof(expr/ctype)", but I failed to find any doc/example of how can it be used in SPL.
Could you explain it?
Oleg.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 5 lines · Julia Lawall
Quoted 2 lines · Oleg Nesterov
$ spatch --sp-file test.cocci test.c
Quoted 8 lines
Quoted 5 lines
(ONCE) Expected tokens mem TTT
Skipping:test.cI tried to play with various --.*include.* options, but nothing seems to work unless I add "
inc.h" to the command line explicitly.The problem is that the file filtering happens before the parsing, and it is the parsing that finds the includes.
Yes, thanks, this was clear to me,
Quoted 2 lines
You can disable the file
filtering with --disable-worth-trying-opt.
Heh. I swear, I even did
$ spatch --longhelp 2>&1 | grep disable
but apparently I can't read.
Thanks a lot!
Oleg.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 11 lines · Oleg Nesterov
Quoted 2 lines · Oleg Nesterov
Another question...
Oh, and another one ;)
http://coccinelle.lip6.fr/docs/main_grammar006.html mentions "typeof(expr/ctype)", but I failed to find any doc/example of how can it be used in SPL.
Could you explain it?
@@
@@
- typeof(foo) x;
That is, you can match against the above code. But there is no evaluation of what typeof(foo) actually means.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 17 lines · Oleg Nesterov
Quoted 5 lines · Julia Lawall
Quoted 2 lines · Oleg Nesterov
$ spatch --sp-file test.cocci test.cQuoted 8 lines
Quoted 5 lines
(ONCE) Expected tokens mem TTT
Skipping:test.cI tried to play with various --.*include.* options, but nothing seems to work unless I add "
inc.h" to the command line explicitly.The problem is that the file filtering happens before the parsing, and it is the parsing that finds the includes.
Yes, thanks, this was clear to me,
Quoted 8 lines
Quoted 2 lines
You can disable the file
filtering with --disable-worth-trying-opt.Heh. I swear, I even did
$ spatch --longhelp 2>&1 | grep disablebut apparently I can't read.
The name is not super intuitive, and is more tied to the code than the user intuition. I spent some time searching for -no- and for something about files.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci