From: Jan Beulich <jbeulich@suse.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
Simone Ballarin <simone.ballarin@bugseng.com>
Cc: consulting@bugseng.com, Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH 09/13] xen/common: address violations of MISRA C:2012 Directive 4.10
Date: Wed, 6 Sep 2023 08:28:41 +0200 [thread overview]
Message-ID: <b782cf54-246c-9226-7246-47ffbd00dea9@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2309051514200.6458@ubuntu-linux-20-04-desktop>
On 06.09.2023 00:18, Stefano Stabellini wrote:
> On Thu, 31 Aug 2023, Simone Ballarin wrote:
>> On 31/08/23 15:05, Jan Beulich wrote:
>>> On 31.08.2023 14:54, Simone Ballarin wrote:
>>>> On 31/08/23 13:10, Jan Beulich wrote:
>>>>> On 31.08.2023 12:08, Simone Ballarin wrote:
>>>>>> The danger of multi-inclusion also exists for .c files, why do you
>>>>>> want
>>>>>> to avoid guards for them?
>>>>>
>>>>> Counter question: Why only add guards to some of them? (My personal
>>>>> answer is "Because it's extra clutter.")
>>>>
>>>> It's not "some of them", it's exactly the ones used in an #include
>>>> directive, so I'm not getting your objection.
>>>
>>> My point is that by adding guards only for files we presently use in some
>>> #include directive, we set us up for introducing new violations as soon
>>> as another .c file becomes the subject of an #include.The more that it
>>> is unusual to add guards in .c files, i.e. it is to be expected that
>>> people wouldn't think about this extra Misra requirement.
>>
>> I can agree to partially adopt the directive: I will add a deviation for C
>> files in rules.txt.
>
> Sorry for the late reply as I was OOO. Please hold on before adding a
> deviation for C files.
>
> In general, I think including .c files is not common behavior, and
> should be restricted to special cases. We could say that exactly because
> they are special, they follow different rules so we can skip the guards.
> Or we could say that they are still at risk of double-inclusion, hence
> we should be consistent and protect them too. I think we should discuss
> the topic during the next MISRA C meeting.
Just one further remark right here: While including a header file a 2nd
time stands a fair chance of working (i.e. the compiler not spitting out
errors), that would be very unusual for a .c file: Every function or
data item it defines would (in the common case) be already defined.
Jan
next prev parent reply other threads:[~2023-09-06 6:29 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 13:19 [XEN PATCH 00/13] address violations of MISRA C:2012 Directive 4.10 Simone Ballarin
2023-08-28 13:19 ` [XEN PATCH 01/13] misra: add deviation for headers that explicitly avoid guards Simone Ballarin
2023-08-28 21:59 ` Stefano Stabellini
2023-08-28 22:32 ` Stefano Stabellini
2023-08-30 8:47 ` Simone Ballarin
2023-08-29 6:33 ` Jan Beulich
2023-08-30 8:46 ` Simone Ballarin
2023-08-28 13:19 ` [XEN PATCH 02/13] automation/eclair: add text-based deviation for empty headers Simone Ballarin
2023-08-28 22:00 ` Stefano Stabellini
2023-08-30 10:25 ` Simone Ballarin
2023-08-29 6:35 ` Jan Beulich
2023-08-30 11:27 ` Simone Ballarin
2023-08-28 13:20 ` [XEN PATCH 03/13] xen/arm: address violations of MISRA C:2012 Directive 4.10 Simone Ballarin
2023-08-28 22:02 ` Stefano Stabellini
2023-08-28 22:10 ` Julien Grall
2023-08-30 12:53 ` Simone Ballarin
2023-08-30 13:01 ` Jan Beulich
2023-08-30 13:06 ` Simone Ballarin
2023-08-28 13:20 ` [XEN PATCH 04/13] xen/x86: " Simone Ballarin
2023-08-28 22:11 ` Stefano Stabellini
2023-08-29 13:21 ` Jan Beulich
2023-08-28 13:20 ` [XEN PATCH 05/13] automation/eclair: add deviation for usercopy.c Simone Ballarin
2023-08-28 22:27 ` Stefano Stabellini
2023-08-29 6:41 ` Jan Beulich
2023-08-30 14:47 ` Simone Ballarin
2023-08-31 1:56 ` Stefano Stabellini
2023-08-31 9:24 ` Jan Beulich
2023-09-04 12:43 ` Luca Fancellu
2023-08-28 13:20 ` [XEN PATCH 06/13] x86/EFI: address violations of MISRA C:2012 Directive 4.10 Simone Ballarin
2023-08-28 22:28 ` Stefano Stabellini
2023-08-29 13:27 ` Jan Beulich
2023-08-30 15:16 ` Simone Ballarin
2023-08-28 13:20 ` [XEN PATCH 07/13] x86/asm: " Simone Ballarin
2023-08-28 22:30 ` Stefano Stabellini
2023-08-30 15:23 ` Simone Ballarin
2023-08-29 6:44 ` Jan Beulich
2023-08-28 13:20 ` [XEN PATCH 08/13] x86/mm: " Simone Ballarin
2023-08-28 22:35 ` Stefano Stabellini
2023-08-28 13:20 ` [XEN PATCH 09/13] xen/common: " Simone Ballarin
2023-08-28 22:41 ` Stefano Stabellini
2023-08-29 6:50 ` Jan Beulich
2023-08-31 10:08 ` Simone Ballarin
2023-08-31 11:10 ` Jan Beulich
2023-08-31 12:54 ` Simone Ballarin
2023-08-31 13:05 ` Jan Beulich
2023-08-31 13:30 ` Simone Ballarin
2023-09-05 22:18 ` Stefano Stabellini
2023-09-06 6:28 ` Jan Beulich [this message]
2023-09-06 7:35 ` Simone Ballarin
2023-08-28 13:20 ` [XEN PATCH 10/13] xen/efi: " Simone Ballarin
2023-08-28 22:42 ` Stefano Stabellini
2023-08-29 6:47 ` Jan Beulich
2023-08-28 13:20 ` [XEN PATCH 11/13] xen/sched: " Simone Ballarin
2023-08-28 22:43 ` Stefano Stabellini
2023-08-30 14:54 ` George Dunlap
2023-08-28 13:20 ` [XEN PATCH 12/13] xen: " Simone Ballarin
2023-08-28 22:51 ` Stefano Stabellini
2023-08-31 12:18 ` Simone Ballarin
2023-08-31 12:25 ` Jan Beulich
2023-09-05 22:27 ` Stefano Stabellini
2023-09-06 6:32 ` Jan Beulich
2023-09-07 1:12 ` Stefano Stabellini
2023-08-29 6:54 ` Jan Beulich
2023-08-28 13:20 ` [XEN PATCH 13/13] x86/asm: " Simone Ballarin
2023-08-28 22:45 ` Stefano Stabellini
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=b782cf54-246c-9226-7246-47ffbd00dea9@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=consulting@bugseng.com \
--cc=george.dunlap@citrix.com \
--cc=julien@xen.org \
--cc=simone.ballarin@bugseng.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/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.