All of lore.kernel.org
 help / color / mirror / Atom feed
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.cooper3@citrix.com,
	roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org,
	Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH 03/10] x86: address some violations of MISRA C Rule 20.7
Date: Tue, 05 Mar 2024 11:26:19 +0100	[thread overview]
Message-ID: <bb0f6867074a908bdfd9592bab0c1428@bugseng.com> (raw)
In-Reply-To: <f32720e1-294d-453f-b830-ea524cd27e97@suse.com>

On 2024-02-29 18:05, Jan Beulich wrote:
> On 29.02.2024 17:45, Nicola Vetrini wrote:
>> On 2024-02-29 17:37, Jan Beulich wrote:
>>> On 29.02.2024 16:27, Nicola Vetrini wrote:
>>>> --- a/xen/arch/x86/include/asm/irq.h
>>>> +++ b/xen/arch/x86/include/asm/irq.h
>>>> @@ -179,9 +179,9 @@ void cleanup_domain_irq_mapping(struct domain 
>>>> *d);
>>>>      void *__ret = radix_tree_lookup(&(d)->arch.hvm.emuirq_pirq,
>>>> emuirq);\
>>>>      __ret ? radix_tree_ptr_to_int(__ret) : IRQ_UNBOUND;
>>>>   \
>>>>  })
>>>> -#define IRQ_UNBOUND -1
>>>> -#define IRQ_PT -2
>>>> -#define IRQ_MSI_EMU -3
>>>> +#define IRQ_UNBOUND (-1)
>>>> +#define IRQ_PT      (-2)
>>>> +#define IRQ_MSI_EMU (-3)
>>>> 
>>>>  bool cpu_has_pending_apic_eoi(void);
>>>> 
>>> 
>>> I'd be happy to ack this change right away.
>>> 
>>>> --- a/xen/arch/x86/usercopy.c
>>>> +++ b/xen/arch/x86/usercopy.c
>>>> @@ -106,7 +106,7 @@ unsigned int copy_from_guest_ll(void *to, const
>>>> void __user *from, unsigned int
>>>>      return n;
>>>>  }
>>>> 
>>>> -#if GUARD(1) + 0
>>>> +#if GUARD((1)) + 0
>>> 
>>> I don't even understand the need for this one, and nothing is said in
>>> the description in that regard. Generally I'm afraid I'm averse to
>>> such (seemingly) redundant parentheses in macro invocations.
>>> 
>> 
>> It's because
>> #define UA_KEEP(args...) args
>> #define GUARD UA_KEEP
>> 
>> which would expand to #if 1 + 0, while the rule demands #if (1) + 0
>> I did note in the message after --- that I didn't wanna touch UA_KEEP 
>> so
>> I did this instead, which I'm not particularly happy about either. I 
>> can
>> remove this and deviate, there is no other issue with GUARD.
> 
> Or
> 
> #if (GUARD(1) + 0)
> 
> ? To me at least that's quite a bit less odd. But I guess that still
> wouldn't satisfy the rule. Perhaps even
> 
> #if (GUARD(1)) + 0
> 
> would be a little less odd, albeit there I'd already be on the edge.
> 

Sorry for the late reply. I'll split this in v2. Solution #2 seems ok at 
first glance.

-- 
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)


  reply	other threads:[~2024-03-05 10:26 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 15:27 [XEN PATCH 00/10] address some violations of MISRA C Rule 20.7 Nicola Vetrini
2024-02-29 15:27 ` [XEN PATCH 01/10] xen/include: address " Nicola Vetrini
2024-02-29 16:10   ` Andrew Cooper
2024-02-29 16:21     ` Nicola Vetrini
2024-02-29 16:47       ` Andrew Cooper
2024-02-29 16:53         ` Nicola Vetrini
2024-02-29 16:25   ` Jan Beulich
2024-02-29 16:40     ` Nicola Vetrini
2024-02-29 16:47       ` Jan Beulich
2024-02-29 15:27 ` [XEN PATCH 02/10] xen/arm: address some " Nicola Vetrini
2024-02-29 16:34   ` Jan Beulich
2024-03-01 15:30     ` Nicola Vetrini
2024-03-04 18:17       ` Nicola Vetrini
2024-03-05  1:43         ` Stefano Stabellini
2024-03-05 10:25           ` Nicola Vetrini
2024-02-29 15:27 ` [XEN PATCH 03/10] x86: " Nicola Vetrini
2024-02-29 16:37   ` Jan Beulich
2024-02-29 16:45     ` Nicola Vetrini
2024-02-29 17:05       ` Jan Beulich
2024-03-05 10:26         ` Nicola Vetrini [this message]
2024-02-29 15:27 ` [XEN PATCH 04/10] xen/public: address " Nicola Vetrini
2024-02-29 16:40   ` Jan Beulich
2024-02-29 16:49     ` Nicola Vetrini
2024-02-29 22:49       ` Stefano Stabellini
2024-03-05 10:21         ` Nicola Vetrini
2024-03-05 10:26           ` Jan Beulich
2024-03-05 16:17             ` Nicola Vetrini
2024-03-01  7:54       ` Jan Beulich
2024-02-29 15:27 ` [XEN PATCH 05/10] xen/perfc: " Nicola Vetrini
2024-02-29 16:42   ` Jan Beulich
2024-02-29 16:50     ` Nicola Vetrini
2024-02-29 15:27 ` [XEN PATCH 06/10] arm/smmu: address some " Nicola Vetrini
2024-02-29 22:53   ` Stefano Stabellini
2024-03-05 10:23     ` Nicola Vetrini
2024-03-07  1:31   ` Stefano Stabellini
2024-02-29 15:27 ` [XEN PATCH 07/10] xen/arm: smmuv3: address " Nicola Vetrini
2024-02-29 22:54   ` Stefano Stabellini
2024-02-29 15:28 ` [XEN PATCH 08/10] xen/errno: " Nicola Vetrini
2024-02-29 22:55   ` Stefano Stabellini
2024-03-01  8:10     ` Nicola Vetrini
2024-03-04  9:39   ` Jan Beulich
2024-02-29 15:28 ` [XEN PATCH 09/10] xen/include: tasklet: " Nicola Vetrini
2024-02-29 22:56   ` Stefano Stabellini
2024-02-29 15:28 ` [XEN PATCH 10/10] xen/keyhandler: " Nicola Vetrini
2024-02-29 22:57   ` Stefano Stabellini
2024-03-01  8:00     ` Jan Beulich
2024-03-02  1:37       ` Stefano Stabellini
2024-03-04  8:00         ` Jan Beulich
2024-03-05  2:03           ` Stefano Stabellini
2024-03-05  7:00             ` Jan Beulich
2024-03-07  1:39               ` Stefano Stabellini
2024-03-07  7:42                 ` Jan Beulich
2024-03-07 13:52                   ` Nicola Vetrini

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=bb0f6867074a908bdfd9592bab0c1428@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=bertrand.marquis@arm.com \
    --cc=consulting@bugseng.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --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.