[XEN PATCH] automation/eclair: allow parameter name "unused"

Federico Serafini posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/f2666bff183d5497b4993fdc27f6a66141ec8d85.1710433895.git.federico.serafini@bugseng.com
There is a newer version of this series
automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
docs/misra/deviations.rst                        | 5 +++++
2 files changed, 9 insertions(+)
[XEN PATCH] automation/eclair: allow parameter name "unused"
Posted by Federico Serafini 1 month, 2 weeks ago
Update ECLAIR configuration of MISRA C:2012 Rule 8.3 to deviate
violations involving parameter name "unused":
it makes explicit the intention of not using the parameter within
the function.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 9ac3ee4dfd..7e913050d2 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -167,6 +167,10 @@ const-qualified."
 -config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
 -doc_end
 
+-doc_begin="Parameter name \"unused\" is deliberate and makes explicit the intention of not using the parameter within the function."
+-config=MC3R1.R8.3,reports+={deliberate, "any_area(^.*parameter `unused'.*$)"}
+-doc_end
+
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"}
 -config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index ce855ddae6..941da4c40b 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -157,6 +157,11 @@ Deviations related to MISRA C:2012 Rules:
          - xen/common/unxz.c
          - xen/common/unzstd.c
 
+   * - R8.3
+     - Parameter name "unused" is deliberate and makes explicit the intention
+       of not using the parameter within the function.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R8.4
      - The definitions present in the files 'asm-offsets.c' for any architecture
        are used to generate definitions for asm modules, and are not called by
-- 
2.34.1
Re: [XEN PATCH] automation/eclair: allow parameter name "unused"
Posted by Jan Beulich 1 month, 2 weeks ago
On 14.03.2024 17:35, Federico Serafini wrote:
> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -157,6 +157,11 @@ Deviations related to MISRA C:2012 Rules:
>           - xen/common/unxz.c
>           - xen/common/unzstd.c
>  
> +   * - R8.3
> +     - Parameter name "unused" is deliberate and makes explicit the intention
> +       of not using the parameter within the function.
> +     - Tagged as `deliberate` for ECLAIR.

Before writing this, did you consider what is going to happen when a
function happens to have more than one unused parameter? They can't all
be named "unused", so some flexibility is needed here. E.g. by permitting
a number to be appended.

Jan
Re: [XEN PATCH] automation/eclair: allow parameter name "unused"
Posted by Federico Serafini 1 month, 2 weeks ago
On 15/03/24 10:12, Jan Beulich wrote:
> On 14.03.2024 17:35, Federico Serafini wrote:
>> --- a/docs/misra/deviations.rst
>> +++ b/docs/misra/deviations.rst
>> @@ -157,6 +157,11 @@ Deviations related to MISRA C:2012 Rules:
>>            - xen/common/unxz.c
>>            - xen/common/unzstd.c
>>   
>> +   * - R8.3
>> +     - Parameter name "unused" is deliberate and makes explicit the intention
>> +       of not using the parameter within the function.
>> +     - Tagged as `deliberate` for ECLAIR.
> 
> Before writing this, did you consider what is going to happen when a
> function happens to have more than one unused parameter? They can't all
> be named "unused", so some flexibility is needed here. E.g. by permitting
> a number to be appended.

Right, thanks for the observation.

-- 
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)
Re: [XEN PATCH] automation/eclair: allow parameter name "unused"
Posted by Stefano Stabellini 1 month, 2 weeks ago
On Thu, 14 Mar 2024, Federico Serafini wrote:
> Update ECLAIR configuration of MISRA C:2012 Rule 8.3 to deviate
> violations involving parameter name "unused":
> it makes explicit the intention of not using the parameter within
> the function.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
>  docs/misra/deviations.rst                        | 5 +++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
> index 9ac3ee4dfd..7e913050d2 100644
> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> @@ -167,6 +167,10 @@ const-qualified."
>  -config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
>  -doc_end
>  
> +-doc_begin="Parameter name \"unused\" is deliberate and makes explicit the intention of not using the parameter within the function."
> +-config=MC3R1.R8.3,reports+={deliberate, "any_area(^.*parameter `unused'.*$)"}
> +-doc_end
> +
>  -doc_begin="The following file is imported from Linux: ignore for now."
>  -file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"}
>  -config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
> diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
> index ce855ddae6..941da4c40b 100644
> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -157,6 +157,11 @@ Deviations related to MISRA C:2012 Rules:
>           - xen/common/unxz.c
>           - xen/common/unzstd.c
>  
> +   * - R8.3
> +     - Parameter name "unused" is deliberate and makes explicit the intention
> +       of not using the parameter within the function.
> +     - Tagged as `deliberate` for ECLAIR.
> +
>     * - R8.4
>       - The definitions present in the files 'asm-offsets.c' for any architecture
>         are used to generate definitions for asm modules, and are not called by
> -- 
> 2.34.1
>