 |
|
 |
RENESAS TOOL NEWS on June 16, 2005: RSO-SQMlint-050616D
A Note on Using the SQMlint
(the MISRA C Rule Checker) |
Please take note of the following problem in using the SQMlint, the MISRA C Rule Checker:
- On a violation of Rule 29
- Versions Concerned
SQMlint V.1.00 Release 0 through V.1.02 Release 00
- Description
Though no expression where an integer is assigned to an enumeration variable violates Rule 29, it delivers the error message that says "[MISRA(29) Complaining: "file name",line "X"] enum type object to which has not been assigned own enumerator."
- "file name" denotes the name of the file in which a violation of Rule 29 is found.
- "X" denotes the number of the line in which the description that violates Rule 29 is found.
- Conditions
This problem occurs if the following conditions are both satisfied:
| (1) |
In the source program exists an expression where an integer is assigned to an enumeration variable. |
| (2) |
The source program is compiled using the option to check the violation of Rule 29 in MISRA C (option names depend on compilers). |
Example:
------------------------------------------------------------
enum E { ONE = 1, TWO };
enum E e;
e = 1; /* Condition (1) */
------------------------------------------------------------
- Workaround
This problem can be circumvented in either of the following ways:
| (1) |
Neglect the error message if the above conditions are satisfied. |
| (2) |
To the enumeration variable, assign an enumeration constant; not an integer.
-----------------------------------------------------------
enum E { ONE = 1, TWO };
enum E e;
e = ONE; /* Assign enumeration constant ONE
to enumeration variable "e" */
----------------------------------------------------------- |
- Schedule of Fixing the Problem
We plan to fix this problem in the next release of the product.
|
 |