|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 2/4] Eclair: relax long <-> function-pointer conversion deviation
What is true for unsigned long is also true for plain/signed long, thus
also taking care of two instances of __x86_return_thunk() being cast to
long.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -368,17 +368,17 @@ constant expressions are required.\""
# Series 11
#
--doc_begin="The conversion from a function pointer to unsigned long or (void
*) does not lose any information, provided that the target type has enough bits
to store it."
+-doc_begin="The conversion from a function pointer to [unsigned] long or (void
*) does not lose any information, provided that the target type has enough bits
to store it."
-config=MC3A2.R11.1,casts+={safe,
"from(type(canonical(__function_pointer_types)))
- &&to(type(canonical(builtin(unsigned long)||pointer(builtin(void)))))
+ &&to(type(canonical(builtin(long)||builtin(unsigned
long)||pointer(builtin(void)))))
&&relation(definitely_preserves_value)"
}
-doc_end
--doc_begin="Conversion from unsigned long or (void *) to a function pointer
can restore full information, provided that the source type has enough bits to
restore it."
+-doc_begin="Conversion from [unsigned] long or (void *) to a function pointer
can restore full information, provided that the source type has enough bits to
restore it."
-config=MC3A2.R11.1,casts+={safe,
- "from(type(canonical(builtin(unsigned long)||pointer(builtin(void)))))
+ "from(type(canonical(builtin(long)||builtin(unsigned
long)||pointer(builtin(void)))))
&&to(type(canonical(__function_pointer_types)))
&&relation(definitely_preserves_value)"
}
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -432,8 +432,8 @@ maintainers if you want to suggest a cha
- All conversions to integer types are permitted if the destination
type has enough bits to hold the entire value. Conversions to bool
and void* are permitted. Conversions from 'void noreturn (*)(...)'
- to 'void (*)(...)' are permitted. Conversions from unsigned long or
- '(void *)' to a function pointer are permitted.
+ to 'void (*)(...)' are permitted. Conversions from [unsigned] long
+ or '(void *)' to a function pointer are permitted.
Example::
unsigned long func_addr = (unsigned long)&some_function;
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |