lkml.org 
[lkml]   [2010]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCHv1 008/211] unicore32: new file arch/unicore32/boot/compressed/misc.c
Date

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





\
 
 \ /
  Last update: 2010-12-13 07:53    [from the cache]
©2003-2011 Jasper Spaans