Projects / unifdef


Unifdef is useful for removing #ifdef'ed lines from a file while otherwise leaving the file alone. You specify which symbols are defined or undefined with -D and -U flags, and unifdef removes the corresponding ifdefs, and the enclosed code if appropriate. It's especially useful for removing those "#ifdef BROKEN" and "#ifdef PRIVATE" clauses from code before you release it. Unifdef acts on #if, #ifdef, #ifndef, #elif, #else, and #en­dif lines, and it knows only enough about C and C++ to know when one of these is inactive because it is inside a comment or a single or double quote.

Operating Systems

Recent releases

  •  07 Jan 2014 19:28

    Release Notes: This release fixes a bug in the -f option's support for #undef directives and improves portability to Windows.

    •  07 Jun 2013 11:21

      Release Notes: The unifdef utility now supports simple cases in which macros expand to macros rather than directly to numbers, so it can use unaltered #defines from system headers more effectively. This release includes portability fixes for Windows.

      •  06 May 2013 17:19

        Release Notes: The unifdef utility can now read #define and #undef preprocessor directives from auxiliary header-like files given with the -f command line option. You can use -f instead of or in addition to the -D and -U options.

        •  28 Mar 2013 19:19

          Release Notes: This release can process multiple files with one invocation, and will include filenames on #line directives when appropriate. There is experimental support for Windows, including build instructions for MinGW and Microsoft Visual C. Feedback from Windows developers is welcome.

          •  22 Feb 2011 17:07

            Release Notes: This release fixes the implementation of the -n option (insert #line directives) to work with the -o option (alternate output file). It greatly improves write error handling.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.