Patchset to make __func__ more visible
abartlet at samba.org
Mon Nov 4 02:23:05 MST 2013
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.
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"
Thanks for bringing this back up again. We really do need to fix it
properly, once and for all.
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
More information about the samba-technical