Projects / Sunifdef


Sunifdef is a command line 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.

Operating Systems

Recent releases

  •  04 Feb 2008 21:59

    Release Notes: Six bugs are fixed in this release. Five of these fixes tackle longstanding defects of sunifdef's parsing and evaluation of integer constants, a niche that has received little scrutiny since the tool branched from unifdef. This version provides robust parsing of hex, decimal, and octal numerals and arithmetic on them. However, sunifdef still evaluates all integer constants as ints and performs signed integer arithmetic upon them. This falls short of emulating the C preprocessor's arithmetic in limit cases, which is an unfixed defect.

    •  24 Nov 2007 11:10

      Release Notes: Five minor bugs were fixed.

      •  13 May 2007 19:24

        Release Notes: The parser is strengthened to cope with contexts that were formerly skipped over as "obfuscated". The --obfusc option is thus redundant and is withdrawn. Six bugs are fixed. The demise of the Sourceforge compile farm means that many platforms can no longer be tested for this release.

        •  20 Jan 2007 17:50

          Release Notes: A new --recurse option enables recursive traversal of source directories. Users no longer need to write driver scripts for this routinely required capablity. A new --filter option enables selection of input files by file-extension. A new --keepgoing option causes processing to carry on with subsequent input files following parse errors. The --verbose mode now emits progress messages. The Unix and Windows builds now accept both sorts of line endings. Hex and octal preprocessor constants are now parsed. Six bugs were fixed. An extensive EXAMPLES section has been added to the man page.

          •  22 Jul 2006 20:49

            Release Notes: Two errors when compiling to the C89 standard were fixed, as were warnings provoked by "warn_unused_result" declarations and by building to 64-bit.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.