RE: [PATCHv1 008/211] unicore32: new file arch/unicore32/boot/compressed/misc.c

From: Guan Xuetao
Date: Mon Dec 13 2010 - 01:50:43 EST



> > > > +/* Diagnostic functions */
> > > > +#ifdef DEBUG
> > > > +# define Assert(cond, msg) { if (!(cond)) error(msg); }
> > > > +# define Trace(x) fprintf x
> > > > +# define Tracev(x) { if (verbose) fprintf x; }
> > > > +# define Tracevv(x) { if (verbose > 1) fprintf x; }
> > > > +# define Tracec(c, x) { if (verbose && (c)) fprintf x; }
> > > > +# define Tracecv(c, x) { if ((verbose > 1) && (c))
> > > > fprintf x; }
> > >
> > > Maybe uppercase? Maybe do { ... } while(0)?
> >
> > Uppercase for what? Tracexx to tracexx?
>
> We normally don't have mixed-case identifiers, normally it would be
> trace() for functions vs. TRACE() for macros, though we also have a
> lot of lower-case macros as well.
>
> For the debugging macros, I would generally recommend not having
> any, but simply using the standard pr_debug and dev_dbg macros
> that everyone knows and understands.
>
> If you really need to do macros, make them so that they work like
> functions, e.g.
>
> #define foo_tracev(...) do { if (verbose) fprintf(__va_args__); } while (0)

When reviewing misc.c, I find that Tracevv and Tracecv are not used in lib/decompress_inflate.c
So these macros could be removed directly.
The same for other architectures, I think.

Guan Xuetao



--
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/