|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/3] misra: deviate MISRA C Rule 5.5 for 'hypfs_alloc_dyndata'
On 25.05.2026 14:05, Dmytro Prokopchuk1 wrote: > MISRA C Rule 5.5 states: "Identifiers shall be distinct from macro > names". > > Update ECLAIR configuration to deviate intentional identifier and > macro name clashes by specifying the macros that should be ignored. > This includes 'hypfs_alloc_dyndata', where the real function takes > an allocation size and the same-named macro is a typed convenience > wrapper that expands calls using sizeof(type). > > Update deviations.rst and rules.rst accordingly. > > Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx> While I'm okay with this approach, were alternatives considered? E.g. following the xmalloc() naming model, even if that has a name spacing issue (which ideally we wouldn't further extend)? > --- a/automation/eclair_analysis/ECLAIR/deviations.ecl > +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl > @@ -132,6 +132,12 @@ These macros address differences in argument count > during compile-time, effectiv > > -config=MC3A2.R5.5,ignored_macros+="name(update_gnttab_par||parse_gnttab_limit)&&loc(file(^xen/common/grant_table\\.c$))" > -doc_end > > +-doc_begin="Clash between 'hypfs_alloc_dyndata' function and macro name in > 'xen/include/xen/hypfs.h' is deliberate. > +The function is the allocator taking a size in bytes, while the macro is a > typed convenience wrapper used by dynamic > +hypfs nodes to allocate per-request traversal data with the correct size and > return type." > +-config=MC3A2.R5.5,ignored_macros+="name(hypfs_alloc_dyndata)&&loc(file(^xen/include/xen/hypfs\\.h$))" > +-doc_end I think this is too verbose for the purposes here. The details can all be had ... > --- a/docs/misra/deviations.rst > +++ b/docs/misra/deviations.rst > @@ -176,6 +176,15 @@ Deviations related to MISRA C:2012 Rules: > unused 2nd and 3rd parameters to avoid warnings or errors related to > them. > - ECLAIR has been configured to ignore these macros. > > + * - R5.5 > + - Clash between the 'hypfs_alloc_dyndata' function and macro name is > + intentional. The function is the allocator taking a size in bytes, > while > + the macro is a typed convenience wrapper used by dynamic hypfs nodes > to > + allocate per-request traversal data with the correct size and return > type. > + The implementation explicitly undefines the macro before defining the > real > + function, so the name clash is controlled. > + - ECLAIR has been configured to ignore this macro. ... from here. Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |