Re: [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops

From: Steven Rostedt
Date: Mon Mar 22 2021 - 18:01:20 EST


On Mon, 22 Mar 2021 22:49:58 +0100
Arnd Bergmann <arnd@xxxxxxxxxx> wrote:

> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> With 'make W=1', gcc warns about casts between incompatible function
> types:
>
> kernel/trace/ftrace.c:128:31: error: cast between incompatible function types from 'void (*)(long unsigned int, long unsigned int)' to 'void (*)(long unsigned int, long unsigned int, struct ftrace_ops *, struct ftrace_regs *)' [-Werror=cast-function-type]
> 128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
> | ^
>
> As the commet here explains, this one was intentional, so shut up the
> warning harder by using a double cast.

Bonus points for reading the comment ;-)

I'll take this patch for the next merge window, thanks!

-- Steve