Skip to content
  • Nick Mathewson's avatar
    Add a coccinelle script to look for {inc,dec}rements in log_debug · 387cfcce
    Nick Mathewson authored
    We want to forbid this pattern since, unlike the other log_*()
    macros, log_debug() conditionally evaluates its arguments only if
    debug-level logging is enabled.  Thus, a call to
        log_debug("%d", x++);
    will only increment x if debugging logs are enabled, which is
    probably not what the programmer intended.
    
    One bug caused by this pattern was #30628.
    
    This script detects log_debug( ) calls with any of E++, E--, ++E,
    or --E in their arguments, where E is an arbitrary expression.
    
    Closes ticket 30743.
    387cfcce