Re: macro version of __func__ ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try

#undef pr_fmt
#define pr_fmt(fmt)    "%s.c:%d: %s " fmt, __FILE__, __LINE__, __func__


On Tue, 3 Aug 2021 at 21:44, <jim.cromie@xxxxxxxxx> 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
> literals.
>
>
> is there a kernel macro version that would allow this "optimization" ?
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
Constantine Shulyupin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux