mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 01:59:26 +00:00
Add semantic patch to find void f() { ... return ((void)g())); ... }
When a function returns void, it can be used as an argument to return in function returning also void, e.g.: void in(void) { return; } void out(void) { return (in()); } while this is legal, it should be rewritten as: void out(void) { in(); return; } The semantic patch just find the occurrences, and they need to be fixed by hand.
This commit is contained in:
parent
60fa5fc760
commit
9dfa33050b
19
cocci/return-void-from-void.spatch
Normal file
19
cocci/return-void-from-void.spatch
Normal file
@ -0,0 +1,19 @@
|
||||
@ rule1 @
|
||||
identifier f1;
|
||||
@@
|
||||
|
||||
void f1(...)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
@ rule2 @
|
||||
identifier rule1.f1;
|
||||
identifier f2;
|
||||
@@
|
||||
|
||||
void f2(...) {
|
||||
...
|
||||
* return(f1(...));
|
||||
...
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user