mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
automation/eclair: generalize the noreturn function-pointer deviation
The R11.1 safe cast only matched void noreturn (*)(void *). Accept a conversion where noreturn is omitted and the signature is otherwise compatible. canonical() covers typeof destinations, and compatible_deep_unqualified keeps the parameter and return types aligned. Discarding noreturn does not change the calling convention. Code after the call is unreachable when every possible callee is noreturn. Leaving that code in place is a tolerated Rule 2.1 violation. The full rationale is in docs/misra/deviations.rst. Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com> Acked-by: Nicola Vetrini <nicola.vetrini@bugseng.com> # automation/eclair_analysis/.* Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
65f523e546
commit
b07838dc46
3 files changed
+18
-11
No files matched your search
@@ -394,11 +394,12 @@ constant expressions are required.\""
|
||||
}
|
||||
-doc_end
|
||||
|
||||
-doc_begin="The conversion from 'void noreturn (*)(void *)' to 'void (*)(void *)' is safe
|
||||
because the semantics of the 'noreturn' attribute do not alter the calling convention or behavior of the resulting code."
|
||||
-doc_begin="The conversion from a noreturn function pointer to a function
|
||||
pointer with noreturn omitted but an otherwise compatible signature does
|
||||
not alter the calling convention."
|
||||
-config=MC3A2.R11.1,casts+={safe,
|
||||
"kind(bitcast)&&to(type(pointer(inner(return(builtin(void))&&all_param(1, pointer(builtin(void)))))))&&from(expr(skip(!syntactic(),
|
||||
ref(property(noreturn)))))"}
|
||||
"kind(bitcast)&&to(type(canonical(__function_pointer_types)))&&from(expr(skip(!syntactic(),
|
||||
ref(property(noreturn)))))&&relation(compatible_deep_unqualified)"}
|
||||
-doc_end
|
||||
|
||||
-doc_begin="The conversion from a pointer to an incomplete type to unsigned long does not lose any information, provided that the target type has enough bits to store it."
|
||||
|
||||