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

Re: [PATCH v2 4/4] tools: add offsetof() to xen-tools/common-macros.h


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 27 Feb 2023 16:53:32 +0100
  • 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=wVQD94cnUTwXOOQ99Y0VOWY/TTwyQj+vYJVQrzsYpOs=; b=h6fH44AVpKQN8ry2W/k++2ZD6vUX+T/CcfZqgpPjTh1KJKbJflIl7TPTWuk8p2ws5hr8fffRtRwctFO8bJ6PyDc8tB3mlUN8S2kBPW8k+AOX2zGucukprvaxq1PJtulQlegVJv0Vhnl6i3nBxHB0kqT5o9Jp0OtDshtnojwNzmlghLRVbmclBHNsBGGbrW2XSBKrUhWpm+TrhSVE4THSi7VYXUBo3PwbJwCA0im0a3aWvm+lFTCXXBpev8TyPYBMaxAgaY1Eqdm2WHMNC5lJLeHCHakNjUYXqhqcpz0wQYQhqAOXhcV/xx5o/tdRYXOyRWAKqYJpb5ZlHdRrem1AkQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EfZv7X5g+Fv3HOsWTGQYTN0quJ4tdsDOzPYTqqZd/ceK8aut1Eg9uIlfYivtumlN3EgVZS4kvbfE56x0g4ik/dyAthMOrODqH0JfrqJykGJrPcHxwYPpU9Ovc0fuTYrKhCyaW8Ib+ytixogfeFYiePpBNhPag/XbUVEhD0uHKNi55g+8YTYKV0xn5rW679Br5mjhfxiww1xqrWHgwXSlFQ7iRauD8du/ImJtugYhZnmWaADRZqpEgSZGvh3wbL7jWKCxPUElCHPZLCQ9Uy0HO51SrBS32ALZ4D0Or/Hdglo4cb1B3uQMdFXd6gwXMEL7xb+CkIhhmYmRIzS2WUP7cw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 27 Feb 2023 15:53:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.02.2023 16:41, Juergen Gross wrote:
> --- a/tools/firmware/include/stddef.h
> +++ b/tools/firmware/include/stddef.h
> @@ -1,10 +1,10 @@
>  #ifndef _STDDEF_H_
>  #define _STDDEF_H_
>  
> +#include <xen-tools/common-macros.h>
> +
>  typedef __SIZE_TYPE__ size_t;
>  
>  #define NULL ((void*)0)
>  
> -#define offsetof(t, m) __builtin_offsetof(t, m)
> -
>  #endif

The C standard is pretty specific about what a header of this name
may or (in particular here) may not define. You add much more to the
name space than just the replacement offsetof(). If this was a
header used by an individual component, this might be fine. But this
header is meant to serve all components under firmware/ which care
to include it. At present that's hvmloader (which we control, so we
can arrange for it to be free of collisions) and rombios (which we
do not really control, and which people also may not build routinely
anymore).

Jan



 


Rackspace

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