Fixed #8822 (false positive: MISRA rule 13.4)
This commit is contained in:
parent
004d7d5333
commit
48dfba429a
|
@ -1261,7 +1261,7 @@ class MisraChecker:
|
|||
continue
|
||||
if token.astOperand1.str == '[' and token.astOperand1.previous.str in {'{', ','}:
|
||||
continue
|
||||
if not (token.astParent.str in [',', ';']):
|
||||
if not (token.astParent.str in [',', ';', '{']):
|
||||
self.reportError(token, 13, 4)
|
||||
|
||||
|
||||
|
|
|
@ -267,6 +267,18 @@ void misra_13_3() {
|
|||
x = y++; // 13.3
|
||||
}
|
||||
|
||||
#define STRING_DEF_13_4 "This is a string"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char string[sizeof(STRING_DEF_13_4)];
|
||||
} s13_4_t;
|
||||
|
||||
static s13_4_t s13_4 =
|
||||
{
|
||||
.string = STRING_DEF_13_4 // no-warning
|
||||
};
|
||||
|
||||
void misra_13_4() {
|
||||
if (x != (y = z)) {} // 13.4
|
||||
else {}
|
||||
|
|
Loading…
Reference in New Issue