]> git.ipfire.org Git - thirdparty/bind9.git/commit
Add semantic patch to find void f() { ... return ((void)g())); ... }
authorOndřej Surý <ondrej@isc.org>
Fri, 6 Dec 2019 12:29:04 +0000 (13:29 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Fri, 6 Dec 2019 12:42:18 +0000 (13:42 +0100)
commit9dfa33050b00cf4d5103181ebddc517a2a99d9e8
tree288440cbd47ddafcbdaaa7bb46ab64c5d3433c9d
parent60fa5fc7604350b2e8e972e73376cb6c9410fe20
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.
cocci/return-void-from-void.spatch [new file with mode: 0644]