mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
387cfccee4
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.
8 lines
442 B
Plaintext
8 lines
442 B
Plaintext
o Minor features (maintenance scripts):
|
|
- Add a coccinelle script to detect bugs caused by incrementing or
|
|
decrementing a variable inside a call to log_debug(). Since
|
|
log_debug() is a macro whose arguments are conditionally evaluated, it
|
|
is usually an error to do this. One such bug was 30628, in which SENDME
|
|
cells were miscounted by a decrement operator inside a log_debug()
|
|
call. Closes ticket 30743.
|