Re: [PATCH 1/4] dynamic_debug: consolidate repetitive struct_ddebug descriptor definitions

From: Andrew Morton
Date: Fri Sep 09 2011 - 00:17:04 EST


On Thu, 08 Sep 2011 21:02:43 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:

> On Thu, 2011-09-08 at 20:42 -0700, Andrew Morton wrote:
> > On Thu, 08 Sep 2011 19:13:16 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:
> > > On Thu, 2011-09-08 at 16:52 -0700, Andrew Morton wrote:
> > > > On Tue, 30 Aug 2011 14:28:41 -0400
> > > > Jason Baron <jbaron@xxxxxxxxxx> wrote:
> > > > > Replace the repetitive struct _ddebug descriptor definitions with
> > > > > a new DECLARE_DYNAMIC_DEBUG_META_DATA(name, fmt) macro.
> > > > > +#define DECLARE_DYNAMIC_DEBUG_METADATA(name, fmt) \
> > > > > + static struct _ddebug __used __aligned(8) \
> > > > > + __attribute__((section("__verbose"))) name = { \
> > > > > + .modname = KBUILD_MODNAME, \
> > > > > + .function = __func__, \
> > > > > + .filename = __FILE__, \
> > > > > + .format = (fmt), \
> > > > > + .lineno = __LINE__, \
> > > > > + .flags = _DPRINTK_FLAGS_DEFAULT, \
> > > > > + .enabled = false, \
> > > > > + }
> > > > <anal>That macro implements a definition, not a declaration</anal>
> > > Andrew, that's not quite true
> > It's precisely true.
>
> Not according to the c99 standard section 6.7
>

That doesn't address the distinction at all - it discusses syntax.

The reason the distinction matters (apart from being just wrong) is
that sometimes we want a macro for the definition and another for the
declaration. DEFINE_TRACE/DECLARE_TRACE, DECLARE_LGLOCK/DEFINE_LGLOCK,
etc.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/