Skip to contentSkip to conversation

SAF-* comment at the end of the line

DISCUSSION Luca Fancellu 3 participants 3 messages Dec 5, 2023 – Dec 13, 2023

lore
Share & tools
lore
#0 lore raw

Hi all,

I’m writing this mail to collect thoughts about the need to improve the SAF-* comments.

I think we reached a point where we need to use deviations for some violation that we want to keep in the code with a proper justification and an issue was raised when the comment cannot be put on a line on its own.

e.g.

If ( condition-1 &&

     condition-2 &&
      [...] )
{
    ...
}

For example in the code above, if the violation is in the second condition, breaking the conditions to have an empty line between them for the SAF-* comment is not ideal, so we could maybe improve the in-code comment to be used at the end of the line:

e.g.

If ( condition-1 &&

     condition-2 && /* SAF-*-safe [...] */
      [...] )
{
    ...
}

This might require also a deviation on the coding style to allow the comment to overcome the line length.

Bertrand, from his experience with safety certifications, feels that adding this feature could be enough to cover the majority of the cases where we need to deviate a violation in the code.

Using it consistently in the code base as the only way to deviate a violation can also help the adoption of the project to people who might want to fix them instead of deviating them, the only thing they would need to do is to grep for SAF-* to have a rough idea of how many justified violation are in the code.

Please let me know your thoughts before I start to implement the feature.

Cheers,
Luca

#1 lore raw
Quoted 32 lines · Luca Fancellu

Hi all,

I’m writing this mail to collect thoughts about the need to improve the SAF-* comments.

I think we reached a point where we need to use deviations for some violation that we want to keep in the code with a proper justification and an issue was raised when the comment cannot be put on a line on its own.

e.g.

If ( condition-1 &&

     condition-2 &&
      [...] )
{
    ...
}

For example in the code above, if the violation is in the second condition, breaking the conditions to have an empty line between them for the SAF-* comment is not ideal, so we could maybe improve the in-code comment to be used at the end of the line:

e.g.

If ( condition-1 &&

     condition-2 && /* SAF-*-safe [...] */
      [...] )
{
    ...
}

This might require also a deviation on the coding style to allow the comment to overcome the line length.

Quoted 8 lines

Bertrand, from his experience with safety certifications, feels that adding this feature could be enough to cover the majority of the cases where we need to deviate a violation in the code.

Using it consistently in the code base as the only way to deviate a violation can also help the adoption of the project to people who might want to fix them instead of deviating them, the only thing they would need to do is to grep for SAF-* to have a rough idea of how many justified violation are in the code.

Please let me know your thoughts before I start to implement the feature.

I think we need this feature and in fact we have already been adding it in an ad-hoc way with /* octal-ok */

It would like to remove octal-ok and use a generic way (SAF) to do the same.

#2 lore raw

Hi,

Quoted 40 lines · Stefano Stabellini
Quoted 39 lines · Luca Fancellu

Hi all,

I’m writing this mail to collect thoughts about the need to improve the SAF-* comments.

I think we reached a point where we need to use deviations for some violation that we want to keep in the code with a proper justification and an issue was raised when the comment cannot be put on a line on its own.

e.g.

If ( condition-1 &&

      condition-2 &&
       [...] )
{
     ...
}

For example in the code above, if the violation is in the second condition, breaking the conditions to have an empty line between them for the SAF-* comment is not ideal, so we could maybe improve the in-code comment to be used at the end of the line:

e.g.

If ( condition-1 &&

      condition-2 && /* SAF-*-safe [...] */
       [...] )
{
     ...
}

This might require also a deviation on the coding style to allow the comment to overcome the line length.

Bertrand, from his experience with safety certifications, feels that adding this feature could be enough to cover the majority of the cases where we need to deviate a violation in the code.

Using it consistently in the code base as the only way to deviate a violation can also help the adoption of the project to people who might want to fix them instead of deviating them, the only thing they would need to do is to grep for SAF-* to have a rough idea of how many justified violation are in the code.

Quoted 7 lines
Quoted 1 line

Please let me know your thoughts before I start to implement the feature.

I think we need this feature and in fact we have already been adding it in an ad-hoc way with /* octal-ok */

It would like to remove octal-ok and use a generic way (SAF) to do the same.

+1.

Cheers,

Signature · 1 line
Julien Grall