From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: sstabellini@kernel.org, michal.orzel@amd.com,
xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
consulting@bugseng.com,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH v2 4/4] x86/setup: address MISRA C:2012 Rule 5.3
Date: Mon, 07 Aug 2023 16:10:02 +0200 [thread overview]
Message-ID: <50fe2600058c0e5224b822ad49db75eb@bugseng.com> (raw)
In-Reply-To: <66d0ea64-0363-db7b-b4e2-5e404bff28d2@suse.com>
On 07/08/2023 15:42, Jan Beulich wrote:
> On 07.08.2023 15:18, Nicola Vetrini wrote:
>> On 07/08/2023 15:05, Jan Beulich wrote:
>>> On 04.08.2023 10:03, Nicola Vetrini wrote:
>>>> The parameters renamed in the function declaration caused shadowing
>>>> with the homonymous variable in 'xen/common/efi/boot.c'. Renaming
>>>> them also addresses Rule 8.3:
>>>> "All declarations of an object or function shall use the same names
>>>> and type qualifiers".
>>>
>>> Can you explain to me how shadowing can happen in a declaration? I
>>> would focus on 8.3 here, and only mention the other name collision.
>>
>> There's "static struct file __initdata kernel;" in
>> xen/common/efi/boot.c, which
>> is visible when the function is declared. Since renaming these
>> parameter
>> names would
>> have been addressed by Federico for R8.3 anyway, my intention was to
>> address them both.
>
> I understand what you say, but your reply doesn't answer my question.
> Just to emphasize the important aspect: I could see the shadowing
> aspect if the _definition_ of construct_dom0() used "kernel". But I'm
> asking about declarations (the one here as well as in general): I
> can't see how any shadowing can occur without there being any code in
> the position of using any such variable / parameter. IOW if Eclair
> spits out 5.3 violations on declarations, I'm inclined to think it's
> wrong. (Because of 8.3 a violation there would then need dealing with
> anyway, but _only_ because of 8.3, if the definition is already okay.)
>
> Jan
The declaration itself is a scope and shadowing can happen, as in:
int x;
void f(int x, int arr[x]);
Now, the example is a bit contrived, but the fact that the rule does not
list any
exception motivates this behaviour. In any case, I'll try to rephrase
the commit message
to be less ambiguous.
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
prev parent reply other threads:[~2023-08-07 14:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 8:03 [XEN PATCH v2 0/4] x86: address some violations of MISRA C:2012 Rule 5.3 Nicola Vetrini
2023-08-04 8:03 ` [XEN PATCH v2 1/4] x86/mce: address " Nicola Vetrini
2023-08-04 20:43 ` Stefano Stabellini
2023-08-07 12:44 ` Jan Beulich
2023-08-04 8:03 ` [XEN PATCH v2 2/4] x86/mtrr: " Nicola Vetrini
2023-08-04 20:45 ` Stefano Stabellini
2023-08-07 12:48 ` Jan Beulich
2023-08-07 16:43 ` Nicola Vetrini
2023-08-04 8:03 ` [XEN PATCH v2 3/4] x86/irq: rename variable to " Nicola Vetrini
2023-08-04 20:47 ` Stefano Stabellini
2023-08-07 7:18 ` Nicola Vetrini
2023-08-07 12:55 ` Jan Beulich
2023-08-04 8:03 ` [XEN PATCH v2 4/4] x86/setup: " Nicola Vetrini
2023-08-04 20:48 ` Stefano Stabellini
2023-08-07 13:05 ` Jan Beulich
2023-08-07 13:18 ` Nicola Vetrini
2023-08-07 13:42 ` Jan Beulich
2023-08-07 14:10 ` Nicola Vetrini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50fe2600058c0e5224b822ad49db75eb@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=andrew.cooper3@citrix.com \
--cc=ayan.kumar.halder@amd.com \
--cc=consulting@bugseng.com \
--cc=jbeulich@suse.com \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xenia.ragiadakou@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.