Utilities for generating binary size reports.
Main docs: Home
Macros | |
| #define | PW_BLOAT_COND(cond, mask) |
| #define | PW_BLOAT_EXPR(expr, mask) |
Variables | |
| constexpr uint32_t | pw::bloat::kDefaultMask = ~0u |
| #define PW_BLOAT_COND | ( | cond, | |
| mask | |||
| ) |
Possibly evaluates a conditional statement as part of a size report.
The mask parameter is treated as a bitmap. If the least significant bit is set, the condition is evaluated and, if true, the bit is recycled to the most significant position. Otherwise, the bit is discarded.
A clever compiler should be kept from optimizing away the conditional statements by initializing the mask parameter with a volatile variable:
If a method returns void and is called for its side effects, use PW_BLOAT_EXPR instead.
| #define PW_BLOAT_EXPR | ( | expr, | |
| mask | |||
| ) |
Possibly evaluates an expression as part of a size report.
The mask parameter is treated as a bitmap. If the least significant bit is set, the expression is evaluated and the bit is recycled to the most significant position. Otherwise, the bit is discarded.
A clever compiler should be kept from optimizing away the expression by initializing the mask parameter with a volatile variable, provided the method has some side effect:
If a method is const or has no effect beyond its return value, use PW_BLOAT_COND instead.
|
constexpr |
A value that can cause all conditions passed to PW_BLOAT_COND and expressions passed to PW_BLOAT_EXPR to be executed. Assign a volatile variable to this value and pass it those macros to prevent unwanted compiler optimizations from removing code to be measured.