[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] misra: add deviations of MISRA C Rule 5.5
On 2025-07-28 11:36, Jan Beulich wrote: On 25.07.2025 18:24, Dmytro Prokopchuk1 wrote:--- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -142,6 +142,31 @@ Deviations related to MISRA C:2012 Rules: memmove. - Tagged as `deliberate` for ECLAIR. + * - R5.5+ - Clashes between bitops functions and macros names are deliberate and are + needed for input validation and error handling, ensures that the size of + the object being pointed to by 'addr' meets the minimum requirements for + the bit operation, preventing unsafe operations on improperly sized data + types that could lead to undefined behavior or memory corruption. + The macros encapsulate this conditional logic into a single, reusable form;+ which simplifies the code, avoids redundant function call. + - Specified macros should be ignored.At the risk of going too far with nitpicking: Who are "specified macros" here? The text doesn't mention any names. In fact, the way it's written it could be taken to mean all macros there, including any that are yet to be added. I don't think suchis appropriate for a deviation. I agree with Jan here. Either you make a single deviation record encompassing all deviated macros or you have one per deviation (e.g., one for irq.h, one for grant_table.h and one for bitops.h) listing the macros that are considered. For bitops it might be a concern the actual functions going out of sync, but in that case you could just spell out the deviation and say "all pairs functions/macros in file <file> that are defined using the same identifier" or something similar. + * - R5.5+ - Clashes between 'pirq_cleanup_check' function and macro names are deliberate. + The purpose is to ensure that the specific cleanup action ('pirq_cleanup_check') + is performed conditionally when the parameter 'event channel number' equals+ zero, otherwise it does nothing.+ This approach simplifies the code, avoids redundant function call.+ - Specified macro should be ignored.Here it's clear which macro is meant, but ...+ * - R5.5+ - Clashes between grant table functions and macros names are deliberate. + These macros address differences in argument count during compile-time, + effectively discarding unused parameters to avoid warnings or errors+ related to unused arguments. + - Specified macro should be ignored.... here it again isn't. Jan -- Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |