From e02c7bd46632a2b1b42fb161b8f802eaa49e61f7 Mon Sep 17 00:00:00 2001 From: Maksim Masalski Date: Wed, 7 Jul 2021 16:27:15 +0800 Subject: [PATCH] libc: types: suppress deviation Suppress violation, because it is a deliberated deviation. Noticed, that my previous PR #36420 comments were not correctly detected by a static analysis tool. Only the first one item "MISRAC2012-RULE_20_4-a" was detected and suppressed. Change comment style, so each item will be suppressed. Comment style defined in PR #36911 as the most suitable for the analysis tool. Signed-off-by: Maksim Masalski --- lib/libc/minimal/include/sys/types.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/libc/minimal/include/sys/types.h b/lib/libc/minimal/include/sys/types.h index ee425df305c..7ddb2568196 100644 --- a/lib/libc/minimal/include/sys/types.h +++ b/lib/libc/minimal/include/sys/types.h @@ -16,11 +16,15 @@ typedef unsigned int mode_t; #if !defined(__ssize_t_defined) #define __ssize_t_defined -/* parasoft suppress item MISRAC2012-RULE_20_4-a item MISRAC2012-RULE_20_4-b - * "Trick compiler to make sure the type of ssize_t won't be - * unsigned long. View details in commit b889120" +/* Static code analysis tool can raise a violation + * in the line below where name of macro 'unsigned' is the same + * as keyword. It is made on purpose, deliberated deviation. + * + * We trick compiler to make sure the type of ssize_t won't be unsigned long. + * As otherwise the type of ssize_t will be unsigned long + * which is not correct. More details view in commit b889120 */ -#define unsigned signed +#define unsigned signed /* parasoft-suppress MISRAC2012-RULE_20_4-a MISRAC2012-RULE_20_4-b */ typedef __SIZE_TYPE__ ssize_t; #undef unsigned