Resolve issues related to macros in device_tree.h
v3 cover Resolve issues related to macros in device_tree.h
Xenia Ragiadakou (2):
xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7 xen/device_tree: remove incorrect and unused dt_irq() and
dt_irq_flags() macros
xen/include/xen/device_tree.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
Signature · 1 line
2.37.2
PATCH v3 1/2 xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
---
Changes in v3:
- the fixes are based solely to Eclair findings (the tool has been adjusted to report only those violations that can result to a bug)
- reflect this in the commit title
xen/include/xen/device_tree.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
xen/include/xen/device_tree.h +7 -7
@@ -37,11 +37,11 @@ struct dt_device_match {const void *data; }; -#define __DT_MATCH_PATH (p) .path = p -#define __DT_MATCH_TYPE (typ) .type = typ -#define __DT_MATCH_COMPATIBLE (compat) .compatible = compat +#define __DT_MATCH_PATH (p) .path = (p) +#define __DT_MATCH_TYPE (typ) .type = (typ) +#define __DT_MATCH_COMPATIBLE (compat) .compatible = (compat)#define __DT_MATCH_NOT_AVAILABLE () .not_available = 1 -#define __DT_MATCH_PROP (p) .prop = p +#define __DT_MATCH_PROP (p) .prop = (p)#define DT_MATCH_PATH (p) { __DT_MATCH_PATH(p) }#define DT_MATCH_TYPE (typ) { __DT_MATCH_TYPE(typ) }
@@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct dt_device_match *matches);#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1#define dt_for_each_property_node (dn, pp) \ - for ( pp = dn->properties; pp != NULL; pp = pp->next ) + for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )#define dt_for_each_device_node (dt, dn) \ - for ( dn = dt; dn != NULL; dn = dn->allnext ) + for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )#define dt_for_each_child_node (dt, dn) \ - for ( dn = dt->child; dn != NULL; dn = dn->sibling ) + for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )/* Helper to read a big number; size is in cells (not bytes) */ static inline u64 dt_read_number (const __be32 *cell,int size)
Signature · 1 line
2.37.2
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Hi Xenia,
Quoted 54 lines · Xenia Ragiadakou
Signed-off-by Xenia Ragiadakou <[email protected]>---
Changes in v3:
- the fixes are based solely to Eclair findings (the tool has been adjusted to report only those violations that can result to a bug)
- reflect this in the commit title
xen/include/xen/device_tree.h| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)xen/include/xen/device_tree.h +7
-7@@ -37,11 +37,11 @@ struct dt_device_match {const void *data; }; -#define __DT_MATCH_PATH (p) .path = p -#define __DT_MATCH_TYPE (typ) .type = typ -#define __DT_MATCH_COMPATIBLE (compat) .compatible = compat +#define __DT_MATCH_PATH (p) .path = (p) +#define __DT_MATCH_TYPE (typ) .type = (typ) +#define __DT_MATCH_COMPATIBLE (compat) .compatible = (compat)#define __DT_MATCH_NOT_AVAILABLE () .not_available = 1 -#define __DT_MATCH_PROP (p) .prop = p +#define __DT_MATCH_PROP (p) .prop = (p)#define DT_MATCH_PATH (p) { __DT_MATCH_PATH(p) }#define DT_MATCH_TYPE (typ) { __DT_MATCH_TYPE(typ) }@@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct dt_device_match *matches);#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1#define dt_for_each_property_node (dn, pp) \ - for ( pp = dn->properties; pp != NULL; pp = pp->next ) + for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )#define dt_for_each_device_node (dt, dn) \ - for ( dn = dt; dn != NULL; dn = dn->allnext ) + for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )#define dt_for_each_child_node (dt, dn) \ - for ( dn = dt->child; dn != NULL; dn = dn->sibling ) + for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )/* Helper to read a big number; size is in cells (not bytes) */ static inline u64 dt_read_number (const __be32 *cell,int size)Signature · 1 line
2.37.2
While the changes looks sensible to me, I’ve had a look in eclair but I was unable to find the findings, here what findings I have in the latest report:
https://eclairit.com:8443/job/XEN/Target=ARM64,agent=docker1/lastBuild/eclair/packageName.832204620/fileName.1811675806/
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Hi Luca,
Quoted 52 lines · Luca Fancellu
Hi Xenia,
Quoted 48 lines · Xenia Ragiadakou
Signed-off-by Xenia Ragiadakou <[email protected]>---
Changes in v3:
- the fixes are based solely to Eclair findings (the tool has been adjusted to report only those violations that can result to a bug)
- reflect this in the commit title
xen/include/xen/device_tree.h| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)xen/include/xen/device_tree.h +7
-7@@ -37,11 +37,11 @@ struct dt_device_match {const void *data; }; -#define __DT_MATCH_PATH (p) .path = p -#define __DT_MATCH_TYPE (typ) .type = typ -#define __DT_MATCH_COMPATIBLE (compat) .compatible = compat +#define __DT_MATCH_PATH (p) .path = (p) +#define __DT_MATCH_TYPE (typ) .type = (typ) +#define __DT_MATCH_COMPATIBLE (compat) .compatible = (compat)#define __DT_MATCH_NOT_AVAILABLE () .not_available = 1 -#define __DT_MATCH_PROP (p) .prop = p +#define __DT_MATCH_PROP (p) .prop = (p)#define DT_MATCH_PATH (p) { __DT_MATCH_PATH(p) }#define DT_MATCH_TYPE (typ) { __DT_MATCH_TYPE(typ) }@@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct dt_device_match *matches);#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1#define dt_for_each_property_node (dn, pp) \ - for ( pp = dn->properties; pp != NULL; pp = pp->next ) + for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )#define dt_for_each_device_node (dt, dn) \ - for ( dn = dt; dn != NULL; dn = dn->allnext ) + for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )#define dt_for_each_child_node (dt, dn) \ - for ( dn = dt->child; dn != NULL; dn = dn->sibling ) + for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )
Quoted 10 lines
Quoted 6 lines
xen/include/xen/device_tree.h +0
-1/* Helper to read a big number; size is in cells (not bytes) */ static inline u64 dt_read_number (const __be32 *cell,int size) --2.37.2
While the changes looks sensible to me, I’ve had a look in eclair but I was unable to find the findings, here what findings I have in the latest report:
https://eclairit.com:8443/job/XEN/Target=ARM64,agent=docker1/lastBuild/eclair/packageName.832204620/fileName.1811675806/
Eclair does not report violations at the definition but rather at the use. Check domain_build.c for example to see the reports for 20.7 related to these macros.
~Michal
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Quoted 70 lines · Michal Orzel
Hi Luca,
Quoted 52 lines · Luca Fancellu
Hi Xenia,
Quoted 48 lines · Xenia Ragiadakou
Signed-off-by Xenia Ragiadakou <[email protected]>---
Changes in v3:
- the fixes are based solely to Eclair findings (the tool has been adjusted to report only those violations that can result to a bug)
- reflect this in the commit title
xen/include/xen/device_tree.h| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)xen/include/xen/device_tree.h +7
-7@@ -37,11 +37,11 @@ struct dt_device_match {const void *data; }; -#define __DT_MATCH_PATH (p) .path = p -#define __DT_MATCH_TYPE (typ) .type = typ -#define __DT_MATCH_COMPATIBLE (compat) .compatible = compat +#define __DT_MATCH_PATH (p) .path = (p) +#define __DT_MATCH_TYPE (typ) .type = (typ) +#define __DT_MATCH_COMPATIBLE (compat) .compatible = (compat)#define __DT_MATCH_NOT_AVAILABLE () .not_available = 1 -#define __DT_MATCH_PROP (p) .prop = p +#define __DT_MATCH_PROP (p) .prop = (p)#define DT_MATCH_PATH (p) { __DT_MATCH_PATH(p) }#define DT_MATCH_TYPE (typ) { __DT_MATCH_TYPE(typ) }@@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct dt_device_match *matches);#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1#define dt_for_each_property_node (dn, pp) \ - for ( pp = dn->properties; pp != NULL; pp = pp->next ) + for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )#define dt_for_each_device_node (dt, dn) \ - for ( dn = dt; dn != NULL; dn = dn->allnext ) + for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )#define dt_for_each_child_node (dt, dn) \ - for ( dn = dt->child; dn != NULL; dn = dn->sibling ) + for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )Quoted 10 lines
Quoted 6 lines
xen/include/xen/device_tree.h +0
-1/* Helper to read a big number; size is in cells (not bytes) */ static inline u64 dt_read_number (const __be32 *cell,int size) --2.37.2
While the changes looks sensible to me, I’ve had a look in eclair but I was unable to find the findings, here what findings I have in the latest report:
https://eclairit.com:8443/job/XEN/Target=ARM64,agent=docker1/lastBuild/eclair/packageName.832204620/fileName.1811675806/
Quoted 2 lines
Eclair does not report violations at the definition but rather at the use. Check
domain_build.cfor example to see the reports for 20.7 related to these macros.
Wow yes that’s right, a bit annoying to link the issues! Who knows if there is a mode to make it point out the violation at the definition like cppcheck.
I’ll review this patch later this week if I manage to find the time
Quoted 2 lines
~Michal
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
In reply to Xenia RagiadakouQuoted 4 lines · Xenia Ragiadakou
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
For me the changes looks good
Quoted 52 lines
Signed-off-by Xenia Ragiadakou <[email protected]>---
Changes in v3:
- the fixes are based solely to Eclair findings (the tool has been adjusted to report only those violations that can result to a bug)
- reflect this in the commit title
xen/include/xen/device_tree.h| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)xen/include/xen/device_tree.h +7
-7@@ -37,11 +37,11 @@ struct dt_device_match {const void *data; }; -#define __DT_MATCH_PATH (p) .path = p -#define __DT_MATCH_TYPE (typ) .type = typ -#define __DT_MATCH_COMPATIBLE (compat) .compatible = compat +#define __DT_MATCH_PATH (p) .path = (p) +#define __DT_MATCH_TYPE (typ) .type = (typ) +#define __DT_MATCH_COMPATIBLE (compat) .compatible = (compat)#define __DT_MATCH_NOT_AVAILABLE () .not_available = 1 -#define __DT_MATCH_PROP (p) .prop = p +#define __DT_MATCH_PROP (p) .prop = (p)#define DT_MATCH_PATH (p) { __DT_MATCH_PATH(p) }#define DT_MATCH_TYPE (typ) { __DT_MATCH_TYPE(typ) }@@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct dt_device_match *matches);#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1#define dt_for_each_property_node (dn, pp) \ - for ( pp = dn->properties; pp != NULL; pp = pp->next ) + for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )#define dt_for_each_device_node (dt, dn) \ - for ( dn = dt; dn != NULL; dn = dn->allnext ) + for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )#define dt_for_each_child_node (dt, dn) \ - for ( dn = dt->child; dn != NULL; dn = dn->sibling ) + for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )/* Helper to read a big number; size is in cells (not bytes) */ static inline u64 dt_read_number (const __be32 *cell,int size)Signature · 1 line
2.37.2
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Hi,
Quoted 6 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
Quoted 4 lines
For me the changes looks good
Reviewed-by Luca Fancellu <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Quoted 8 lines · Julien Grall
Hi,
Quoted 5 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
Quoted 6 lines
Quoted 1 line
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
Quoted 8 lines
Quoted 5 lines
For me the changes looks good
Reviewed-by Luca Fancellu <[email protected]>Cheers,
Signature · 1 line
Xenia
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Quoted 10 lines · Xenia Ragiadakou
Quoted 8 lines · Julien Grall
Hi,
Quoted 5 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
I am a bit confused with this statement. From misra/..., we are supporting rule 20.7. So why aren't applying it strictly?
And if it is not applied as-is, shouldn't we document the violation (if any)?
Quoted 4 lines
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
I am OK with this. Is there any ID from Eclair that could be used to track each error (and so we can confirm they have disappeared)?
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Quoted 18 lines · Julien Grall
Quoted 15 lines · Xenia Ragiadakou
Quoted 13 lines · Julien Grall
Hi,
Quoted 6 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
This can be dealt on commit if you propose a new commit message.
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
I am a bit confused with this statement. From misra/..., we are supporting rule 20.7. So why aren't applying it strictly?
And if it is not applied as-is, shouldn't we document the violation (if any)?
I applied it strictly on v2, but there was no review.
Then Eclair was adjusted to have a less strict approach. Still there is a finding asking to add parentheses around dt in dt_for_each_device_node(dt, dn), i.e dn = (dt);, to which AFAIK you object.
Quoted 7 lines
Quoted 5 lines
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
I am OK with this. Is there any ID from Eclair that could be used to track each error (and so we can confirm they have disappeared)?
I am not aware of any.
The patch can be decoupled from misra and Eclair (I mean have a generic commit title) and just mention in the commit message that it fixes some Eclair findings for MISRA C rule 20.7.
Quoted 3 lines
Cheers,
Signature · 1 line
Xenia
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Hi,
Quoted 21 lines · Xenia Ragiadakou
Quoted 20 lines · Julien Grall
Quoted 17 lines · Xenia Ragiadakou
Quoted 14 lines · Julien Grall
Hi,
Quoted 6 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
I am a bit confused with this statement. From misra/..., we are supporting rule 20.7. So why aren't applying it strictly?
And if it is not applied as-is, shouldn't we document the violation (if any)?
I applied it strictly on v2, but there was no review.
Ah! In general it is best to ping if there are no answers.
Quoted 1 line
Then Eclair was adjusted to have a less strict approach. Still there is a finding asking to add parentheses around dt in
dt_for_each_device_node(dt, dn), i.e dn = (dt);, to which AFAIK you object.
Are you referring to the discussion in [1]? If so, I wasn't totally opposed to the suggestion so long we are consistent.
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
I am OK with this. Is there any ID from Eclair that could be used to track each error (and so we can confirm they have disappeared)?
I am not aware of any.
Hmmm ok. It might be a nice feature to suggest in Eclair because anyone can check whether an issue was resolved.
Here, I don't exactly know what to check in Eclair. So I have to rely on you. Anyway, nothing that can be fixed for this commit.
Quoted 2 lines
The patch can be decoupled from misra and Eclair (I mean have a generic commit title) and just mention in the commit message that it fixes some Eclair findings for MISRA C rule 20.7.
I have a slight preference for a more generic title. But the current one also work for me.
I will commit later on.
Cheers,
Quoted 5 lines
Quoted 4 lines
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Hi Julien,
Quoted 26 lines · Julien Grall
Hi,
Quoted 23 lines · Xenia Ragiadakou
Quoted 22 lines · Julien Grall
Quoted 18 lines · Xenia Ragiadakou
Quoted 8 lines · Julien Grall
Hi,
Quoted 5 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
Quoted 6 lines
Quoted 1 line
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
I am a bit confused with this statement. From misra/..., we are supporting rule 20.7. So why aren't applying it strictly?
And if it is not applied as-is, shouldn't we document the violation (if any)?
I applied it strictly on v2, but there was no review.
Ah! In general it is best to ping if there are no answers.
Me too I ve forgotten about it. A ticket in gitlab reminded me that it was pending.
Quoted 4 lines
Quoted 2 lines
Then Eclair was adjusted to have a less strict approach. Still there is a finding asking to add parentheses around dt in
dt_for_each_device_node(dt, dn), i.e dn = (dt);, to which AFAIK you object.Are you referring to the discussion in [1]? If so, I wasn't totally opposed to the suggestion so long we are consistent.
I am not able to find [1]. I 'm referring to the discussion in [email protected] and [email protected]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
I am OK with this. Is there any ID from Eclair that could be used to track each error (and so we can confirm they have disappeared)?
I am not aware of any.
Hmmm ok. It might be a nice feature to suggest in Eclair because anyone can check whether an issue was resolved.
Currently, the violations in Eclair are reported per macro call (I guess because it is acceptable to have parentheses around the macro args) so it is difficult to track all of them.
Quoted 7 lines
Here, I don't exactly know what to check in Eclair. So I have to rely on you. Anyway, nothing that can be fixed for this commit.
Quoted 2 lines
The patch can be decoupled from misra and Eclair (I mean have a generic commit title) and just mention in the commit message that it fixes some Eclair findings for MISRA C rule 20.7.
I have a slight preference for a more generic title. But the current one also work for me.
It can be changed into "xen/device_tree: add parentheses around macro parameters"
Quoted 2 lines
I will commit later on.
Do you want me to send a v4?
Quoted 10 lines
Cheers,
Quoted 5 lines
Quoted 4 lines
Cheers,
Signature · 1 line
Xenia
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Quoted 1 line · Xenia Ragiadakou
Hi Julien,
Hi Xenia,
Quoted 36 lines · Julien Grall
Quoted 26 lines
Hi,
Quoted 23 lines · Xenia Ragiadakou
Quoted 22 lines · Julien Grall
Quoted 18 lines · Xenia Ragiadakou
Quoted 8 lines · Julien Grall
Hi,
Quoted 5 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
Quoted 6 lines
Quoted 1 line
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
I am a bit confused with this statement. From misra/..., we are supporting rule 20.7. So why aren't applying it strictly?
And if it is not applied as-is, shouldn't we document the violation (if any)?
I applied it strictly on v2, but there was no review.
Ah! In general it is best to ping if there are no answers.
Quoted 8 lines
Me too I ve forgotten about it. A ticket in gitlab reminded me that it was pending.
Quoted 4 lines
Quoted 2 lines
Then Eclair was adjusted to have a less strict approach. Still there is a finding asking to add parentheses around dt in
dt_for_each_device_node(dt, dn), i.e dn = (dt);, to which AFAIK you object.Are you referring to the discussion in [1]? If so, I wasn't totally opposed to the suggestion so long we are consistent.
I am not able to find [1].
https://lore.kernel.org/xen-devel/[email protected]/
which is...
Quoted 1 line
I 'm referring to the discussion in [email protected] and [email protected]
... a reply to this message. At the end of that reply, I said that I wasn't totally against adding the parentheses but we should be consistent in how we do it.
Quoted 22 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
I am OK with this. Is there any ID from Eclair that could be used to track each error (and so we can confirm they have disappeared)?
I am not aware of any.
Hmmm ok. It might be a nice feature to suggest in Eclair because anyone can check whether an issue was resolved.
Currently, the violations in Eclair are reported per macro call (I guess because it is acceptable to have parentheses around the macro args) so it is difficult to track all of them.
Quoted 6 lines
Here, I don't exactly know what to check in Eclair. So I have to rely on you. Anyway, nothing that can be fixed for this commit.
Quoted 2 lines
The patch can be decoupled from misra and Eclair (I mean have a generic commit title) and just mention in the commit message that it fixes some Eclair findings for MISRA C rule 20.7.
Quoted 8 lines
Quoted 1 line
I have a slight preference for a more generic title. But the current one also work for me.
It can be changed into "xen/device_tree: add parentheses around macro parameters"
Quoted 2 lines
I will commit later on.
Do you want me to send a v4?
No need. It is now merged with the following commit message:
xen/device_tree: add parentheses around macro parameters
Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended
order of evaluation.
This is fixing some ECLAIR finding for Misra Rule 20.7.
Link:
https://lore.kernel.org/xen-devel/[email protected]/
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v3 1/2] xen/device_tree: fix Eclair findings for MISRA C 2012 Rule 20.7
Quoted 52 lines · Julien Grall
Quoted 1 line · Xenia Ragiadakou
Hi Julien,
Hi Xenia,
Quoted 36 lines · Julien Grall
Quoted 26 lines
Hi,
Quoted 23 lines · Xenia Ragiadakou
Quoted 22 lines · Julien Grall
Quoted 18 lines · Xenia Ragiadakou
Quoted 8 lines · Julien Grall
Hi,
Quoted 5 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
Quoted 6 lines
Quoted 1 line
I’m not really a supporter of empty commit message, but it’s up to the maintainer :)
+1. In this case a brief summary of the rule would be handy for those that are not well-versed with MISRA.
This can be dealt on commit if you propose a new commit message.
I 'm refrained from stating the rule as is because it is strict and it is not applied as is.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
I am a bit confused with this statement. From misra/..., we are supporting rule 20.7. So why aren't applying it strictly?
And if it is not applied as-is, shouldn't we document the violation (if any)?
I applied it strictly on v2, but there was no review.
Ah! In general it is best to ping if there are no answers.
Quoted 8 lines
Me too I ve forgotten about it. A ticket in gitlab reminded me that it was pending.
Quoted 4 lines
Quoted 2 lines
Then Eclair was adjusted to have a less strict approach. Still there is a finding asking to add parentheses around dt in
dt_for_each_device_node(dt, dn), i.e dn = (dt);, to which AFAIK you object.Are you referring to the discussion in [1]? If so, I wasn't totally opposed to the suggestion so long we are consistent.
I am not able to find [1].
Quoted 8 lines
https://lore.kernel.org/xen-devel/[email protected]/
which is...
Quoted 1 line
I 'm referring to the discussion in [email protected] and [email protected]
... a reply to this message. At the end of that reply, I said that I wasn't totally against adding the parentheses but we should be consistent in how we do it.
Ok, I must have got it wrong.
Quoted 40 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
"Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended order of evaluation."
Is this ok?
I am OK with this. Is there any ID from Eclair that could be used to track each error (and so we can confirm they have disappeared)?
I am not aware of any.
Hmmm ok. It might be a nice feature to suggest in Eclair because anyone can check whether an issue was resolved.
Currently, the violations in Eclair are reported per macro call (I guess because it is acceptable to have parentheses around the macro args) so it is difficult to track all of them.
Quoted 6 lines
Here, I don't exactly know what to check in Eclair. So I have to rely on you. Anyway, nothing that can be fixed for this commit.
Quoted 2 lines
The patch can be decoupled from misra and Eclair (I mean have a generic commit title) and just mention in the commit message that it fixes some Eclair findings for MISRA C rule 20.7.
Quoted 8 lines
Quoted 1 line
I have a slight preference for a more generic title. But the current one also work for me.
It can be changed into "xen/device_tree: add parentheses around macro parameters"
Quoted 2 lines
I will commit later on.
Do you want me to send a v4?
No need. It is now merged with the following commit message:
xen/device_tree: add parentheses around macro parameters
Add parentheses around macro parameters when the precedence and associativity of the performed operators can lead to unintended
order of evaluation.
Quoted 8 lines
This is fixing some ECLAIR finding for Misra Rule 20.7.
Link:
https://lore.kernel.org/xen-devel/[email protected]/Signed-off-by Xenia Ragiadakou <[email protected]>Reviewed-by Luca Fancellu <[email protected]>[jgrall: Reworded the commit message]Acked-by Julien Grall <[email protected]>
Thanks a lot.
Quoted 3 lines
Cheers,
Signature · 1 line
Xenia
PATCH v3 2/2 xen/device_tree: remove incorrect and unused dt_irq() and dt_irq_flags() macros
In reply to Xenia RagiadakouMacro dt_irq() is broken because the macro parameter has the same name with the struct dt_irq member "irq".
Macro dt_irq_flags() is broken as well because struct dt_irq has no member named "flags".
Since no one seems to have ever tried to use them and eventually stumble upon the issues above, remove them instead of fixing them.
---
Changes in v3:
- new patch
xen/include/xen/device_tree.h | 3 --- 1 file changed, 3 deletions(-)
xen/include/xen/device_tree.h +0 -3
@@ -159,9 +159,6 @@ struct dt_raw_irq {u32 specifier[DT_MAX_IRQ_SPEC ]; }; -#define dt_irq (irq) ((irq)->irq) -#define dt_irq_flags (irq) ((irq)->flags) - typedef int (*device_tree_node_func)(const void *fdt, int node, const char *name, int depth, u32 address_cells, u32 size_cells,
Signature · 1 line
2.37.2
Re: [PATCH v3 2/2] xen/device_tree: remove incorrect and unused dt_irq() and dt_irq_flags() macros
Quoted 6 lines · Xenia Ragiadakou
Macro
dt_irq()is broken because the macro parameter has the same name with the structdt_irqmember "irq".
I’m not sure about the wording “broken”, it should work anyway or am I wrong?
Quoted 2 lines
Macro
dt_irq_flags()is broken as well because structdt_irqhas no member named "flags".
Yes this depends if the macro was meant to access the structure dt_irq, I’ve had a look on the commit introducing it but I could not figure out the usage.
Quoted 32 lines
Since no one seems to have ever tried to use them and eventually stumble upon the issues above, remove them instead of fixing them.
Fixes 886f34045bf0 ("xen/arm: Add helpers to retrieve an interrupt description from the device tree")Signed-off-by Xenia Ragiadakou <[email protected]>---
Changes in v3:
- new patch
xen/include/xen/device_tree.h| 3 ---1 file changed, 3 deletions(-)xen/include/xen/device_tree.h +0
-3@@ -159,9 +159,6 @@ struct dt_raw_irq {u32 specifier[DT_MAX_IRQ_SPEC ]; }; -#define dt_irq (irq) ((irq)->irq) -#define dt_irq_flags (irq) ((irq)->flags) - typedef int (*device_tree_node_func)(const void *fdt, int node, const char *name, int depth, u32 address_cells, u32 size_cells,Signature · 1 line
2.37.2
They seems indeed unused, so for me the code looks good:
Re: [PATCH v3 2/2] xen/device_tree: remove incorrect and unused dt_irq() and dt_irq_flags() macros
Hi Luca
Quoted 8 lines · Luca Fancellu
Quoted 6 lines · Xenia Ragiadakou
Macro
dt_irq()is broken because the macro parameter has the same name with the structdt_irqmember "irq".I’m not sure about the wording “broken”, it should work anyway or am I wrong?
No, it won't work because the structure member will be substituted as well by the macro argument (for instance dt_irq(blah) will be replaced by (blah)->blah).
Quoted 6 lines
Quoted 3 lines
Macro
dt_irq_flags()is broken as well because structdt_irqhas no member named "flags".Yes this depends if the macro was meant to access the structure
dt_irq, I’ve had a look on the commit introducing it but I could not figure out the usage.
Given the macro name, I assumed that it was meant to be used for accessing a dt_irq field.
Quoted 39 lines
Quoted 33 lines
Since no one seems to have ever tried to use them and eventually stumble upon the issues above, remove them instead of fixing them.
Fixes 886f34045bf0 ("xen/arm: Add helpers to retrieve an interrupt description from the device tree")Signed-off-by Xenia Ragiadakou <[email protected]>---
Changes in v3:
- new patch
xen/include/xen/device_tree.h| 3 ---1 file changed, 3 deletions(-)xen/include/xen/device_tree.h +0
-3@@ -159,9 +159,6 @@ struct dt_raw_irq {u32 specifier[DT_MAX_IRQ_SPEC ]; }; -#define dt_irq (irq) ((irq)->irq) -#define dt_irq_flags (irq) ((irq)->flags) - typedef int (*device_tree_node_func)(const void *fdt, int node, const char *name, int depth, u32 address_cells, u32 size_cells,Signature · 1 line
2.37.2They seems indeed unused, so for me the code looks good:
Reviewed-by Luca Fancellu <[email protected]>
Signature · 1 line
Xenia
Re: [PATCH v3 2/2] xen/device_tree: remove incorrect and unused dt_irq() and dt_irq_flags() macros
Quoted 14 lines · Xenia Ragiadakou
Hi Luca
Quoted 5 lines · Luca Fancellu
Quoted 4 lines · Xenia Ragiadakou
Macro
dt_irq()is broken because the macro parameter has the same name with the structdt_irqmember "irq".I’m not sure about the wording “broken”, it should work anyway or am I wrong?
No, it won't work because the structure member will be substituted as well by the macro argument (for instance
dt_irq(blah)will be replaced by (blah)->blah).
Yes you are right, I was reading it in the wrong way!
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Macro
dt_irq_flags()is broken as well because structdt_irqhas no member named "flags".Yes this depends if the macro was meant to access the structure
dt_irq, I’ve had a look on the commit introducing it but I could not figure out the usage.Given the macro name, I assumed that it was meant to be used for accessing a
dt_irqfield.
Yes I would come to the same conclusion