On 31.03.2025 15:59, Andrew Cooper wrote:
> On 31/03/2025 9:32 am, Jan Beulich wrote:
>> On 28.03.2025 14:44, Andrew Cooper wrote:
>>> +#if defined(__LITTLE_ENDIAN)
>>> +
>>> +# define cpu_to_le64(x) (uint64_t)(x)
>>> +# define le64_to_cpu(x) (uint64_t)(x)
>>> +# define cpu_to_le32(x) (uint32_t)(x)
>>> +# define le32_to_cpu(x) (uint32_t)(x)
>>> +# define cpu_to_le16(x) (uint16_t)(x)
>>> +# define le16_to_cpu(x) (uint16_t)(x)
>> (Not just) for Misra these all need another pair of parentheses around the
>> entire expressions.
> 
> Why?  For both points?  Eclair is happy, with this at least.

As was explained to us, Eclair looks at the final, expanded code. Hence it may
well be that right now, in the code Eclair checks, we have no violations. Ones
may start to appear elsewhere or later, though. The fix then would still be to
get these macros into fully parenthesized shape.

That said, I can't think of any "good" code needing these parentheses here. I
can think of bad code though, which would properly fail to compile if the
parentheses were added, e.g.

    le32_to_cpu(a)++;

I fear I can't answer the 2nd question - what do you mean by "For both points?"?

Jan

Reply via email to