tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Convenience macros to help linting the kernel



On Sun, Jul 20, 2008 at 06:41:22 +0400, Valeriy E. Ushakov wrote:

> +/*
> + * Statement that safely consumes something so that if "x" is a
> + * variable it is not considered "unused" by the compiler or lint.
> + */
> +#define __USED(x)    do {                                    \
> +             /* LINTED: expression has null effect */        \
> +             (void)(x);                                      \
> +     } while (/* CONSTCOND */ 0)
> +

PS: I would dearly love a variadic __USED(), so that instead of 

#define KERNEL_UNLOCK(all, lwp, ptr)                    \
        do {                                            \
                __USED(all); __USED(lwp); __USED(ptr);  \
        } while (/* CONSTCOND */ 0)

one could write just

#define KERNEL_UNLOCK(all, lwp, ptr) __USED(all, lwp, ptr)

but as far as I can tell it's impossible to write.


SY, Uwe
-- 
uwe%stderr.spb.ru@localhost                       |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen


Home | Main Index | Thread Index | Old Index