macro version of __func__ ?
constantine.shulyupin at gmail.com
Tue Aug 3 14:49:48 EDT 2021
#define pr_fmt(fmt) "%s.c:%d: %s " fmt, __FILE__, __LINE__, __func__
On Tue, 3 Aug 2021 at 21:44, <jim.cromie at gmail.com> wrote:
> 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" ?
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
More information about the Kernelnewbies