On 12.12.2024 03:27, Stefano Stabellini wrote:
> On Wed, 11 Dec 2024, Jan Beulich wrote:
>> On 11.12.2024 12:02, Alessandro Zucchelli wrote:
>>> Rule 11.1 states as following: "Conversions shall not be performed
>>> between a pointer to a function and any other type".
>>>
>>> Functions "__machine_restart" and "__machine_halt" in "x86/shutdown.c"
>>> and "halt_this_cpu" in "arm/shutdown.c" are defined as noreturn
>>> functions and subsequently passed as parameters to function calls.
>>> This violates the rule in Clang, where the "noreturn" attribute is
>>> considered part of the function"s type.
>>
>> I'm unaware of build issues with Clang, hence can you clarify how Clang's
>> view comes into play here? In principle various attributes ought to be
>> part of a function's type; iirc that's also the case for gcc. Yet how
>> that matters to Eclair is still entirely unclear to me.
>>
>>> By removing the "noreturn"
>>> attribbute and replacing it with uses of the ASSERT_UNREACHABLE macro,
>>> these violations are addressed.
>>
>> Papered over, I'd say. What about release builds, for example?
>>
>> Deleting the attribute also has a clear downside documentation-wise. If
>> we really mean to remove them from what the compiler gets to see, I think
>> we ought to still retain them in commented-out shape.
> 
> Another option would be to #define noreturn to nothing for ECLAIR builds ?

That again would feel like papering over things. Plus I don't know if that's
an option at all.

Jan

Reply via email to