From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web09.6398.1574947001928315455 for ; Thu, 28 Nov 2019 05:16:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=emHlRu19; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574947001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bsJzfAbBjrsRbub9JeDmguT90t9XCKVJMDjtMZDYBmw=; b=emHlRu19RAdtDpLxU8dtOhew2MhAoUHgEbWYvIgjw1ffZFydswywHLnj4dld7idn+lS3XK Amn/zfQP+lELcscZatEd/wtGBC0qgfR6KwYcWcS0FtQdGDVXV/S4pMkXRm9ciMgFPMsGVc 330xSgcKMkW5BKupZbMFV4m0NCE+qLo= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205-iFzWfsJWO5ey_xJWMR7qHQ-1; Thu, 28 Nov 2019 08:16:39 -0500 Received: by mail-wm1-f70.google.com with SMTP id n18so3158231wmi.8 for ; Thu, 28 Nov 2019 05:16:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bsJzfAbBjrsRbub9JeDmguT90t9XCKVJMDjtMZDYBmw=; b=YvNJ5mM9t3CXNjUQT1Z0Q8md+9NTZkde58l6sheBW7zajQItIL1xl5DENNWx+37ud1 DQr4+2pO60VGWSg/+s3kUUFXKEIumSdv6pnWJFQs0v56EwdMDYrDgDd4sEljiKgOt+NC vmPbo3xcpxncmvdsbBmNDzDmoeWGBTjuA1rRTYKgUqRPrCaHJHGL9X0Y9m7qcNhmLH7i dGqlqrPQrNumVopEeZvFkVI7FUwEwqU3iUt7yh0mkN21KtDa/3SgXc5cssRSNqydtXiV Z8E2hVD0ASKOP46xsx/EOUfQrX2fECqswsvRNh03k8evFw+RxaV8G8JkuGsSmZ8xT1Zn +jmA== X-Gm-Message-State: APjAAAUT8jbVnLZzjQjk/KY7hjIgg4dMq/SqNBjARM4IQ8hn8CC+PexR nUUkfx+QOamo3s25GnFc+FG/yTlQFOY76tGLe5flU9r3nGS0aqUXoXEriLDI0gQljQmiRuJYHnk Izrn/ITz6vyzEXg== X-Received: by 2002:a05:600c:290e:: with SMTP id i14mr9437558wmd.126.1574946998182; Thu, 28 Nov 2019 05:16:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwHAgfNUVqK4aVZMvNwA7xqgfTdUhlwhhzgOywf7QRAJUIVnqEF8PVj2BhdceOBVrPwa71YeA== X-Received: by 2002:a05:600c:290e:: with SMTP id i14mr9437534wmd.126.1574946998004; Thu, 28 Nov 2019 05:16:38 -0800 (PST) Return-Path: Received: from [192.168.1.35] (182.red-88-21-103.staticip.rima-tde.net. [88.21.103.182]) by smtp.gmail.com with ESMTPSA id m3sm8422372wrs.53.2019.11.28.05.16.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Nov 2019 05:16:36 -0800 (PST) Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain To: devel@edk2.groups.io, theracermaster@gmail.com Cc: Michael D Kinney , Liming Gao References: <20191128055645.53053-1-theracermaster@gmail.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Thu, 28 Nov 2019 14:16:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191128055645.53053-1-theracermaster@gmail.com> X-MC-Unique: iFzWfsJWO5ey_xJWMR7qHQ-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 11/28/19 6:56 AM, Alex James via Groups.Io wrote: > CLANGPDB does not define __GNUC__, but it does define __clang__. Check > for the __clang__ preprocessor definition to use __builtin_offsetof to > implement the OFFSET_OF macro. > > Cc: Michael D Kinney > Cc: Liming Gao > Signed-off-by: Alex James > --- > MdePkg/Include/Base.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h > index 4680e64136..e0bcd0ae67 100644 > --- a/MdePkg/Include/Base.h > +++ b/MdePkg/Include/Base.h > @@ -781,11 +781,9 @@ typedef UINTN *BASE_LIST; > @return Offset, in bytes, of field. > > **/ > -#ifdef __GNUC__ > -#if __GNUC__ >= 4 > +#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__) > #define OFFSET_OF(TYPE, Field) ((UINTN) __builtin_offsetof(TYPE, Field)) > #endif > -#endif > > #ifndef OFFSET_OF > #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field)) > Reviewed-by: Philippe Mathieu-Daude