diff mbox series

[v2,1/3] docs/misra/rules.rst: add rule 16.6 and 20.12

Message ID 20240213223334.3693410-1-stefano.stabellini@amd.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] docs/misra/rules.rst: add rule 16.6 and 20.12 | expand

Commit Message

Stefano Stabellini Feb. 13, 2024, 10:33 p.m. UTC
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 docs/misra/rules.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Julien Grall Feb. 27, 2024, 12:53 p.m. UTC | #1
Hi Stefano,

On 13/02/2024 22:33, Stefano Stabellini wrote:
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,
Stefano Stabellini March 1, 2024, 1:56 a.m. UTC | #2
Hi all,

This patch broke gitlab-ci. The jobs failing are the cppcheck jobs.

xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j80
No summary for rule 20.12
WARNING: Can't open /builds/xen-project/hardware/xen/xen/drivers/video/font_8x14.c: 'utf-8' codec can't decode byte 0x9f in position 7228: invalid start byte
WARNING: Can't open /builds/xen-project/hardware/xen/xen/drivers/video/font_8x16.c: 'utf-8' codec can't decode byte 0x80 in position 5436: invalid start byte
WARNING: Can't open /builds/xen-project/hardware/xen/xen/drivers/video/font_8x8.c: 'utf-8' codec can't decode byte 0x80 in position 4410: invalid start byte
ERROR: An error occured when running:
/builds/xen-project/hardware/xen/xen/tools/convert_misra_doc.py -i /builds/xen-project/hardware/xen/docs/misra/rules.rst -o /builds/xen-project/hardware/xen/xen/cppcheck-misra.txt -j /builds/xen-project/hardware/xen/xen/cppcheck-misra.json 

I'll look into it as soon as possible.


On Tue, 13 Feb 2024, Stefano Stabellini wrote:
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
>  docs/misra/rules.rst | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 182331089d..c185366966 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -478,6 +478,12 @@ maintainers if you want to suggest a change.
>         adhere to Rule 16.2 would result in increased complexity and
>         maintenance difficulty, and could potentially introduce bugs. 
>  
> +   * - `Rule 16.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_06.c>`_
> +     - Required
> +     - Every switch statement shall have at least two switch-clauses
> +     - Single-clause switches are allowed when they do not involve a
> +       default label.
> +
>     * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
>       - Required
>       - A switch-expression shall not have essentially Boolean type
> @@ -554,6 +560,13 @@ maintainers if you want to suggest a change.
>         evaluation
>       -
>  
> +   * - `Rule 20.12 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_12.c>`_
> +     - A macro parameter used as an operand to the # or ## operators,
> +       which is itself subject to further macro replacement, shall only
> +       be used as an operand to these operators
> +     - Required
> +     - Variadic macros are allowed to violate the rule.
> +
>     * - `Rule 20.13 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_13.c>`_
>       - Required
>       - A line whose first token is # shall be a valid preprocessing
> -- 
> 2.25.1
> 
>
Nicola Vetrini March 1, 2024, 8 a.m. UTC | #3
On 2024-03-01 02:56, Stefano Stabellini wrote:
> Hi all,
> 
> This patch broke gitlab-ci. The jobs failing are the cppcheck jobs.
> 
> xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j80
> No summary for rule 20.12
> WARNING: Can't open 
> /builds/xen-project/hardware/xen/xen/drivers/video/font_8x14.c: 'utf-8' 
> codec can't decode byte 0x9f in position 7228: invalid start byte
> WARNING: Can't open 
> /builds/xen-project/hardware/xen/xen/drivers/video/font_8x16.c: 'utf-8' 
> codec can't decode byte 0x80 in position 5436: invalid start byte
> WARNING: Can't open 
> /builds/xen-project/hardware/xen/xen/drivers/video/font_8x8.c: 'utf-8' 
> codec can't decode byte 0x80 in position 4410: invalid start byte
> ERROR: An error occured when running:
> /builds/xen-project/hardware/xen/xen/tools/convert_misra_doc.py -i 
> /builds/xen-project/hardware/xen/docs/misra/rules.rst -o 
> /builds/xen-project/hardware/xen/xen/cppcheck-misra.txt -j 
> /builds/xen-project/hardware/xen/xen/cppcheck-misra.json
> 
> I'll look into it as soon as possible.
> 
> 
> On Tue, 13 Feb 2024, Stefano Stabellini wrote:
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
>> ---
>>  docs/misra/rules.rst | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>> 
>> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
>> index 182331089d..c185366966 100644
>> --- a/docs/misra/rules.rst
>> +++ b/docs/misra/rules.rst
>> @@ -478,6 +478,12 @@ maintainers if you want to suggest a change.
>>         adhere to Rule 16.2 would result in increased complexity and
>>         maintenance difficulty, and could potentially introduce bugs.
>> 
>> +   * - `Rule 16.6 
>> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_06.c>`_
>> +     - Required
>> +     - Every switch statement shall have at least two switch-clauses
>> +     - Single-clause switches are allowed when they do not involve a
>> +       default label.
>> +
>>     * - `Rule 16.7 
>> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
>>       - Required
>>       - A switch-expression shall not have essentially Boolean type
>> @@ -554,6 +560,13 @@ maintainers if you want to suggest a change.
>>         evaluation
>>       -
>> 
>> +   * - `Rule 20.12 
>> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_12.c>`_
>> +     - A macro parameter used as an operand to the # or ## operators,
>> +       which is itself subject to further macro replacement, shall 
>> only
>> +       be used as an operand to these operators
>> +     - Required
>> +     - Variadic macros are allowed to violate the rule.
>> +

I think here it wants the strictness "Required" first, and then the 
headline second "A macro parameter..."

>>     * - `Rule 20.13 
>> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_13.c>`_
>>       - Required
>>       - A line whose first token is # shall be a valid preprocessing
>> --
>> 2.25.1
>> 
>>
Michal Orzel March 1, 2024, 8:34 a.m. UTC | #4
On 01/03/2024 02:56, Stefano Stabellini wrote:
> 
> 
> Hi all,
> 
> This patch broke gitlab-ci. The jobs failing are the cppcheck jobs.
> 
> xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j80
> No summary for rule 20.12
This is the error message. For rule 20.12, the summary and severity are in reverse order.
I'll send a patch shortly.

~Michal
diff mbox series

Patch

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 182331089d..c185366966 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -478,6 +478,12 @@  maintainers if you want to suggest a change.
        adhere to Rule 16.2 would result in increased complexity and
        maintenance difficulty, and could potentially introduce bugs. 
 
+   * - `Rule 16.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_06.c>`_
+     - Required
+     - Every switch statement shall have at least two switch-clauses
+     - Single-clause switches are allowed when they do not involve a
+       default label.
+
    * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
      - Required
      - A switch-expression shall not have essentially Boolean type
@@ -554,6 +560,13 @@  maintainers if you want to suggest a change.
        evaluation
      -
 
+   * - `Rule 20.12 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_12.c>`_
+     - A macro parameter used as an operand to the # or ## operators,
+       which is itself subject to further macro replacement, shall only
+       be used as an operand to these operators
+     - Required
+     - Variadic macros are allowed to violate the rule.
+
    * - `Rule 20.13 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_13.c>`_
      - Required
      - A line whose first token is # shall be a valid preprocessing