>> @@
>> -rc = x;
>
> Replace by - lrc@rc = x;
I have constructed another test script for the semantic patch language.
@replacement@
expression x;
identifier rc;
local idexpression lrc;
@@
(
if (...)
-{
-lrc@rc = x;
return
- rc
+ x
;
-}
|
-lrc@rc = x;
return
- rc
+ x
;
)
@deletion@
identifier replacement.rc;
type t;
@@
-t rc;
... when != rc
Test result:
elfring@Sonne:~/Projekte/Linux/next-patched> spatch
~/Projekte/Coccinelle/janitor/move_code_to_return3.cocci
arch/arm64/kernel/ptrace.c
…
previous modification:
MINUS
>>> x
According to environment 2:
replacement.x -> PTR_ERR(bp)
replacement.rc -> id err
current modification:
MINUS
>>> x
According to environment 2:
replacement.x -> PTR_ERR(bp)
replacement.rc -> id err
exn while in timeout_function
replacement: already tagged token:
C code context
File "arch/arm64/kernel/ptrace.c", line 439, column 9, charpos = 10084
around = 'err',
whole content = return err;
Will any software improvements be needed around the application
of SmPL disjunctions for such a source code transformation approach?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci