Hello all,

I've another Coccinelle question I'm hoping you can help me with.  The
codebase I'm working on is old, and has some interesting styles which
by themselves probably don't cause any problems, but newer C compilers
are now starting to flag them.

In particular, there seems to be a pattern in this code base of using
explicit `return;` statements at the end of void functions.  Here's an

static void broadcast_mini_icon(FvwmWindow *fw)
    if (!FMiniIconsSupported)
    if (fw->mini_pixmap_file && fw->mini_icon)
        BroadcastFvwmPicture( M_MINI_ICON, FW_W(fw),
            FW_W_FRAME(fw), (unsigned long)fw,
            fw->mini_icon, fw->mini_pixmap_file);

Here you can see the last return statement is not necessary.

I'm trying to make coccinelle recognise this and remove such cases.
Here's what I've tried:

identifier f;

void f(...) {
- return;


... which sort of works, but proceeds to remove *all* `return;`
statements from void functions, rather than the last occurance in the

Am I on the right track with this approach, or do I need to do
something more creative?

Thanks once more for your help.

Cocci mailing list

Reply via email to