AUTOSAR C++14 Rule M0-1-3
A project shall not contain unused variables
Description
This checker is deactivated in a default Polyspace® as You Code analysis. See Checkers Deactivated in Polyspace as You Code Analysis (Polyspace Access).
Rule Definition
A project shall not contain unused variables.
Rationale
Presence of unused variables indicates that the wrong variable name might be used in the source code. Removing these variables reduces the possibility of the wrong variable being used in further development. Keep padding bits in bitfields unnamed to reduce unused variables in your project.
Polyspace Implementation
The checker flags local or global variables that are declared or defined but not read or written in any source files of the project. This specification also applies to members of structures and classes.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Language Independent Issues |
Category: Required, Automated |
Version History
Introduced in R2019a