[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] misra: add deviation of Rule 2.1 for BUG() macro



On 17.09.2025 15:59, Dmytro Prokopchuk1 wrote:
> 
> 
> On 9/16/25 23:03, Jan Beulich wrote:
>> On 16.09.2025 21:35, Dmytro Prokopchuk1 wrote:
>>>
>>>
>>> On 9/16/25 17:27, Jan Beulich wrote:
>>>> On 16.09.2025 14:45, Dmytro Prokopchuk1 wrote:
>>>>> --- a/docs/misra/deviations.rst
>>>>> +++ b/docs/misra/deviations.rst
>>>>> @@ -98,6 +98,23 @@ Deviations related to MISRA C:2012 Rules:
>>>>>           even when debug-only assertions like `ASSERT_UNREACHABLE()` are 
>>>>> removed.
>>>>>         - ECLAIR has been configured to ignore those statements.
>>>>>
>>>>> +   * - R2.1
>>>>> +     - In the specific build configuration (when the config CONFIG_ACPI 
>>>>> is not
>>>>> +       defined) the 'BUG()' macro is intentionally used in the 
>>>>> 'prepare_acpi()'
>>>>> +       function in the header file 
>>>>> 'xen/arch/arm/include/asm/domain_build.h'
>>>>> +       defined as 'static inline' to trigger a runtime error if 
>>>>> ACPI-related
>>>>> +       features are used incorrectly.
>>>>> +     - Tagged as `deliberate` for ECLAIR.
>>>>
>>>> I response to me outlining a deviation-less alternative you tried it out
>>>> and said it works. Then why is the deviation still being put in place?
>>>
>>> Yes, that's true.
>>> I started with that prepare_acpi() function and I tried to move it into
>>> xen/include/xen/acpi.h header file under appropriate #ifdef:
>>> https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/commit/d15cf91de92f1f8ec67911c51a13e7f095c1bcdd
>>
>> But an important part of my proposal was to have no #ifdef around
>> the declaration, iirc. With that, no violation should result.
> I don't understand, how it can help to avoid scanning by the Eclair?

I didn't say it would. Scanning will always happen. The question is
whether Eclair would flag anything.

> In particular build configuration the "static inline" version of the
> function will be present after preproccesor, and Eclair will scan it.
> 
> Jan, please, explain your thought. I think, I missed something.

If acpi_disabled is compile-time-constant false, all you need is a
declaration for prepare_acpi(). The call to it will then be DCE-ed.
No inline function, no #ifdef, no violation.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.