[sheepdog] [PATCH] move assert definition from util.h to logger.h

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Jul 12 07:23:30 CEST 2013


At Thu, 11 Jul 2013 16:31:08 +0800,
Liu Yuan wrote:
> 
> > 
> > Okay, so your message
> >   "Don't include <assert.h>, use logger.h for assert()"
> > is for the users who include both assert.h and logger.h, right?  The
> > user already includes logger.h, so the message "use logger.h" looks a
> > bit strange.
> > 
> > "Don't include assert.h and logger.h in the same source file." looks
> > straightforward and don't mislead the developer who don't want to use
> > logger.h.
> 
> Okay, but I think the main purpose of this message is stop users from including
> <assert.h>, no? There is not use case to include <assert.h> in sheep/collie/shepherd.

What I just thought was that writing "Don't include <assert.h>" into
the source code might mislead developers that we cannot use assert.h
at all even if we don't need logger.h.

BTW, I've found that sheepfs is also including logger.h because
strbuf.h includes logger.h.  Sheepfs can call panic() in
xmalloc/xzalloc/strbuf_*, and panic() depends on logger.h and
logger.c.  It's not easy to remove logger from sheepfs completely.

Rather than adding another #ifdef to avoid including logger.h from
sheepfs, I think allowing logger.h in sheepfs and using our assert
always is much simpler.

Thanks,

Kazutaka



More information about the sheepdog mailing list