Patchset to make __func__ more visible

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Nov 4 02:34:06 MST 2013


On Mon, Nov 04, 2013 at 10:30:02AM +0100, Volker Lendecke wrote:
> On Mon, Nov 04, 2013 at 10:27:46AM +0100, Stefan (metze) Metzmacher wrote:
> > 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
> > provides
> > it's __func__ or ("") as fallback.
> 
> __func__ is shorter :-)

Ah, and it's standard these days. I'd rather #define
__func__ in lib/replace if it's not there. At one point we
changed True/False to true/false for similar reasons if I
remember correctly.

Volker

-- 
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 mailing list