Miscellaneous-ExpressionsWithoutSideEffect¶
There shall be no expressions that could be removed because they do not affect program behaviour
Required inputs: IR
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
redundant_expression |
Binary operator with this operand is redundant, expression can be simplified (operator can be removed) without affecting program behaviour |
None |
False |
removable_expression |
Expression (but not necessarily all subexpressions) can be removed without affecting program behaviour |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
check_preprocessor_expressions¶
check_preprocessor_expressions : bool = False
expr || 0 as well.
list_side_effect_free_statements¶
list_side_effect_free_statements : bool = False
report_redundant_expressions_from_macros¶
report_redundant_expressions_from_macros : bool = False
expr + 0 should be reported if
the constant comes from a macro (and the operator does not come from the same
macro).
report_redundant_sizeof_expressions¶
report_redundant_sizeof_expressions : bool = False
expr * 1 should be reported if
the constant comes from evaluating sizeof().