misra: deviate MISRA C Rule 5.5 for hypfs_alloc_dyndata()

MISRA C Rule 5.5 states: "Identifiers shall be distinct from macro
names".

Update ECLAIR configuration to deviate 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@epam.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Dmytro Prokopchuk authored and Jan Beulich committed 2026-09-30 08:49:35 +02:00
1 parent b5fadd35f8
commit 2f67b00dde
3 files changed
+17

No files matched your search

@@ -133,6 +133,10 @@ 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$))" -config=MC3A2.R5.5,ignored_macros+="name(update_gnttab_par||parse_gnttab_limit)&&loc(file(^xen/common/grant_table\\.c$))"
-doc_end -doc_end
-doc_begin="Clash between hypfs_alloc_dyndata() function and macro name in xen/include/xen/hypfs.h is deliberate."
-config=MC3A2.R5.5,ignored_macros+="name(hypfs_alloc_dyndata)&&loc(file(^xen/include/xen/hypfs\\.h$))"
-doc_end
-doc_begin="The type \"ret_t\" is deliberately defined multiple times, -doc_begin="The type \"ret_t\" is deliberately defined multiple times,
depending on the guest." depending on the guest."
-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"} -config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+9
View File
@@ -176,6 +176,15 @@ Deviations related to MISRA C:2012 Rules:
unused 2nd and 3rd parameters to avoid warnings or errors related to them. unused 2nd and 3rd parameters to avoid warnings or errors related to them.
- ECLAIR has been configured to ignore these macros. - ECLAIR has been configured to ignore these macros.
* - R5.5
- Clash between the hypfs_alloc_dyndata() function and macro name in the
file 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. 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.
* - R5.6 * - R5.6
- The type ret_t is deliberately defined multiple times depending on the - The type ret_t is deliberately defined multiple times depending on the
type of guest to service. type of guest to service.
+4
View File
@@ -223,6 +223,10 @@ maintainers if you want to suggest a change.
Clashes between grant table functions and macro names are allowed Clashes between grant table functions and macro names are allowed
because they are used for discarding unused parameters. because they are used for discarding unused parameters.
Clash between hypfs_alloc_dyndata() function and macro name in the
file xen/include/xen/hypfs.h is allowed because the macro is a typed
convenience wrapper around the size-based allocation function.
* - `Rule 5.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_06.c>`_ * - `Rule 5.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_06.c>`_
- Required - Required
- A typedef name shall be a unique identifier - A typedef name shall be a unique identifier
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.