macro version of __func__ ?

jim.cromie at jim.cromie at
Tue Aug 3 14:43:20 EDT 2021

hi all,

there are many uses of :
  pr_debug("%s ...\n", __func__, ...)

I tried to do a preprocessor catenation to replace the runtime work,
but that falls afoul of the def.

from gnu gcc web-page:

The identifier __func__ is implicitly declared by the translator as
if, immediately following the opening brace of each function
definition, the declaration

static const char __func__[] = "function-name";

These identifiers are variables, not preprocessor macros, and may not
be used to initialize char arrays or be concatenated with string

is there a kernel macro version that would allow this "optimization" ?

More information about the Kernelnewbies mailing list