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:
http://www.sunifdef.strudl.org/
Quoting:
Sunifdef is a commandline tool for eliminating superfluous preprocessor clutter from C and C++ source files. It is a more powerful successor to the FreeBSD 'unifdef' tool.
Sunifdef is most useful to developers of constantly evolving products with large code bases, where preprocessor conditionals are used to configure the feature sets, APIs or implementations of different releases. In these environments the code base steadily accumulates #ifdef pollution as transient configuration options become obselete. Sunifdef can largely automate the recurrent task of purging redundant #if logic from the code.
Apologies for a slightly off topic plug. jonathan.
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:
I've had some problems with sunifdef v3.0 that prevented me from using it in one of my projects, but it appears that v3.1 has fixed at least one of those problems.
Jeff
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.
* 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@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@flower:/tmp$ -*- Even this one is simple regex, but anyway, policy would be good.
-- dwmw2
____
kernel@lists.fedoraproject.org