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 #endif 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.
|Tags||Utilities C C++ cpp Pre-processors Software Development|
|Licenses||BSD Original BSD Revised|
|Operating Systems||POSIX Linux BSD Unix|
Release Notes: This release fixes a bug in the -f option's support for #undef directives and improves portability to Windows.
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.
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.
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.
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.