From 164029b0c5bba375e2154678fcdd0cc0a2f76fbd Mon Sep 17 00:00:00 2001 From: Maksim Masalski Date: Wed, 7 Jul 2021 15:37:42 +0800 Subject: [PATCH] testsuite: suppress usage of setjmp in a testcode (rule 21_4-a) According to the rule MISRAC-2012 21.4.a the standard header file shall not be used. Suppress it, because it raises violation in a testcode, not in a runtime code. Tag suppresses reporting of violation for the current file, starting from the line where the suppression is located. It is a deliberate deviation. Found as a coding guideline violation (MISRA R21.4.a) by static coding scanning tool. Signed-off-by: Maksim Masalski --- subsys/testsuite/ztest/src/ztest.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subsys/testsuite/ztest/src/ztest.c b/subsys/testsuite/ztest/src/ztest.c index 90e8ca83bdb..4e1abbf73a2 100644 --- a/subsys/testsuite/ztest/src/ztest.c +++ b/subsys/testsuite/ztest/src/ztest.c @@ -207,8 +207,14 @@ static void run_test_functions(struct unit_test *test) } #ifndef KERNEL -/* parasoft suppress item MISRAC2012-RULE_21_4-b "setjmp using in test code" */ -#include + +/* Static code analysis tool can raise a violation that the standard header + * shall not be used. + * + * setjmp is using in a test code, not in a runtime code, it is acceptable. + * It is a deliberate deviation. + */ +#include /* parasoft-suppress MISRAC2012-RULE_21_4-a MISRAC2012-RULE_21_4-b*/ #include #include #include