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

Re: [XEN PATCH][for-4.19 v2 1/1] xen: introduce a deviation for Rule 11.9


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 16 Oct 2023 15:43:05 +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=WBaK3ZLoLXUarm5dtYSB7/wjB4AzfB70ZMT/mwqqPn0=; b=Uu0TB0R2X8pbLc1xL0t+CY2/gYpjkugi5/mCHB1wGFebWwF6lZ1LKdDLzHFOOrYXjQ/UWGR2UREO0UL1/Mkq2I22kyMTRYF4/WZ7Sok/7YmGy3xpJ6lylxxehDOeBVvXOHGPiSwg2x+mMUMbGcIEFw4ELp64dJcOST5QPbs40xWIR0Mzz/CepAMcBCWVVOGpPIaxpcDxPmdTrJ9ZQK1+H/+U074OOLnS1RP3JSTIWj+/rDUfuq/AWO+rGn2zAozHO/koGeLoSMtME48UXeQ3sZcZN7y1gty+Sfv0sD+FTlagp1UzsZ7gmmcA7XXUoWKfwNsqh5gSWhANlldd+rRvsw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d6aPjGOWd3Wywd8RNhockcT3Nkb5mqtyWIDuyD+FOO48mcxX6+mUBB9hh6ELTmvAYpUs+EHEjmjqvrpdIr74MymPluvPIgB8xnbsUCTeCkxKcMn3bXA2E/WnbTptDE0GVep/V/dZeCo/I/UZCM3OwUTxyfeeeooOppUEigGcS+gCY2TxaFnd/fgzPVlYi6QSLdVwdYni4+341QHxgmiYby25bpnPbi2O9vTwckLoIG69vN8aQ1mmBdx4j04mf4QcNQpby+hv6W6LLWw7IrjoeZt3AI9geFGW3FdTPiAKqrOXNH+5QQ/CPeoedikhQWDuz5RzHjPeb7SQeAbEe6aWmw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 16 Oct 2023 13:43:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.10.2023 14:46, Nicola Vetrini wrote:
> --- a/xen/include/xen/compiler.h
> +++ b/xen/include/xen/compiler.h
> @@ -109,13 +109,16 @@
>  
>  #define offsetof(a,b) __builtin_offsetof(a,b)
>  
> +/* Access the field of structure type, without defining a local variable */
> +#define access_field(type, member) (((type *)NULL)->member)

This is not a field access, so I consider the macro misnamed. Question is
whether such a helper macro is needed in the first place.

> +#define typeof_field(type, member) typeof(access_field(type, member))

If this needs adding, it wants to come ...

>  /**
>   * sizeof_field(TYPE, MEMBER)
>   *
>   * @TYPE: The structure containing the field of interest
>   * @MEMBER: The field to return the size of
>   */
> -#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
> +#define sizeof_field(TYPE, MEMBER) sizeof(access_field(TYPE, MEMBER))

... with a commend similar as this one has. (Or the commend could be
slightly altered to cover both).

Further, if fiddling with these: Wouldn't they better move to macros.h?

Jan



 


Rackspace

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