unifdef
« Back to VersTracker
Description:
Selectively process conditional C preprocessor directives
Type: Formula  |  Tracked Since: Dec 28, 2025
Links: Homepage  |  formulae.brew.sh
Category: Developer tools
Tags: c-preprocessor code-processing developer-tools command-line unifdef
Install: brew install unifdef
About:
Unifdef is a command-line utility that evaluates conditional C preprocessor directives in source files. It removes code blocks that are false under a specified set of macros, effectively simplifying the code for a specific configuration. This is useful for maintaining clean, configuration-specific source files without the clutter of conditional logic.
Key Features:
  • Processes conditional C preprocessor directives (#ifdef, #if, etc.)
  • Removes unreachable code based on a specified macro configuration
  • Preserves the integrity of the remaining code structure
  • Handles complex nested conditions and macro expansions
Use Cases:
  • Simplifying source code for a specific target platform or configuration
  • Generating clean, configuration-specific header files from complex templates
  • Auditing code for dependencies on specific macros
Alternatives:
  • gcc -E – GCC's preprocessor can be used for similar tasks but is less precise for selectively removing code blocks without full expansion.
  • unifdef – The original tool, which unifdef is based on, offering similar functionality.
Version History
Detected Version Rev Change Commit
Sep 11, 2025 11:14am 0 VERSION_BUMP 8edf10ff