Patchset to make __func__ more visible

Stefan (metze) Metzmacher metze at
Mon Nov 4 02:27:46 MST 2013

Am 04.11.2013 10:23, schrieb Andrew Bartlett:
> On Mon, 2013-11-04 at 09:47 +0100, Volker Lendecke wrote:
>> On Mon, Nov 04, 2013 at 09:13:59PM +1300, Andrew Bartlett wrote:
>>> On Fri, 2013-11-01 at 13:11 +0100, Volker Lendecke wrote:
>>>> Hi!
>>>> Attached find 2 patches that fix faulty DEBUG statements in
>>>> one case by using __func__. I would like to see more use of
>>>> this throughout our code, so I added another patch putting a
>>>> hint into README.Coding.
>>> I thought we were going to just fix the debug macro?  Last I remember
>>> Jeremy had a patch, which mysteriously failed autobuild in some way. 
>> Ok. The fix would be to just remove all the function names
>> in DEBUG statements, right? Or do you want me to just fix it
>> and hard-code the now correct name again?
> First, I do totally agree that incorrect function names in debug
> statements are worse than useless, they are misleading and deceptive,
> and we should fix them. 
> The plan was, as I recall it:
>  - sort out DEBUG() to just do the right thing.  I think what we agreed
> was that was to always print the header, even in 'foreground' mode.  
>  - stop typing in the function name into new code
>  - clean up old code.

Yes, something like that.

> If for some reason we just can't get the first part of that plan to
> work, then using __func__ is quite a reasonable fallback, but it's
> probably best to use string pasting rather than %s eg: __func__ ": foo"

Shouldn't we use  __FUNCTION__ instead of __func__? That's what always
it's __func__ or ("") as fallback.


More information about the samba-technical mailing list