diff mbox series

[RFC,17/18] public: misra rule 20.7 deviation on errno.h

Message ID 20221220085100.22848-18-luca.fancellu@arm.com (mailing list archive)
State Superseded
Headers show
Series cppcheck rule 20.7 fixes | expand

Commit Message

Luca Fancellu Dec. 20, 2022, 8:50 a.m. UTC
Cppcheck has found a violation of rule 20.7 for the macro XEN_ERRNO,
while the macro parameter is never used as an expression, it doesn't
harm the code or the readability to add parenthesis, so add them.

This finding is reported also by eclair and coverity.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/include/public/errno.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Beulich Dec. 20, 2022, 9:51 a.m. UTC | #1
On 20.12.2022 09:50, Luca Fancellu wrote:
> Cppcheck has found a violation of rule 20.7 for the macro XEN_ERRNO,
> while the macro parameter is never used as an expression, it doesn't
> harm the code or the readability to add parenthesis, so add them.
> 
> This finding is reported also by eclair and coverity.
> 
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

But with the title adjusted - this isn't about a deviation, but actually
addressing a finding.

Jan
Luca Fancellu Dec. 21, 2022, 8:46 a.m. UTC | #2
> On 20 Dec 2022, at 09:51, Jan Beulich <jbeulich@suse.com> wrote:
> 
> On 20.12.2022 09:50, Luca Fancellu wrote:
>> Cppcheck has found a violation of rule 20.7 for the macro XEN_ERRNO,
>> while the macro parameter is never used as an expression, it doesn't
>> harm the code or the readability to add parenthesis, so add them.
>> 
>> This finding is reported also by eclair and coverity.
>> 
>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> But with the title adjusted - this isn't about a deviation, but actually
> addressing a finding.

Is it ok this title:

public: misra rule 20.7 fix on errno.h


> 
> Jan
Jan Beulich Dec. 21, 2022, 9:25 a.m. UTC | #3
On 21.12.2022 09:46, Luca Fancellu wrote:
>> On 20 Dec 2022, at 09:51, Jan Beulich <jbeulich@suse.com> wrote:
>> On 20.12.2022 09:50, Luca Fancellu wrote:
>>> Cppcheck has found a violation of rule 20.7 for the macro XEN_ERRNO,
>>> while the macro parameter is never used as an expression, it doesn't
>>> harm the code or the readability to add parenthesis, so add them.
>>>
>>> This finding is reported also by eclair and coverity.
>>>
>>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
>>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>>
>> But with the title adjusted - this isn't about a deviation, but actually
>> addressing a finding.
> 
> Is it ok this title:
> 
> public: misra rule 20.7 fix on errno.h

Sure.

Jan
diff mbox series

Patch

diff --git a/xen/include/public/errno.h b/xen/include/public/errno.h
index 6bdc8c507990..5a78a7607c0d 100644
--- a/xen/include/public/errno.h
+++ b/xen/include/public/errno.h
@@ -31,7 +31,7 @@ 
 
 #ifndef __ASSEMBLY__
 
-#define XEN_ERRNO(name, value) XEN_##name = value,
+#define XEN_ERRNO(name, value) XEN_##name = (value),
 enum xen_errno {
 
 #elif __XEN_INTERFACE_VERSION__ < 0x00040700