Sunifdef

Oleg Verych olecom at flower.upol.cz
Fri Jun 8 03:32:45 UTC 2007


* From: David Woodhouse
* Date: Thu, 24 May 2007 11:32:45 -0400
>
> On Wed, 2007-05-23 at 13:29 +0100, Jonathan Underwood wrote:
>> Dear Kernel list,
>> 
>> I've noticed in the past that unifdef is used in kernel package
>> building. I wonder if you're aware of a maintained and more
>> featureful program, Sunifdef, which has evolved from unifdef (which
>> seems mostly unmaintained). It's packaged for Fedora, and has a
>> website here.
>
> The kernel no longer uses an external unifdef -- it has its own in
> scripts/unifdef.c. If you want to work with the upstream kernel to
> change that to sunifdef, go ahead.
>
> Can 'sunifdef -U__KERNEL__' fix up stuff like...
>
> #if defined(__KERNEL__) && defined(__FOO__)
>  and
> #if defined(__KERNEL__) || defined(__BAR__)
>
> ... by treating them as '#if 0' (and eliding completely) and by
> rewriting to just #ifdef __BAR__, respectively? If so, changing the
> upstream kernel seems like it would be useful.

If, what you've wrote would be policy (with watchdog script in the git),
i think, simple (sed) scripts can be written to unifdef __KERNEL__ for
userspace headers, with further sed'ing them(compiler.h), without any
need of external or internal *programs*.

Linux coding standards got rid of many C obfustications, happily.

-*-
olecom at flower:/tmp$ grep -e __KERNEL /usr/include/linux/soundcard.h | grep '!'
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
olecom at flower:/tmp$
-*-
Even this one is simple regex, but anyway, policy would be good.

> -- 
> dwmw2
____




More information about the Fedora-kernel-list mailing list