* [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
@ 2024-11-13 8:41 Alessandro Zucchelli
2024-11-13 10:31 ` Jan Beulich
0 siblings, 1 reply; 7+ messages in thread
From: Alessandro Zucchelli @ 2024-11-13 8:41 UTC (permalink / raw)
To: xen-devel
Cc: consulting, Alessandro Zucchelli, Simone Ballarin, Doug Goldstein,
Stefano Stabellini, Andrew Cooper, Jan Beulich, Julien Grall
This addresses violations of MISRA C:2012 Rule 5.2 which states as
following: Identifiers declared in the same scope and name space shall
be distinct.
This deviation addresses violations of Rule 5.2 arising from
identifiers generated through token pasting macros CHECK_NAME_ and
DEFINE_COMPAT_HANDLE.
No functional change.
Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
---
automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
docs/misra/deviations.rst | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index c5663eed2b..ee1ac3b602 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -88,6 +88,10 @@ it defines would (in the common case) be already defined. Peer reviewed by the c
# Series 5.
#
+-doc_begin="Identifiers generated through the following token pasting macros are excluded from compliance to this rule"
+-config=MC3R1.R5.2,reports+={safe, "any_area(any_loc(any_exp(macro(^CHECK_NAME_$))&&any_exp(macro(^DEFINE_COMPAT_HANDLE$))))"}
+-doc_end
+
-doc_begin="The project adopted the rule with an exception listed in
'docs/misra/rules.rst'"
-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 15a993d050..aa98acc45f 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -97,6 +97,13 @@ Deviations related to MISRA C:2012 Rules:
are not instances of commented-out code.
- Tagged as `safe` for ECLAIR.
+ * - R5.2
+ - Macros CHECK_NAME_ and DEFINE_COMPAT_HANDLE through token pasting
+ generate non-compliant identifiers. Such identifiers are allowed.
+ - Tagged as `safe` for ECLAIR. So far, the following macros are deviated:
+ - CHECK_NAME_
+ - DEFINE_COMPAT_HANDLE
+
* - R5.3
- As specified in rules.rst, shadowing due to macros being used as macro
arguments is allowed, as it's deemed not at risk of causing developer
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
2024-11-13 8:41 [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2 Alessandro Zucchelli
@ 2024-11-13 10:31 ` Jan Beulich
2024-11-13 10:48 ` Alessandro Zucchelli
0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2024-11-13 10:31 UTC (permalink / raw)
To: Alessandro Zucchelli
Cc: consulting, Simone Ballarin, xen-devel, Doug Goldstein,
Stefano Stabellini, Andrew Cooper, Julien Grall
On 13.11.2024 09:41, Alessandro Zucchelli wrote:
> This addresses violations of MISRA C:2012 Rule 5.2 which states as
> following: Identifiers declared in the same scope and name space shall
> be distinct.
>
> This deviation addresses violations of Rule 5.2 arising from
> identifiers generated through token pasting macros CHECK_NAME_ and
> DEFINE_COMPAT_HANDLE.
For each of the two, can you provide an example of where collisions
result? At least for the latter I can't even see how that would
work without the compiler complaining (i.e. the build breaking).
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
2024-11-13 10:31 ` Jan Beulich
@ 2024-11-13 10:48 ` Alessandro Zucchelli
2024-11-13 10:54 ` Jan Beulich
0 siblings, 1 reply; 7+ messages in thread
From: Alessandro Zucchelli @ 2024-11-13 10:48 UTC (permalink / raw)
To: Jan Beulich
Cc: consulting, Simone Ballarin, xen-devel, Doug Goldstein,
Stefano Stabellini, Andrew Cooper, Julien Grall
Hi Jan,
At this link you can see all the violations of Rule 5.2:
https://saas.eclairit.com:3787/fs/var/local/eclair/xen-project.ecdf/xen-project/people/bugseng/xen/ECLAIR_normal/40_characters/X86_64/8143097084/PROJECT.ecd;/by_service/MC3R1.R5.2.html
By deviating the two macros CHECK_NAME_ and DEFINE_COMPAT_HANDLE all the
violations are addressed.
On 2024-11-13 11:31, Jan Beulich wrote:
> On 13.11.2024 09:41, Alessandro Zucchelli wrote:
>> This addresses violations of MISRA C:2012 Rule 5.2 which states as
>> following: Identifiers declared in the same scope and name space shall
>> be distinct.
>>
>> This deviation addresses violations of Rule 5.2 arising from
>> identifiers generated through token pasting macros CHECK_NAME_ and
>> DEFINE_COMPAT_HANDLE.
>
> For each of the two, can you provide an example of where collisions
> result? At least for the latter I can't even see how that would
> work without the compiler complaining (i.e. the build breaking).
>
> Jan
--
Alessandro Zucchelli, B.Sc.
Software Engineer, BUGSENG (https://bugseng.com)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
2024-11-13 10:48 ` Alessandro Zucchelli
@ 2024-11-13 10:54 ` Jan Beulich
2024-11-14 2:23 ` Stefano Stabellini
0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2024-11-13 10:54 UTC (permalink / raw)
To: alessandro.zucchelli
Cc: consulting, Simone Ballarin, xen-devel, Doug Goldstein,
Stefano Stabellini, Andrew Cooper, Julien Grall
On 13.11.2024 11:48, Alessandro Zucchelli wrote:
> At this link you can see all the violations of Rule 5.2:
>
> https://saas.eclairit.com:3787/fs/var/local/eclair/xen-project.ecdf/xen-project/people/bugseng/xen/ECLAIR_normal/40_characters/X86_64/8143097084/PROJECT.ecd;/by_service/MC3R1.R5.2.html
Thank you. From a cursory look these all appear to be a result of the 40
chars limit we put in place (quite arbitrarily). That's not mentioned at
all ...
> By deviating the two macros CHECK_NAME_ and DEFINE_COMPAT_HANDLE all the
> violations are addressed.
>
> On 2024-11-13 11:31, Jan Beulich wrote:
>> On 13.11.2024 09:41, Alessandro Zucchelli wrote:
>>> This addresses violations of MISRA C:2012 Rule 5.2 which states as
>>> following: Identifiers declared in the same scope and name space shall
>>> be distinct.
>>>
>>> This deviation addresses violations of Rule 5.2 arising from
>>> identifiers generated through token pasting macros CHECK_NAME_ and
>>> DEFINE_COMPAT_HANDLE.
... in the description.
Together with the 5.4 patch having the same lack of context, I wonder
whether we shouldn't simply up that limit. Or else, as suggested there,
to instead exclude such derived identifiers. After all the derived ones
will be distinct as long as what they're derived from is distinct.
Finally - please don't top-post.
Jan
>> For each of the two, can you provide an example of where collisions
>> result? At least for the latter I can't even see how that would
>> work without the compiler complaining (i.e. the build breaking).
>>
>> Jan
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
2024-11-13 10:54 ` Jan Beulich
@ 2024-11-14 2:23 ` Stefano Stabellini
2024-11-15 11:08 ` Alessandro Zucchelli
0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2024-11-14 2:23 UTC (permalink / raw)
To: Jan Beulich
Cc: alessandro.zucchelli, consulting, Simone Ballarin, xen-devel,
Doug Goldstein, Stefano Stabellini, Andrew Cooper, Julien Grall
On Wed, 13 Nov 2024, Jan Beulich wrote:
> On 13.11.2024 11:48, Alessandro Zucchelli wrote:
> > At this link you can see all the violations of Rule 5.2:
> >
> > https://saas.eclairit.com:3787/fs/var/local/eclair/xen-project.ecdf/xen-project/people/bugseng/xen/ECLAIR_normal/40_characters/X86_64/8143097084/PROJECT.ecd;/by_service/MC3R1.R5.2.html
>
> Thank you. From a cursory look these all appear to be a result of the 40
> chars limit we put in place (quite arbitrarily). That's not mentioned at
> all ...
>
> > By deviating the two macros CHECK_NAME_ and DEFINE_COMPAT_HANDLE all the
> > violations are addressed.
> >
> > On 2024-11-13 11:31, Jan Beulich wrote:
> >> On 13.11.2024 09:41, Alessandro Zucchelli wrote:
> >>> This addresses violations of MISRA C:2012 Rule 5.2 which states as
> >>> following: Identifiers declared in the same scope and name space shall
> >>> be distinct.
> >>>
> >>> This deviation addresses violations of Rule 5.2 arising from
> >>> identifiers generated through token pasting macros CHECK_NAME_ and
> >>> DEFINE_COMPAT_HANDLE.
>
> ... in the description.
>
> Together with the 5.4 patch having the same lack of context, I wonder
> whether we shouldn't simply up that limit.
Yes: if we up to the limit to 64 (another arbitrary number), can be mark
both 5.4 and 5.1 as clean? If so, I think we should do it right away.
> Or else, as suggested there,
> to instead exclude such derived identifiers. After all the derived ones
> will be distinct as long as what they're derived from is distinct.
>
> Finally - please don't top-post.
>
> Jan
>
> >> For each of the two, can you provide an example of where collisions
> >> result? At least for the latter I can't even see how that would
> >> work without the compiler complaining (i.e. the build breaking).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
2024-11-14 2:23 ` Stefano Stabellini
@ 2024-11-15 11:08 ` Alessandro Zucchelli
2024-11-16 0:23 ` Stefano Stabellini
0 siblings, 1 reply; 7+ messages in thread
From: Alessandro Zucchelli @ 2024-11-15 11:08 UTC (permalink / raw)
To: Stefano Stabellini
Cc: Jan Beulich, consulting, Simone Ballarin, xen-devel,
Doug Goldstein, Andrew Cooper, Julien Grall
On 2024-11-14 03:23, Stefano Stabellini wrote:
> On Wed, 13 Nov 2024, Jan Beulich wrote:
>> On 13.11.2024 11:48, Alessandro Zucchelli wrote:
>> > At this link you can see all the violations of Rule 5.2:
>> >
>> > https://saas.eclairit.com:3787/fs/var/local/eclair/xen-project.ecdf/xen-project/people/bugseng/xen/ECLAIR_normal/40_characters/X86_64/8143097084/PROJECT.ecd;/by_service/MC3R1.R5.2.html
>>
>> Thank you. From a cursory look these all appear to be a result of the
>> 40
>> chars limit we put in place (quite arbitrarily). That's not mentioned
>> at
>> all ...
>>
>> > By deviating the two macros CHECK_NAME_ and DEFINE_COMPAT_HANDLE all the
>> > violations are addressed.
>> >
>> > On 2024-11-13 11:31, Jan Beulich wrote:
>> >> On 13.11.2024 09:41, Alessandro Zucchelli wrote:
>> >>> This addresses violations of MISRA C:2012 Rule 5.2 which states as
>> >>> following: Identifiers declared in the same scope and name space shall
>> >>> be distinct.
>> >>>
>> >>> This deviation addresses violations of Rule 5.2 arising from
>> >>> identifiers generated through token pasting macros CHECK_NAME_ and
>> >>> DEFINE_COMPAT_HANDLE.
>>
>> ... in the description.
>>
>> Together with the 5.4 patch having the same lack of context, I wonder
>> whether we shouldn't simply up that limit.
>
> Yes: if we up to the limit to 64 (another arbitrary number), can be
> mark
> both 5.4 and 5.1 as clean? If so, I think we should do it right away.
>
Hi,
In doc/misra/rules.rst, the limit is documented as 40, but in the
configuration
file automation/eclair_analysis/ECLAIR/toolchain.ecl, it is set to 63.
If you intend to proceed by increasing the limit, you may ignore this
deviation
as well as my other deviation concerning Rule 5.4. In that case, please
update
the documentation in doc/misra/rules.rst to reflect the new limit.
>
>> Or else, as suggested there,
>> to instead exclude such derived identifiers. After all the derived
>> ones
>> will be distinct as long as what they're derived from is distinct.
>>
>> Finally - please don't top-post.
>>
>> Jan
>>
>> >> For each of the two, can you provide an example of where collisions
>> >> result? At least for the latter I can't even see how that would
>> >> work without the compiler complaining (i.e. the build breaking).
--
Alessandro Zucchelli, B.Sc.
Software Engineer, BUGSENG (https://bugseng.com)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2
2024-11-15 11:08 ` Alessandro Zucchelli
@ 2024-11-16 0:23 ` Stefano Stabellini
0 siblings, 0 replies; 7+ messages in thread
From: Stefano Stabellini @ 2024-11-16 0:23 UTC (permalink / raw)
To: Alessandro Zucchelli
Cc: Stefano Stabellini, Jan Beulich, consulting, Simone Ballarin,
xen-devel, Doug Goldstein, Andrew Cooper, Julien Grall
On Fri, 15 Nov 2024, Alessandro Zucchelli wrote:
> On 2024-11-14 03:23, Stefano Stabellini wrote:
> > On Wed, 13 Nov 2024, Jan Beulich wrote:
> > > On 13.11.2024 11:48, Alessandro Zucchelli wrote:
> > > > At this link you can see all the violations of Rule 5.2:
> > > >
> > > >
> > > https://saas.eclairit.com:3787/fs/var/local/eclair/xen-project.ecdf/xen-project/people/bugseng/xen/ECLAIR_normal/40_characters/X86_64/8143097084/PROJECT.ecd;/by_service/MC3R1.R5.2.html
> > >
> > > Thank you. From a cursory look these all appear to be a result of the 40
> > > chars limit we put in place (quite arbitrarily). That's not mentioned at
> > > all ...
> > >
> > > > By deviating the two macros CHECK_NAME_ and DEFINE_COMPAT_HANDLE all the
> > > > violations are addressed.
> > > >
> > > > On 2024-11-13 11:31, Jan Beulich wrote:
> > > >> On 13.11.2024 09:41, Alessandro Zucchelli wrote:
> > > >>> This addresses violations of MISRA C:2012 Rule 5.2 which states as
> > > >>> following: Identifiers declared in the same scope and name space shall
> > > >>> be distinct.
> > > >>>
> > > >>> This deviation addresses violations of Rule 5.2 arising from
> > > >>> identifiers generated through token pasting macros CHECK_NAME_ and
> > > >>> DEFINE_COMPAT_HANDLE.
> > >
> > > ... in the description.
> > >
> > > Together with the 5.4 patch having the same lack of context, I wonder
> > > whether we shouldn't simply up that limit.
> >
> > Yes: if we up to the limit to 64 (another arbitrary number), can be mark
> > both 5.4 and 5.1 as clean? If so, I think we should do it right away.
> >
> Hi,
> In doc/misra/rules.rst, the limit is documented as 40, but in the
> configuration
> file automation/eclair_analysis/ECLAIR/toolchain.ecl, it is set to 63.
>
> If you intend to proceed by increasing the limit, you may ignore this
> deviation
> as well as my other deviation concerning Rule 5.4. In that case, please update
> the documentation in doc/misra/rules.rst to reflect the new limit.
Got it. See:
https://marc.info/?l=xen-devel&m=173171643022486
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-16 0:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 8:41 [PATCH] xen:add deviations for MISRA C 2012 Rule R5.2 Alessandro Zucchelli
2024-11-13 10:31 ` Jan Beulich
2024-11-13 10:48 ` Alessandro Zucchelli
2024-11-13 10:54 ` Jan Beulich
2024-11-14 2:23 ` Stefano Stabellini
2024-11-15 11:08 ` Alessandro Zucchelli
2024-11-16 0:23 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.