[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/7] xen/device_tree: Fix MISRA C 2012 Rule 20.7 violations


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 Aug 2022 13:48:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9DVRFZwFfMd3QwLGY+pqVfoCJ24rEX8CpOuZIlh2whs=; b=oV/DHnz55ZYc+xqS2/tgfz+sZkkE3G8AYyPOxCZDXLx/W4wbj7JU047Gh208ObS+lwNRwUK6+UB/f3pnU5+nJFQLpoGEB7AOrkqKPQPLh3JuxK7K3oqX2u/dNxzb/Iz4bEnf372F4BlcsqKVw1kFnH1i6wOaCXAHGwEJPbYg4gEszUBWGGlrs8Q/kSZpF+85hyv8KKg2hULqmTY+4Jux93DsqiBQL8Z9TNPuQAzMkmyJHoNWsphKgqxcmNYRWl72C18HTmzrDvbvsm1STUJ0GDS971uJKjSRaQklV52UQ46jSTsAY+PyN7gxJr0MNGfre1q6nw3ixa3xMHShYZy+XA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kCDL2KdXRoWF0UcSKKM9dJsOffdyaHxBctb3zWh5Ap3aEe6c9+s5G7kyKqW2tfBAqWRRUW5PhJDG+W+oZwX1EL52Zq602AMhITujLtKc1WEJ0PtKl/Qqr+WIKGDmJECELCK95mgh+S6rXxGAaKfXvHkvkHag06d/Olu1Kbq6237gGBiqeKKRV2BQBKkaYhGyukj+ISP+WsPn1Tpoj+vg0CSKYqgnykYtEsWxl2tJIxQ7vBLvmyfNJj/jz2mdbTU5sW9Po1c2GXmR/L5s5H69rowBrO8uGDyDjOoX5mpkcs/b1WYqbNFGMYLAFBP8/IstFG2o3lu3BYuCV6DEUuFikw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 22 Aug 2022 11:48:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22.08.2022 12:43, Xenia Ragiadakou wrote:
> On 8/22/22 12:59, Jan Beulich wrote:
>> On 19.08.2022 21:43, Xenia Ragiadakou wrote:
>>> In macros dt_for_each_property_node(), dt_for_each_device_node() and
>>> dt_for_each_child_node(), add parentheses around the macro parameters that
>>> have the arrow operator applied, to prevent against unintended expansions.
>>
>> Why is this relevant only when -> is used? For comparisons and the rhs of
>> assignments it's as relevant, ad even for the lhs of assignments I doubt
>> it can be generally omitted.
> 
> Yes, I agree with you but some older patches that I sent that were 
> adding parentheses around the lhs of the assignments were not accepted 
> and I thought that the rhs of the assignments as well these comparisons 
> fall to the same category.
> 
> Personally, I would expect to see parentheses, also, around the macro 
> parameters that are used as the lhs or the rhs of assignments, the 
> operands of comparison or the arguments of a function.
> Not only because they can prevent against unintentional bugs but because 
> the parentheses help me to identify more easily the macro parameters 
> when reading a macro definition. I totally understand that for other 
> people parentheses may reduce readability.

Afair Julien's comments were very specific to the lhs of assignments.
So at the very least everything else ought to be parenthesized imo.

Jan+



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.