IBM Support

Code Review usage yields rule M12.6 messages

Troubleshooting


Problem

Attempts to use Code Review component for IBM Rational Test RealTime render the rule M12.6.

Symptom

When you run Code Review on the example below, you get unexpected output.

#include <stdint.h>

static void yad(void);

extern uint16_t try_something(void);

static void yad(void) {

    uint16_t Attempts = 42u;

    uint16_t Error = 0u;

    do {

             Error = try_something();

             Attempts--;

          }

    while((Attempts != 0U) && (Error != 0u));

}




The code review checker (crccc) then shows the following output.


script C:\Program Files\Rational\TestRealTime\lib\scripts\Source.pl

code.c: Compiling...
gcc.exe -c "C:\testcase\code.c"    -g  -o "cpcgnu\code.o"
C:\testcase\code.c: Code checking...
crccc "C:\testcase\code.c" "cpcgnu/code.xob" atus_c.def atl.opp  -RULE="C:\Program Files\Rational\TestRealTime\plugins\Common\lib\confrule.xml"
---
C:\testcase\code.c:33:Warning:  row 26   Rule M12.6.2:The operator on a Boolean expression should be a logical operator ( &&, || or !).
C:\testcase\code.c:33:Warning:  row 28   Rule M12.6.1:Only Boolean operands should be used with logical operators (&&, || and !).
Done


Code Review checker reports error on the while(...) statement :


Rule M12.6.2:The operator on a Boolean expression should be a logical operator ( &&, || or !).

Rule M12.6.1:Only Boolean operands should be used with logical operators (&&, || and !).

[{"Product":{"code":"SSSHUF","label":"Rational Test RealTime"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Code Review for C","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.0;7.5.0.6;7.5.0.5;7.5.0.3;7.5.0.2;7.5.0.1;7.5;7.5.0.4","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
16 June 2018

UID

swg21585557