Patchset to make __func__ more visible
Volker.Lendecke at SerNet.DE
Mon Nov 4 02:29:33 MST 2013
On Mon, Nov 04, 2013 at 10:23:05PM +1300, Andrew Bartlett wrote:
> 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"
Does that really work everywhere? If I read the references
right, __func__ is equivalent to
static const char __func__ = "function-name";
Can we use this with auto-concatenation of adjacent strings?
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical