Closed
Description
Affected rules
A5-2-2
Description
Flagging c-style casts generated by macros can be confusing for the developer, because (a) it may not be clear where the cast is coming from and (b) the developer may not be able to address the finding, if the macro is defined in a library.
Some possible adjustments:
- Only report expansions of macros defined within the source of the project. Rationale: you can modify macros you wrote, but not those written by others.
- Update the alert message to report that the cast is generated as part of a macro invocation of the given macro.
Example
#define ADD_ONE(X) ((int)X) + 1
void example_function() {
int i = ADD_ONE(1);
}