CWE-563¶
Assignment to Variable without Use. [Bad-Coding-Practices, Improper-Adherence-To-Coding-Standards]
Required inputs: IR, StaticSemanticAnalysis
Demonstrative Examples
Example 1
The following code excerpt assigns to the variable r and then overwrites the value without using it.
Example Language:C
r = getName();
r = getNewBuffer(buf);Excerpts from CWE [https://cwe.mitre.org], Copyright (C) 2006-2026, the MITRE Corporation. See section 9.4. "3rd-Party Licenses" in the documentation for full details.Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
conditional_unused_def |
Result of assignment is not used along some path(s) |
None |
True |
init_used_in_other_isr |
Initialization is not used except within code reached from an entry point that might be triggered by an interrupt |
None |
True |
unused_catch_parameter |
Unused implicit initialization of catch clause parameter (you can use an unnamed one instead) |
None |
False |
unused_def |
Result of assignment is not used |
None |
False |
unused_init |
Unused initialization |
None |
False |
used_in_other_isr |
Result of assignment is not used except within code reached from an entry point that might be triggered by an interrupt |
None |
True |
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
report_dead_initializations¶
report_dead_initializations : bool = True