Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- possibly some code
- printf(some_parameters); // This should match
- possibly more code
- #ifdef DEBUG
- possibly some code
- printf(some_parameters); // This shouldn't match
- possibly more code
- #endif
- possibly some code
- printf(some_parameters); // This should also match
- possibly more code
- (?<!(#ifdef [A-Γ 0-9]+)).*printf(.*);.*(?!(#endif))
- $ unifdef -UDEBUG file.c | grep printf
- printf(some_parameters); // This should match
- printf(some_parameters); // This should also match
- UNIFDEF(1) BSD General Commands Manual UNIFDEF(1)
- NAME
- unifdef, unifdefall β remove preprocessor conditionals from code
- SYNOPSIS
- unifdef [-ceklst] [-Ipath -Dsym[=val] -Usym -iDsym[=val] -iUsym] ... [file]
- unifdefall [-Ipath] ... file
- DESCRIPTION
- The unifdef utility selectively processes conditional cpp(1) directives.
- It removes from a file both the directives and any additional text that
- they specify should be removed, while otherwise leaving the file alone.
- The unifdef utility acts on #if, #ifdef, #ifndef, #elif, #else, and #endif
- lines, and it understands only the commonly-used subset of the expression
- syntax for #if and #elif lines. It handles integer values of symbols
- defined on the command line, the defined() operator applied to symbols
- defined or undefined on the command line, the operators !, <, >, <=, >=,
- ==, !=, &&, ||, and parenthesized expressions. Anything that it does not
- understand is passed through unharmed. It only processes #ifdef and
- #ifndef directives if the symbol is specified on the command line, otherβ
- wise they are also passed through unchanged. By default, it ignores #if
- and #elif lines with constant expressions, or they may be processed by
- specifying the -k flag on the command line.
- cpp -D<your #define options here> | grep printf
Add Comment
Please, Sign In to add comment