Skip to content

Commit ebf54ac

Browse files
committed
Misra; Remove 12.4 because the check is not implemented properly
1 parent 33427b6 commit ebf54ac

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

addons/misra.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,26 +1876,6 @@ def misra_12_3(self, data):
18761876
break
18771877
prev = prev.previous
18781878

1879-
def misra_12_4(self, data):
1880-
if typeBits['INT'] == 16:
1881-
max_uint = 0xffff
1882-
elif typeBits['INT'] == 32:
1883-
max_uint = 0xffffffff
1884-
else:
1885-
return
1886-
1887-
for token in data.tokenlist:
1888-
if not token.values:
1889-
continue
1890-
if (not isConstantExpression(token)) or (not isUnsignedInt(token)):
1891-
continue
1892-
for value in token.values:
1893-
if value.intvalue is None:
1894-
continue
1895-
if value.intvalue < 0 or value.intvalue > max_uint:
1896-
self.reportError(token, 12, 4)
1897-
break
1898-
18991879
def misra_13_1(self, data):
19001880
for token in data.tokenlist:
19011881
if simpleMatch(token, ") {") and token.next.astParent == token.link:
@@ -3141,7 +3121,6 @@ def parseDump(self, dumpfile):
31413121
self.executeCheck(1201, self.misra_12_1, cfg)
31423122
self.executeCheck(1202, self.misra_12_2, cfg)
31433123
self.executeCheck(1203, self.misra_12_3, cfg)
3144-
self.executeCheck(1204, self.misra_12_4, cfg)
31453124
self.executeCheck(1301, self.misra_13_1, cfg)
31463125
self.executeCheck(1303, self.misra_13_3, cfg)
31473126
self.executeCheck(1304, self.misra_13_4, cfg)

addons/test/misra/misra-test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,10 +732,10 @@ void misra_12_3(int a, int b, int c) { // no warning
732732
void misra_12_4() {
733733
uint32_t x;
734734
bool t;
735-
x = 123456u * 123456u; // 12.4
736-
x = MISRA12_4a + MISRA12_4b; // 12.4
737-
x = 0u - 1u; // 12.4
738-
x = t ? 0u : (0u-1u); // 12.4
735+
x = 123456u * 123456u; // TODO 12.4
736+
x = MISRA12_4a + MISRA12_4b; // TODO 12.4
737+
x = 0u - 1u; // TODO 12.4
738+
x = t ? 0u : (0u-1u); // TODO 12.4
739739
x = 556200230913ULL;
740740
foo(&volatile_macro_12_4); // no crash
741741
}

0 commit comments

Comments
 (0)