From b5bd9468defa97278b16ae4a39fc528ffb9b3854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 16 Apr 2017 17:04:40 +0200 Subject: [PATCH] Misra: Add rule 8.14 --- addons/misra-test.c | 2 ++ addons/misra.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/addons/misra-test.c b/addons/misra-test.c index 2878c920e..df4917c5b 100644 --- a/addons/misra-test.c +++ b/addons/misra-test.c @@ -26,6 +26,8 @@ void misra_7_3() { int x = 12lu; // 7.3 } +void misra_8_14(char * restrict str) {} // 8.14 + void misra_10_4(u8 x, u16 y) { z = x + y; // 10.4 } diff --git a/addons/misra.py b/addons/misra.py index e13146b54..4f5d9a1b7 100644 --- a/addons/misra.py +++ b/addons/misra.py @@ -271,6 +271,11 @@ def misra_7_3(rawTokens): if re.match(r'^[0-9]+l', tok.str): reportError(tok, 7, 3) +def misra_8_14(rawTokens): + for token in rawTokens: + if token.str == 'restrict': + reportError(token, 8, 14) + def misra_10_4(data): for token in data.tokenlist: if not token.str in ['+','-','*','/','%','&','|','^'] and not token.isComparisonOp: @@ -867,6 +872,7 @@ for arg in sys.argv[1:]: if cfgNumber == 1: misra_7_1(data.rawTokens) misra_7_3(data.rawTokens) + misra_8_14(data.rawTokens) misra_10_4(cfg) misra_10_6(cfg) misra_10_8(cfg)